mirror of
https://github.com/MadeOfJelly/MushMachine.git
synced 2024-12-04 19:23:28 +01:00
fix camera, broken since f5eb0e0dfa
This commit is contained in:
parent
601e1ca99d
commit
4304701e5e
@ -72,17 +72,18 @@ glm::mat4 Camera3D::getProjection() const {
|
||||
glm::vec3 Camera3D::getViewDir(void) const {
|
||||
glm::vec3 front {0,0,0};
|
||||
{ // TODO: optimize
|
||||
#if 0
|
||||
// if y up/down
|
||||
front.x += up.y * glm::cos(pitch) * glm::cos(-yaw); // TODO: y is yaw inverted??
|
||||
front.y += up.y * glm::sin(pitch);
|
||||
front.z += up.y * glm::cos(pitch) * glm::sin(-yaw);
|
||||
#else
|
||||
// if z up/down
|
||||
front.x += up.z * glm::cos(pitch) * glm::cos(yaw);
|
||||
front.y += up.z * glm::cos(pitch) * glm::sin(yaw);
|
||||
front.z += up.z * glm::sin(pitch);
|
||||
#endif
|
||||
if (up.y != 0.f) {
|
||||
// if y up/down
|
||||
front.x += up.y * glm::cos(pitch) * glm::cos(-yaw); // TODO: y is yaw inverted??
|
||||
front.y += up.y * glm::sin(pitch);
|
||||
front.z += up.y * glm::cos(pitch) * glm::sin(-yaw);
|
||||
}
|
||||
if (up.z != 0.f) {
|
||||
// if z up/down
|
||||
front.x += up.z * glm::cos(pitch) * glm::cos(yaw);
|
||||
front.y += up.z * glm::cos(pitch) * glm::sin(yaw);
|
||||
front.z += up.z * glm::sin(pitch);
|
||||
}
|
||||
}
|
||||
|
||||
front = glm::normalize(front);
|
||||
|
Loading…
Reference in New Issue
Block a user