Beispiel #1
0
void Projection::setUpOrtho( const Viewport& viewport, float zNear, float zFar )
{
   glm::ivec4 view = viewport.dimensions();
   float helfHeight( view[Viewport::HEIGHT] / 2.0f );
   float halfWidth( view[Viewport::WIDTH] / 2.0f );
   projection_ = glm::ortho( -halfWidth, halfWidth, -helfHeight, helfHeight, zNear, zFar );
}
Beispiel #2
0
void Projection::setUpPerspective( const Viewport& viewport, float fov, float zNear, float zFar )
{
   float aspectRatio( 0.0f );
   glm::ivec4 view = viewport.dimensions();
   if ( view[Viewport::WIDTH] != 0.0f )
      aspectRatio = view[Viewport::WIDTH] / (float)view[Viewport::HEIGHT];
   projection_ = glm::perspective( glm::radians( fov ), aspectRatio, zNear, zFar );
}