Fixed perspective with zNear == 0 (#71)
This commit is contained in:
@@ -31,7 +31,7 @@
|
||||
|
||||
#define GLM_MESSAGES
|
||||
#include "../glm.hpp"
|
||||
|
||||
/*
|
||||
#if(GLM_ARCH & GLM_ARCH_SSE2)
|
||||
struct float4
|
||||
{
|
||||
@@ -54,16 +54,17 @@ int test_simd()
|
||||
}
|
||||
|
||||
#endif//GLM_ARCH
|
||||
|
||||
*/
|
||||
int main()
|
||||
{
|
||||
glm::mat4 A(1.0f);
|
||||
glm::vec4 B(1.0f);
|
||||
glm::vec4 C = A * B;
|
||||
|
||||
/*
|
||||
# if(GLM_ARCH & GLM_ARCH_SSE2)
|
||||
test_simd();
|
||||
# endif
|
||||
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -243,15 +243,11 @@ namespace glm
|
||||
#else
|
||||
valType const rad = glm::radians(fovy);
|
||||
#endif
|
||||
valType range = tan(rad / valType(2)) * zNear;
|
||||
valType left = -range * aspect;
|
||||
valType right = range * aspect;
|
||||
valType bottom = -range;
|
||||
valType top = range;
|
||||
|
||||
valType tanHalfFovy = tan(rad / valType(2));
|
||||
detail::tmat4x4<valType, defaultp> Result(valType(0));
|
||||
Result[0][0] = (valType(2) * zNear) / (right - left);
|
||||
Result[1][1] = (valType(2) * zNear) / (top - bottom);
|
||||
Result[0][0] = valType(1) / (aspect * tanHalfFovy);
|
||||
Result[1][1] = valType(1) / (tanHalfFovy);
|
||||
Result[2][2] = - (zFar + zNear) / (zFar - zNear);
|
||||
Result[2][3] = - valType(1);
|
||||
Result[3][2] = - (valType(2) * zFar * zNear) / (zFar - zNear);
|
||||
|
||||
Reference in New Issue
Block a user