diff --git a/base/camera.hpp b/base/camera.hpp index 97a8824b..c7036992 100644 --- a/base/camera.hpp +++ b/base/camera.hpp @@ -23,11 +23,15 @@ private: glm::mat4 rotM = glm::mat4(1.0f); glm::mat4 transM; - rotM = glm::rotate(rotM, glm::radians(rotation.x), glm::vec3(1.0f, 0.0f, 0.0f)); + rotM = glm::rotate(rotM, glm::radians(rotation.x * (flipY ? -1.0f : 1.0f)), glm::vec3(1.0f, 0.0f, 0.0f)); rotM = glm::rotate(rotM, glm::radians(rotation.y), glm::vec3(0.0f, 1.0f, 0.0f)); rotM = glm::rotate(rotM, glm::radians(rotation.z), glm::vec3(0.0f, 0.0f, 1.0f)); - transM = glm::translate(glm::mat4(1.0f), position); + glm::vec3 translation = position; + if (flipY) { + translation.y *= -1.0f; + } + transM = glm::translate(glm::mat4(1.0f), translation); if (type == CameraType::firstperson) { @@ -51,6 +55,7 @@ public: float movementSpeed = 1.0f; bool updated = false; + bool flipY = false; struct { @@ -85,6 +90,9 @@ public: this->znear = znear; this->zfar = zfar; matrices.perspective = glm::perspective(glm::radians(fov), aspect, znear, zfar); + if (flipY) { + matrices.perspective[1, 1] *= -1.0f; + } }; void updateAspectRatio(float aspect)