Reverse depth is now working in the shadow pass

This commit is contained in:
2025-09-27 21:50:01 +02:00
parent ed69a21b80
commit a2f1e0bd8c
12 changed files with 127 additions and 134 deletions
+19 -1
View File
@@ -2,13 +2,31 @@
#include "Component.h"
#include "Math/Matrix.h"
#include "Transform.h"
#include <glm/trigonometric.hpp>
namespace Seele {
namespace Component {
struct Camera {
float fieldOfView = glm::radians(70.0f);
float aspectRatio = 16.0f / 9.0f;
float nearPlane = 0.1f;
float farPlane = 10000.0f;
float farPlane = 1000.0f;
bool mainCamera = false;
constexpr Matrix4 getProjectionMatrix() const {
if(fieldOfView > 0.0f) {
return perspectiveProjection(fieldOfView, aspectRatio, nearPlane, farPlane);
} else {
float orthoHeight = 10.0f;
float orthoWidth = orthoHeight * aspectRatio;
return orthographicProjection(-orthoWidth / 2.0f, orthoWidth / 2.0f, -orthoHeight / 2.0f, orthoHeight / 2.0f, nearPlane, farPlane);
}
}
constexpr Matrix4 getPerspectiveMatrix() const {
return perspectiveProjection(fieldOfView, aspectRatio, nearPlane, farPlane);
}
constexpr Matrix4 getOrthographicMatrix(float left, float right, float bottom, float top) const {
return orthographicProjection(left, right, bottom, top, nearPlane, farPlane);
}
};
} // namespace Component
} // namespace Seele