forked from Dynamitos/Seele
Reverse depth is now working in the shadow pass
This commit is contained in:
1 parent
ed69a21b80
commit
a2f1e0bd8c
12 files changed
+127
-134
No files matched your search
@@ -1,6 +1,35 @@
|
||||
#include "Matrix.h"
|
||||
|
||||
using namespace Seele;
|
||||
Matrix4 Seele::perspectiveProjection(float fov, float aspect, float nearPlane, float farPlane) {
|
||||
const float e = 1.0f / std::tan(fov * 0.5f);
|
||||
return {
|
||||
{
|
||||
e / aspect,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
},
|
||||
{
|
||||
0.0f,
|
||||
-e,
|
||||
0.0f,
|
||||
0.0f,
|
||||
},
|
||||
{
|
||||
0.0f,
|
||||
0.0f,
|
||||
(nearPlane + farPlane) / (nearPlane - farPlane),
|
||||
-1.0f,
|
||||
},
|
||||
{
|
||||
0.0f,
|
||||
0.0f,
|
||||
(farPlane * nearPlane) / (nearPlane - farPlane),
|
||||
0.0f,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Matrix4 Seele::orthographicProjection(float left, float right, float bottom, float top, float nearPlane, float farPlane) {
|
||||
return Matrix4{
|
||||
@@ -12,20 +41,20 @@ Matrix4 Seele::orthographicProjection(float left, float right, float bottom, flo
|
||||
},
|
||||
{
|
||||
0.0f,
|
||||
2.0f / (top - bottom),
|
||||
-2.0f / (top - bottom),
|
||||
0.0f,
|
||||
0.0f,
|
||||
},
|
||||
{
|
||||
0.0f,
|
||||
0.0f,
|
||||
1.0f / (farPlane - nearPlane),
|
||||
1.0f / (nearPlane - farPlane),
|
||||
0.0f,
|
||||
},
|
||||
{
|
||||
-(right + left) / (right - left),
|
||||
-(top + bottom) / (top - bottom),
|
||||
farPlane / (farPlane - nearPlane),
|
||||
nearPlane / (nearPlane - farPlane),
|
||||
1.0f,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -8,34 +8,6 @@ typedef glm::mat2 Matrix2;
|
||||
typedef glm::mat3 Matrix3;
|
||||
typedef glm::mat4 Matrix4;
|
||||
|
||||
static Matrix4 perspectiveProjection(float fov, float aspect, float nearPlane, float farPlane) {
|
||||
const float e = 1.0f / std::tan(fov * 0.5f);
|
||||
return {
|
||||
{
|
||||
e / aspect,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
},
|
||||
{
|
||||
0.0f,
|
||||
-e,
|
||||
0.0f,
|
||||
0.0f,
|
||||
},
|
||||
{
|
||||
0.0f,
|
||||
0.0f,
|
||||
(nearPlane + farPlane) / (nearPlane - farPlane),
|
||||
-1.0f,
|
||||
},
|
||||
{
|
||||
0.0f,
|
||||
0.0f,
|
||||
(farPlane * nearPlane) / (nearPlane - farPlane),
|
||||
0.0f,
|
||||
},
|
||||
};
|
||||
}
|
||||
Matrix4 perspectiveProjection(float fov, float aspect, float nearPlane, float farPlane);
|
||||
Matrix4 orthographicProjection(float left, float right, float bottom, float top, float nearPlane, float farPlane);
|
||||
} // namespace Seele
|
||||
Reference in new issue
Block a user