mirror of
https://github.com/MadeOfJelly/MushMachine.git
synced 2024-10-29 22:45:34 +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 Camera3D::getViewDir(void) const {
|
||||||
glm::vec3 front {0,0,0};
|
glm::vec3 front {0,0,0};
|
||||||
{ // TODO: optimize
|
{ // TODO: optimize
|
||||||
#if 0
|
if (up.y != 0.f) {
|
||||||
// if y up/down
|
// if y up/down
|
||||||
front.x += up.y * glm::cos(pitch) * glm::cos(-yaw); // TODO: y is yaw inverted??
|
front.x += up.y * glm::cos(pitch) * glm::cos(-yaw); // TODO: y is yaw inverted??
|
||||||
front.y += up.y * glm::sin(pitch);
|
front.y += up.y * glm::sin(pitch);
|
||||||
front.z += up.y * glm::cos(pitch) * glm::sin(-yaw);
|
front.z += up.y * glm::cos(pitch) * glm::sin(-yaw);
|
||||||
#else
|
}
|
||||||
|
if (up.z != 0.f) {
|
||||||
// if z up/down
|
// if z up/down
|
||||||
front.x += up.z * glm::cos(pitch) * glm::cos(yaw);
|
front.x += up.z * glm::cos(pitch) * glm::cos(yaw);
|
||||||
front.y += up.z * glm::cos(pitch) * glm::sin(yaw);
|
front.y += up.z * glm::cos(pitch) * glm::sin(yaw);
|
||||||
front.z += up.z * glm::sin(pitch);
|
front.z += up.z * glm::sin(pitch);
|
||||||
#endif
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
front = glm::normalize(front);
|
front = glm::normalize(front);
|
||||||
|
Loading…
Reference in New Issue
Block a user