From beff497f0e985608abde34cf3e76d932eb8ab5a2 Mon Sep 17 00:00:00 2001 From: andreistr21 <60103919+andreistr21@users.noreply.github.com> Date: Thu, 10 Feb 2022 22:15:05 +0100 Subject: [PATCH] Improved bubbles and movement --- cw 6/src/main_6_1.cpp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/cw 6/src/main_6_1.cpp b/cw 6/src/main_6_1.cpp index dd0c2ca..2a00120 100644 --- a/cw 6/src/main_6_1.cpp +++ b/cw 6/src/main_6_1.cpp @@ -73,6 +73,8 @@ Core::RenderContext smallCoralContext; Core::RenderContext Coral1Context; Core::RenderContext Coral2Context; +Core::RenderContext bubbleContext; + glm::vec3 cameraPos = glm::vec3(0, 0, 0); glm::vec3 cameraDir; // Wektor "do przodu" kamery glm::vec3 cameraSide; // Wektor "w bok" kamery @@ -99,6 +101,8 @@ GLuint smallCoralTexture; GLuint Coral1Texture; GLuint Coral2Texture; +GLuint bubbleTexture; + obj::Model planeModel; @@ -194,11 +198,15 @@ void changeVehicleSpeed() { vehicleSpeed = -0.01f; } - if (vehicleVerticalSpeed > 0.001f) { - vehicleSpeed = 0.001f; + if (vehicleVerticalSpeed > 0.01f) { + vehicleVerticalSpeed = 0.01f; } - if (vehicleVerticalSpeed < -0.001f) { - vehicleSpeed = -0.001f; + if (vehicleVerticalSpeed < -0.01f) { + vehicleVerticalSpeed = -0.01f; + } + + if (vehiclePos.y < sea_bottom_y_pos + 1) { + vehicleVerticalSpeed = 0.01f; } vehiclePos.y = vehiclePos.y + vehicleVerticalSpeed; @@ -643,9 +651,10 @@ void bubbleManager() { glm::mat4 modelMatrix = glm::translate(bubbleLocation[i]); // Scaling models - glm::vec3 scale = glm::vec3(0.001, 0.001, 0.001); + glm::vec3 scale = glm::vec3(0.05, 0.05, 0.05); modelMatrix = glm::scale(modelMatrix, scale); - drawObjectTexture(fish1Context, modelMatrix, textureFish01); + //drawObjectTexture(bubbleContext, modelMatrix, bubbleTexture); + drawObjectColor(bubbleContext, modelMatrix, glm::vec3(.3f, .55f, 0.96f)); } } @@ -899,6 +908,9 @@ void init() loadModelToContext("models/seaweed2.fbx", Coral2Context); Coral2Texture = Core::LoadTexture("textures/seaweed2_BaseColor.png"); + loadModelToContext("models/sphere_different_texcoords.obj", bubbleContext); + bubbleTexture = Core::LoadTexture("textures/white_2.png"); + for (int i = 0; i < fish1Number; i++)