Show
Ignore:
Timestamp:
08/27/10 11:30:01 (21 months ago)
Author:
Carsten
Message:

Reintegrated branches/cafu_to_wx back into trunk!

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • cafu/trunk/Libs/Math3D/Matrix.cpp

    r96 r136  
    6666MatrixT MatrixT::GetProjPerspectiveMatrix(float fovY, float aspect, float zNear, float zFar) 
    6767{ 
     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 
    6881    const float ymax= zNear*float(tan(fovY*3.14159265358979323846f/360.0f)); 
    6982    const float ymin=-ymax;