We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c9a2281 commit 614e274Copy full SHA for 614e274
glm/gtc/matrix_transform.hpp
@@ -96,12 +96,25 @@ class matrix_transform : public constants<T>
96
zero, zero, -(two * zFar * zNear) / d, zero);
97
}
98
99
+ static GLM_API mat<4, 4, T> frustumZO(value_type left, value_type right, value_type bottom, value_type top, value_type zNear, value_type zFar)
100
+ {
101
+ T w = right - left;
102
+ T h = top - bottom;
103
+ T d = zFar - zNear;
104
+
105
+ return mat<4, 4, T>(
106
+ (2.0f * zNear) / w, 0.0f, 0.0f, 0.0f,
107
+ 0.0f, (2.0f * zNear) / h, 0.0f, 0.0f,
108
+ (right + left) / w, (top + bottom) / h, zFar / (zNear - zFar), -1.0f,
109
+ 0.0f, 0.0f, -(zFar * zNear) / d, 0.0f);
110
+ }
111
112
static GLM_API mat<4, 4, T> perspective(T fovY, T aspect, T zNear, T zFar)
113
{
114
#if 0
115
T h = tan(fovY * half) * zNear;
116
T w = h * aspect;
- return frustum(-w, w, -h, h, zNear, zFar);
117
+ return frustumZO(-w, w, -h, h, zNear, zFar);
118
#else
119
const T tanHalfFovy = tan(fovY * half);
120
mat<4, 4, T> m(zero);
0 commit comments