Math/Matrix4: Fix cotangent in projection matrix
Former-commit-id: 57ccfc4fd2a1a8245272328204afa6590a5cb3fb
This commit is contained in:
parent
b7b5458c79
commit
7dd4965f9a
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue