From acb0e7bb2a710ccb3137a326eb85873409fa33d7 Mon Sep 17 00:00:00 2001 From: Maks Kulikowski Date: Sat, 11 Feb 2023 12:42:27 +0100 Subject: [PATCH] little changes to movement of fish --- cw 9/src/ex_9_1.hpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/cw 9/src/ex_9_1.hpp b/cw 9/src/ex_9_1.hpp index 2e5424e..2e85461 100644 --- a/cw 9/src/ex_9_1.hpp +++ b/cw 9/src/ex_9_1.hpp @@ -521,10 +521,11 @@ void renderScene(GLFWwindow* window) if (animal_in_aquarium) { drawObjectPBRWithTexture(models::fish2Context, - glm::translate(glm::vec3(3.f, 1.25f, 0.0f)) + glm::translate(glm::vec3(3.f, 1.25f, 0.0f)) + * glm::rotate(glm::radians(sin(time) * 10.0f), glm::vec3(1.0f, 0.0f, 0.0f)) * glm::eulerAngleY(time) * glm::translate(glm::vec3(1.5f, 0, 0)) - * glm::eulerAngleY(time) *glm::translate(glm::vec3(1.5f, sin(time/3), 0)) * glm::translate(glm::vec3(0, 0, 0)) * glm::scale(glm::vec3(0.5f)) - * glm::rotate(glm::mat4(1.0f), glm::radians(180.0f), glm::vec3(0, 1, 0)), + * glm::eulerAngleY(time) *glm::translate(glm::vec3(1.f, sin(time/3), 0)) * glm::translate(glm::vec3(0, 0, 0)) + * glm::scale(glm::vec3(0.5f)) * glm::rotate(glm::mat4(1.0f), glm::radians(180.0f), glm::vec3(0, 1, 0)), texture::fishRedTexture, 0.5f, 0.0f, 0 @@ -533,7 +534,9 @@ void renderScene(GLFWwindow* window) if (animal_in_box) { drawObjectPBRWithTexture(models::fish2Context, - glm::translate(glm::vec3(-6.55f, 1.25f, 1.11f)) * glm::scale(glm::vec3(0.5f)), + glm::translate(glm::vec3(-6.55f, 1.22f, 1.11f)) + * glm::rotate(glm::radians(sin(time) * 15.0f), glm::vec3(0.0f, 1.0f, 0.0f)) * glm::rotate(glm::radians(sin(-time) * 5.0f), glm::vec3(1.0f, 0.0f, 0.0f)) + * glm::translate(glm::vec3(0.0f, 0.05f * sin(1.0f * time), 0.0f)) * glm::scale(glm::vec3(0.5f)), texture::fishRedTexture, 0.5f, 0.0f, 0 );