fixed shark

This commit is contained in:
Matraf 2022-01-20 14:01:40 +01:00
parent 1611666e96
commit 9fcf4ad62c

View File

@ -349,6 +349,32 @@ glm::mat4 createCameraMatrix()
return Core::createViewMatrixQuat(cameraPos, rotation);
}
/*
glm::mat4 createCameraMatrix()
{
glm::quat quatX = glm::angleAxis(differenceY * 0.01f, glm::vec3(1.0, 0.0, 0.0));
glm::quat quatY = glm::angleAxis(differenceX * 0.01f, glm::vec3(0.0, 1.0, 0.0));
auto rotX = glm::normalize(quatX);
auto rotY = glm::normalize(quatY);
rotationX = glm::normalize(rotX * rotationX);
rotationY = glm::normalize(rotY * rotationY);
rotation = glm::normalize(rotationX * rotationY);
cameraDir = inverse(rotation) * glm::vec3(0, 0, -1);
cameraSide = inverse(rotation) * glm::vec3(1, 0, 0);
differenceY = 0.0f;
differenceX = 0.0f;
cameraPos = glm::vec3(spherePos.x, spherePos.y, spherePos.z) + glm::mat3_cast(inverse(rotation)) * glm::vec3(0, 2, 7);
return Core::createViewMatrixQuat(cameraPos, rotation);
}
*/
std::vector<glm::vec3> changeKeyPoints(std::vector<glm::vec3> keyPoints, glm::vec3 toChange) {
std::vector<glm::vec3> result;
int size = keyPoints.size();
@ -465,10 +491,16 @@ void renderScene()
drawObjectTexture(fishContext, animationMatrix(time + 15, change3, fishKeyPointsFirst, fishKeyRotationFirst, glm::vec3(0.8f), 1.f), textureFish, programTexture);
drawObjectTexture(fishContext, animationMatrix(time + 15, change4, fishKeyPointsFirst, fishKeyRotationFirst, glm::vec3(0.8f), 1.f), textureFish, programTexture);
drawObjectTexture(fangtoothContext, animationMatrix(time + 15, change1, fishKeyPointsSecond, fishKeyRotationSecond, glm::vec3(0.25f), 1.f), textureFangtooth, programTexture);
drawObjectTexture(sharkContext, animationMatrix(time + 15, change1, sharkKeyPoints, sharkKeyRotation, glm::vec3(10.8f), 1.f), textureShark, programTexture);
time -= 5;
}
}
if (time > -10) {
drawObjectTexture(sharkContext, animationMatrix(time + 15, change1, sharkKeyPoints, sharkKeyRotation, glm::vec3(10.8f), 1.f), textureShark, programTexture);
time -= 5;
}
//for (int i = 0; i < 3; i++) {
// if (time > -10) {