improve shadow map stability
This commit is contained in:
@@ -28,6 +28,9 @@ void Camera::rotate(float x, float y, float z) {
|
||||
}
|
||||
|
||||
glm::mat4 Camera::getProjection() const {
|
||||
if (projset) {
|
||||
return projection;
|
||||
}
|
||||
if (perspective) {
|
||||
return glm::perspective(fov * zoom, ar, near, far);
|
||||
} else if (flipped) {
|
||||
@@ -62,6 +65,11 @@ float Camera::getFov() const {
|
||||
return fov;
|
||||
}
|
||||
|
||||
void Camera::setProjection(const glm::mat4& matrix) {
|
||||
projection = matrix;
|
||||
projset = true;
|
||||
}
|
||||
|
||||
float Camera::getAspectRatio() const {
|
||||
return ar;
|
||||
}
|
||||
|
||||
@@ -21,6 +21,9 @@ public:
|
||||
float near = 0.05f;
|
||||
float far = 1500.0f;
|
||||
|
||||
bool projset = false;
|
||||
glm::mat4 projection;
|
||||
|
||||
Camera() {
|
||||
updateVectors();
|
||||
}
|
||||
@@ -36,6 +39,8 @@ public:
|
||||
void setFov(float fov);
|
||||
float getFov() const;
|
||||
|
||||
void setProjection(const glm::mat4& matrix);
|
||||
|
||||
float getAspectRatio() const;
|
||||
void setAspectRatio(float ar);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user