Improved bubbles and movement

This commit is contained in:
andreistr21 2022-02-10 22:15:05 +01:00
parent c260a57621
commit beff497f0e

View File

@ -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++)