Transformable now uses a matrix

This commit is contained in:
Robert 2021-01-23 13:19:13 +01:00
parent 30736781ab
commit 3e6884356f
4 changed files with 63 additions and 199 deletions

View file

@ -53,32 +53,8 @@ namespace oglu
void Camera::LookAt(GLfloat x, GLfloat y, GLfloat z)
{
glm::mat4 newTransform = glm::lookAt(glm::make_vec3(position), glm::vec3(x, y, z), glm::vec3(0.0f, 1.0f, 0.0f));
glm::vec3 scale;
glm::vec3 pos;
glm::quat rot;
glm::vec3 skew;
glm::vec4 pers;
glm::decompose(newTransform, scale, rot, pos, skew, pers);
memcpy(
position,
glm::value_ptr(pos),
3 * sizeof(float)
);
memcpy(
rotation,
glm::value_ptr(glm::toMat4(rot)),
16 * sizeof(float)
);
memcpy(
scaling,
glm::value_ptr(scale),
3 * sizeof(float)
);
calculateMatrix = true;
transformation = glm::lookAt(translation, glm::vec3(x, y, z), glm::vec3(0.0f, 1.0f, 0.0f));
glm::decompose(transformation, scale, orientation, translation, skew, perspective);
}
void Camera::LookAt(const GLfloat* target)