Camera should be correct now

This commit is contained in:
Gamemaker1998
2025-04-13 15:37:50 +02:00
parent 19007ac601
commit 3213289f10
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -22,8 +22,8 @@ Matrix4 Viewport::getProjectionMatrix() const {
if (fieldOfView > 0.0f) {
Matrix4 projectionMatrix = glm::perspective(fieldOfView, sizeX / static_cast<float>(sizeY), 0.1f, 1000.0f);
Matrix4 correctionMatrix = Matrix4(
1, 0, 0, 0,
0, -1, 0, 0,
1, 0, 0, 0,
0, -1, 0, 0,
0, 0, 1 / 2.f, 0,
0, 0, 1 / 2.f, 1);
return correctionMatrix * projectionMatrix;
+1 -1
View File
@@ -9,6 +9,6 @@ CameraUpdater::~CameraUpdater() {}
void CameraUpdater::update(Component::Camera& camera, Component::Transform& transform) {
Vector eyePos = transform.getPosition();
Vector lookAt = eyePos + transform.getForward();
Vector lookAt = eyePos - transform.getForward();
camera.viewMatrix = glm::lookAt(eyePos, lookAt, Vector(0, 1, 0));
}