Changeset 136 for cafu/trunk/Libs/Math3D/Matrix.cpp
- Timestamp:
- 08/27/10 11:30:01 (21 months ago)
- Files:
-
- 1 modified
-
cafu/trunk/Libs/Math3D/Matrix.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
cafu/trunk/Libs/Math3D/Matrix.cpp
r96 r136 66 66 MatrixT MatrixT::GetProjPerspectiveMatrix(float fovY, float aspect, float zNear, float zFar) 67 67 { 68 if (zFar<=zNear) 69 { 70 // If zFar <= zNear, the far plane is assumed to be at infinity (a useful special case for stencil shadow projections). 71 // This code is also used in <http://trac.cafu.de/browser/cafu/trunk/Libs/OpenGL/OpenGLWindow.cpp?rev=100#L137>. 72 const float cotanFovY=1.0f/tan(fovY*3.14159265358979323846f/360.0f); 73 74 return MatrixT( 75 cotanFovY/aspect, 0.0f, 0.0f, 0.0f, 76 0.0f, cotanFovY, 0.0f, 0.0f, 77 0.0f, 0.0f, -1.0f, -2.0f*zNear, 78 0.0f, 0.0f, -1.0f, 0.0f); 79 } 80 68 81 const float ymax= zNear*float(tan(fovY*3.14159265358979323846f/360.0f)); 69 82 const float ymin=-ymax;
