Delete not using function

This commit is contained in:
Michal Zaporski 2022-02-09 14:28:13 +01:00
parent fc233f0aa3
commit 5c26c5b2ef

View File

@ -211,7 +211,7 @@ void drawObjectTexture(Core::RenderContext context, glm::mat4 modelMatrix, GLuin
glUseProgram(0); glUseProgram(0);
} }
void drawTranslucentObjects(int x, int y) { void drawTranslucentObjects() {
float time = glutGet(GLUT_ELAPSED_TIME) / 1000.f; float time = glutGet(GLUT_ELAPSED_TIME) / 1000.f;
@ -275,36 +275,6 @@ void renderCoralTrees() {
drawObjectColor(coralTreeContext, glm::translate(glm::vec3(30, -18, -20)) * glm::scale(glm::vec3(1.2f)), glm::vec3(0.5802f, 0.1406f, 0.74f)); drawObjectColor(coralTreeContext, glm::translate(glm::vec3(30, -18, -20)) * glm::scale(glm::vec3(1.2f)), glm::vec3(0.5802f, 0.1406f, 0.74f));
} }
void secondRenderingPass() {
float time = glutGet(GLUT_ELAPSED_TIME) / 1000.f;
// Aktualizacja macierzy widoku i rzutowania
cameraMatrix = createCameraMatrix();
// glColor3f(1, 1, 1);
// glTranslatef(5, .6, -2);
glm::mat4 shipModelMatrix = glm::translate(cameraPos + cameraDir * 0.5f) * glm::mat4_cast(glm::inverse(cameraRotation)) * shipInitialTransformation;
drawObjectTexture(shipContext, shipModelMatrix, caustics[causticIndex]);
drawObjectTexture(seafloorContext, glm::translate(glm::vec3(0,-15,0)) * glm::scale(glm::vec3(10.f)), caustics[causticIndex]);
// Animals
drawObjectTexture(seaTurtleContext, glm::translate(glm::vec3(0, cos(time) - 3, 0)) * glm::rotate(glm::radians(270.f), glm::vec3(1, 0, 0)) * glm::scale(glm::vec3(0.015f)), caustics[causticIndex]);
drawObjectTexture(crabContext, glm::translate(glm::vec3(cos(time / 7) * 10, -13, 0)) * glm::rotate(glm::radians(270.f), glm::vec3(1, 0, 0)) * glm::scale(glm::vec3(0.2f)), caustics[causticIndex]);
for (int i = 0; i < 15; i++) drawObjectTexture(firstFishContext, glm::translate(glm::vec3(firstFishPositions[i][0], firstFishPositions[i][1], firstFishPositions[i][2])) * glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(-20, 0, 0)) * glm::rotate(glm::radians(cos(8 * time) * 8), glm::vec3(0, 1, 0)) * glm::scale(glm::vec3(0.6f)), caustics[causticIndex]);
for (int i = 0; i < 15; i++) drawObjectTexture(secondFishContext, glm::translate(glm::vec3(secondFishPositions[i][0], secondFishPositions[i][1], secondFishPositions[i][2])) * glm::eulerAngleY(float(-time / 1.75)) * glm::translate(glm::vec3(20, 0, 0)) * glm::rotate(glm::radians(cos(10 * time) * 12), glm::vec3(0, 1, 0)) * glm::rotate(glm::radians(90.f), glm::vec3(0, 1, 0)) * glm::rotate(glm::radians(270.f), glm::vec3(1, 0, 0)) * glm::scale(glm::vec3(0.1f)), caustics[causticIndex]);
for (int i = 0; i < 15; i++) drawObjectTexture(thirdFishContext, glm::translate(glm::vec3(thirdFishPositions[i][0], thirdFishPositions[i][1], thirdFishPositions[i][2])) * glm::eulerAngleY(float(time / 2.5)) * glm::translate(glm::vec3(-20, 0, 0)) * glm::rotate(glm::radians(cos(8 * time) * 8), glm::vec3(0, 1, 0)) * glm::scale(glm::vec3(0.5f)), caustics[causticIndex]);
// Plants
drawObjectTexture(coralTreeContext, glm::translate(glm::vec3(0, -14, 2)) * glm::scale(glm::vec3(0.5f)), caustics[causticIndex]);
drawObjectTexture(coralContext, glm::translate(glm::vec3(0, -14, 8)) * glm::rotate(glm::radians(270.f), glm::vec3(1, 0, 0)) * glm::scale(glm::vec3(0.1f)), caustics[causticIndex]);
drawObjectTexture(gorgonianCoralContext, glm::translate(glm::vec3(0, -14, 16)) * glm::rotate(glm::radians(270.f), glm::vec3(1, 0, 0)) * glm::scale(glm::vec3(0.07f)), caustics[causticIndex]);
drawObjectTexture(shipwreckContext, glm::translate(glm::vec3(20, -15, 0)) * glm::rotate(glm::radians(255.f), glm::vec3(1, 0, 0)) * glm::scale(glm::vec3(0.003f)), caustics[causticIndex]);
glDepthMask(GL_TRUE);
glDepthFunc(GL_LESS);
glDisable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
void renderRocks(bool causticPass) { void renderRocks(bool causticPass) {
// Rocks // Rocks
drawObjectTexture(rockContext, glm::translate(glm::vec3(30, -13, 40)) * glm::rotate(glm::radians(270.f), glm::vec3(1, 0, 0)) * glm::scale(glm::vec3(6.f)), causticPass ? textureRockBrown : caustics[causticIndex]); drawObjectTexture(rockContext, glm::translate(glm::vec3(30, -13, 40)) * glm::rotate(glm::radians(270.f), glm::vec3(1, 0, 0)) * glm::scale(glm::vec3(6.f)), causticPass ? textureRockBrown : caustics[causticIndex]);
@ -398,9 +368,7 @@ void renderScene()
renderObjects(false); renderObjects(false);
renderObjects(true); renderObjects(true);
drawTranslucentObjects(0, 20); drawTranslucentObjects();
drawTranslucentObjects(20, 40);
drawTranslucentObjects(40, 100);
// Render the scene // Render the scene
glFlush(); glFlush();