Add skybox move with camera.

This commit is contained in:
Michal Zaporski 2022-01-23 17:54:55 +01:00
parent 03b82de106
commit da407c4993

View File

@ -171,10 +171,9 @@ void renderScene()
glm::mat4 shipModelMatrix = glm::translate(cameraPos + cameraDir * 0.5f) * glm::mat4_cast(glm::inverse(rotation)) * shipInitialTransformation;
drawObjectColor(shipContext, shipModelMatrix, glm::vec3(0.6f));
drawObjectTexture(seafloorContext, glm::translate(glm::vec3(0,-15,0)) * glm::scale(glm::vec3(5.0f, 1.0f, 5.0f)), textureSand);
//drawObjectColor(skyboxContext, glm::translate(glm::vec3(0, -15, 0)) * glm::scale(glm::vec3(1.0f, 1.0f, 1.0f)), glm::vec3(0.7098f, 0.7098f, 0.7098f));
drawObjectTexture(skyboxContext, glm::translate(glm::vec3(0, -15, 0)) * glm::scale(glm::vec3(1.0f, 1.0f, 1.0f)), textureSkybox);
drawObjectTexture(skyboxContext, glm::translate(cameraPos) * glm::translate(glm::vec3(0, -15, 0)) * glm::scale(glm::vec3(1.0f, 1.0f, 1.0f)), textureSkybox);
// 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)), textureSeaTurtle);
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)), textureCrab);
@ -217,7 +216,6 @@ void init()
programTexture = shaderLoader.CreateProgram("shaders/shader_tex.vert", "shaders/shader_tex.frag");
loadModelToContext("models/sub.obj", shipContext);
loadModelToContext("models/sphere.obj", sphereContext);
loadModelToContext("models/ship.obj", shipContext);
loadModelToContext("models/seafloor.obj", seafloorContext);
loadModelToContext("models/skybox.obj", skyboxContext);
loadModelToContext("models/first_fish.obj", firstFishContext);
@ -228,8 +226,8 @@ void init()
loadModelToContext("models/coral_tree.obj", coralTreeContext);
loadModelToContext("models/coral.obj", coralContext);
loadModelToContext("models/gorgonian_coral.obj", gorgonianCoralContext);
bubbleTexture = Core::LoadTexture("textures/bubble.png");
loadModelToContext("models/shipwreck.obj", shipwreckContext);
bubbleTexture = Core::LoadTexture("textures/bubble.png");
textureSkybox = Core::LoadTexture("textures/skybox.png");
textureFirstFish = Core::LoadTexture("textures/first_fish.png");
textureSecondFish = Core::LoadTexture("textures/second_fish.png");