Demo entry 5930798

CreateOrtographicProj

   

Submitted by anonymous on Sep 05, 2016 at 19:00
Language: C++. Code size: 680 Bytes.

CMatrix4x4 CreateOrtographicProj (float left,   float right, 
                                  float bottom, float top, 
                                  float Near,   float zFar)
{
   CMatrix4x4 result;
   
   float  tx = -(right+left)/(right-left),
          ty = -(top+bottom)/(top-bottom),
          tz = -(zFar+zNear)/(zFar-zNear);
   
   result.Set (2.f/(right-left), 0.f,              0.f,               tx,
               0.f,              2.f/(top-bottom), 0.f,               ty,
               0.f,              0.f,             -2.f/(zFar-zNear),  tz,
               0.f,              0.f,              0.f,               1.f);
   
   return result;
}

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).