Math/Matrix4: Fix cotangent in projection matrix

Former-commit-id: 57ccfc4fd2a1a8245272328204afa6590a5cb3fb
This commit is contained in:
Lynix 2015-06-26 14:05:50 +02:00
parent b7b5458c79
commit 7dd4965f9a
2 changed files with 5 additions and 1 deletions

View File

@ -16,6 +16,10 @@
#define M_PI 3.141592653589793238462643 #define M_PI 3.141592653589793238462643
#endif #endif
#ifndef M_PI_2
#define M_PI_2 1.5707963267948966192313217
#endif
#ifndef M_SQRT2 #ifndef M_SQRT2
#define M_SQRT2 1.4142135623730950488016887 #define M_SQRT2 1.4142135623730950488016887
#endif #endif

View File

@ -623,7 +623,7 @@ NzMatrix4<T>& NzMatrix4<T>::MakePerspective(T angle, T ratio, T zNear, T zFar)
angle = NzDegreeToRadian(angle/F(2.0)); angle = NzDegreeToRadian(angle/F(2.0));
#endif #endif
T yScale = F(1.0) / std::tan(angle); T yScale = std::tan(M_PI_2 - angle);
Set(yScale / ratio, F(0.0), F(0.0), F(0.0), Set(yScale / ratio, F(0.0), F(0.0), F(0.0),
F(0.0), yScale, F(0.0), F(0.0), F(0.0), yScale, F(0.0), F(0.0),