mirror of
https://github.com/g-truc/glm.git
synced 2024-11-25 18:04:34 +00:00
Fixed perspective with zNear == 0 (#71)
This commit is contained in:
parent
1c68cee29b
commit
01a98e97c1
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
#define GLM_MESSAGES
|
#define GLM_MESSAGES
|
||||||
#include "../glm.hpp"
|
#include "../glm.hpp"
|
||||||
|
/*
|
||||||
#if(GLM_ARCH & GLM_ARCH_SSE2)
|
#if(GLM_ARCH & GLM_ARCH_SSE2)
|
||||||
struct float4
|
struct float4
|
||||||
{
|
{
|
||||||
@ -54,16 +54,17 @@ int test_simd()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif//GLM_ARCH
|
#endif//GLM_ARCH
|
||||||
|
*/
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
glm::mat4 A(1.0f);
|
glm::mat4 A(1.0f);
|
||||||
glm::vec4 B(1.0f);
|
glm::vec4 B(1.0f);
|
||||||
glm::vec4 C = A * B;
|
glm::vec4 C = A * B;
|
||||||
|
|
||||||
|
/*
|
||||||
# if(GLM_ARCH & GLM_ARCH_SSE2)
|
# if(GLM_ARCH & GLM_ARCH_SSE2)
|
||||||
test_simd();
|
test_simd();
|
||||||
# endif
|
# endif
|
||||||
|
*/
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -243,15 +243,11 @@ namespace glm
|
|||||||
#else
|
#else
|
||||||
valType const rad = glm::radians(fovy);
|
valType const rad = glm::radians(fovy);
|
||||||
#endif
|
#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));
|
detail::tmat4x4<valType, defaultp> Result(valType(0));
|
||||||
Result[0][0] = (valType(2) * zNear) / (right - left);
|
Result[0][0] = valType(1) / (aspect * tanHalfFovy);
|
||||||
Result[1][1] = (valType(2) * zNear) / (top - bottom);
|
Result[1][1] = valType(1) / (tanHalfFovy);
|
||||||
Result[2][2] = - (zFar + zNear) / (zFar - zNear);
|
Result[2][2] = - (zFar + zNear) / (zFar - zNear);
|
||||||
Result[2][3] = - valType(1);
|
Result[2][3] = - valType(1);
|
||||||
Result[3][2] = - (valType(2) * zFar * zNear) / (zFar - zNear);
|
Result[3][2] = - (valType(2) * zFar * zNear) / (zFar - zNear);
|
||||||
|
@ -50,10 +50,7 @@ GLM 0.9.5.0: 2013-XX-XX
|
|||||||
- Fixed GTX_multiple for negative value
|
- Fixed GTX_multiple for negative value
|
||||||
- Removed GTX_ocl_type extension
|
- Removed GTX_ocl_type extension
|
||||||
- Fixed post increment and decrement operators
|
- Fixed post increment and decrement operators
|
||||||
|
- Fixed perspective with zNear == 0 (#71)
|
||||||
================================================================================
|
|
||||||
GLM 0.9.4.4: 2013-0X-XX
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
- Fixed slerp when costheta is close to 1
|
- Fixed slerp when costheta is close to 1
|
||||||
- Fixed mat4x2 value_type constructor
|
- Fixed mat4x2 value_type constructor
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ int main()
|
|||||||
{
|
{
|
||||||
int Error = 0;
|
int Error = 0;
|
||||||
|
|
||||||
|
glm::mat4 Projection = glm::perspective(45.0f, 4.0f / 3.0f, 0.1f, 100.0f);
|
||||||
glm::mat4 Pick = glm::pickMatrix(glm::vec2(1, 2), glm::vec2(3, 4), glm::ivec4(0, 0, 320, 240));
|
glm::mat4 Pick = glm::pickMatrix(glm::vec2(1, 2), glm::vec2(3, 4), glm::ivec4(0, 0, 320, 240));
|
||||||
|
|
||||||
return Error;
|
return Error;
|
||||||
|
Loading…
Reference in New Issue
Block a user