This is a base class for a camera.
The actual cameras are OrthographicCamera and PerspectiveCamera.This class hash the shared functionality for transforms and queries in 3d space. In particular, it has several methods that help you to select a 3d object with the mouse.
The design of this class ensures that the direction vector and the up vector of the camera are orthonormal at all times.
Ray cugl::Camera::getPickRay 
( 
const Vec3 
windowCoords  ) 
const 
Returns a picking Ray from the coordinates given in window coordinates.
A picking ray is used to select an object in 3d space. It creates a ray into the screen based on a selection in the viewport. You can then use this ray to select an object.
Window coords are the location of the point in the viewport. Ideally, the viewport should be the same size as the screen, but these are not screen coordinates. The screen has the origin in the top left, while window coordinates still have the origin in the bottom left.
While the viewport is a flat 2d plane, this method still takes a 3d point. The zcoordinate corresponds to the position of the point in the zbuffer.
 Parameters

windowCoords  The point in window coordinates 
Returns a picking Ray from the coordinates given in window coordinates.
Ray cugl::Camera::getPickRay 
( 
const Vec3 
windowCoords, 


const Rect 
viewport 

) 
 const 
Returns a picking Ray from the coordinates given in window coordinates.
A picking ray is used to select an object in 3d space. It creates a ray into the screen based on a selection in the viewport. You can then use this ray to select an object.
Window coords are the location of the point in the viewport. Ideally, the viewport should be the same size as the screen, but these are not screen coordinates. The screen has the origin in the top left, while window coordinates still have the origin in the bottom left.
While the viewport is a flat 2d plane, this method still takes a 3d point. The zcoordinate corresponds to the position of the point in the zbuffer.
 Parameters

windowCoords  The point in window coordinates 
viewport  The screen viewport 
Returns a picking Ray from the coordinates given in window coordinates.
Ray cugl::Camera::getPickRayFromScreen 
( 
const Vec2 
screenCoords  ) 
const 

inline 
Returns a picking Ray from the coordinates given in screen coordinates.
A picking ray is used to select an object in 3d space. It creates a ray into the screen based on a selection in the viewport. You can then use this ray to select an object.
Screen coords differ from window coordinates, as the the origin is in the top left instad of the bottom left. The SDL event system uses screen space for input events, which is why this method is necessary.
 Parameters

screenCoords  The point in screen coordinates 
Returns a picking Ray from the coordinates given in screen coordinates.
Vec3 cugl::Camera::project 
( 
const Vec3 
worldCoords  ) 
const 
Returns the window space equivalent of a point in world coordinates.
This is the same as GLU gluProject. Window coords are the location of the point in the viewport. Ideally, the viewport should be the same size as the screen, but these are not screen coordinates. The screen has the origin in the top left, while
While the viewport is a flat 2d plane, this method still returns a 3d point. The zcoordinate corresponds to the position of the point in the zbuffer.
 Parameters

worldCoords  The point in wprld coordinates 
 Returns
 the window space equivalent of a point in world coordinates.
Vec3 cugl::Camera::project 
( 
const Vec3 
worldCoords, 


const Rect 
viewport 

) 
 const 
Returns the window space equivalent of a point in world coordinates.
This is the same as GLU gluProject. Window coords are the location of the point in the viewport. Ideally, the viewport should be the same size as the screen, but these are not screen coordinates. The screen has the origin in the top left, while
While the viewport is a flat 2d plane, this method still returns a 3d point. The zcoordinate corresponds to the position of the point in the zbuffer.
 Parameters

worldCoords  The point in world coordinates 
viewport  The screen viewport 
 Returns
 the window space equivalent of a point in world coordinates.
Vec3 cugl::Camera::screenToWindowCoords 
( 
const Vec2 
screenCoords  ) 
const 
Returns the screen space equivalent of a point in window coordinates.
Ideally, window space and screen space would be the same space. They are both defined by the viewport and have the same offset and dimension. However, screen coordinates have the origin in the top left while window coordinates have the origin in the bottom left.
We need this conversion because events (such as mouse clicks) register in screen space, while drawing happens in window space.
While the viewport is a flat 2d plane, this method still takes a 3d point. The zcoordinate corresponds to the near position, closest to the screen.
 Parameters

screenCoords  The point in screen coordinates 
Vec3 cugl::Camera::screenToWindowCoords 
( 
const Vec2 
screenCoords, 


const Rect 
viewport 

) 
 const 
Returns the screen space equivalent of a point in window coordinates.
Ideally, window space and screen space would be the same space. They are both defined by the viewport and have the same offset and dimension. However, screen coordinates have the origin in the top left while window coordinates have the origin in the bottom left.
We need this conversion because events (such as mouse clicks) register in screen space, while drawing happens in window space.
While the viewport is a flat 2d plane, this method still takes a 3d point. The zcoordinate corresponds to the near position, closest to the screen.
 Parameters

screenCoords  The point in screen coordinates 
viewport  The screen viewport 
Vec3 cugl::Camera::screenToWorldCoords 
( 
const Vec2 
screenCoords  ) 
const 

inline 
Returns the world space equivalent of a point in screen coordinates.
Ideally, window space and screen space would be the same space. They are both defined by the viewport and have the same offset and dimension. However, screen coordinates have the origin in the top left while window coordinates have the origin in the bottom left.
In computing the world space coordinates, this method assumes that the zvalue of the original vector is the same as near, which is the closest it can be the screen.
This method is important for converting event coordinates (such as a mouse click) to world coordinates.
 Parameters

screenCoords  The point in screen coordinates 
 Returns
 the world space equivalent of a point in screen coordinates.
Vec3 cugl::Camera::unproject 
( 
const Vec3 
windowCoords  ) 
const 
Returns the world space equivalent of a point in window coordinates.
This is the same as GLU gluUnProject, but does not rely on OpenGL. Window coords are the location of the point in the viewport. Ideally, the viewport should be the same size as the screen, but these are not screen coordinates. The screen has the origin in the top left, while Window coordinates still have the origin in the bottom left.
While the viewport is a flat 2d plane, this method still requires a 3d point. The zcoordinate corresponds to the position of the point in the zbuffer.
 Parameters

windowCoords  The point in window coordinates 
 Returns
 the world space equivalent of a point in window coordinates.
Vec3 cugl::Camera::unproject 
( 
const Vec3 
windowCoords, 


const Rect 
viewport 

) 
 const 
Returns the world space equivalent of a point in window coordinates.
This is the same as GLU gluUnProject, but does not rely on OpenGL. Window coords are the location of the point in the viewport. Ideally, the viewport should be the same size as the screen, but these are not screen coordinates. The screen has the origin in the top left, while Window coordinates still have the origin in the bottom left.
While the viewport is a flat 2d plane, this method still requires a 3d point. The zcoordinate corresponds to the position of the point in the zbuffer.
 Parameters

windowCoords  The point in window coordinates 
viewport  The screen viewport 
 Returns
 the world space equivalent of a point in window coordinates.
Vec2 cugl::Camera::windowToScreenCoords 
( 
const Vec3 
windowCoords  ) 
const 
Returns the window space equivalent of a point in screen coordinates.
Ideally, window space and screen space would be the same space. They are both defined by the viewport and have the same offset and dimension. However, screen coordinates have the origin in the top left while window coordinates have the origin in the bottom left.
We need this conversion because events (such as mouse clicks) register in screen space, while drawing happens in window space.
 Parameters

windowCoords  The point in window coordinates 
Vec2 cugl::Camera::windowToScreenCoords 
( 
const Vec3 
windowCoords, 


const Rect 
viewport 

) 
 const 
Returns the window space equivalent of a point in screen coordinates.
Ideally, window space and screen space would be the same space. They are both defined by the viewport and have the same offset and dimension. However, screen coordinates have the origin in the top left while window coordinates have the origin in the bottom left.
We need this conversion because events (such as mouse clicks) register in screen space, while drawing happens in window space.
 Parameters

windowCoords  The point in window coordinates 
viewport  The screen viewport 
Vec2 cugl::Camera::worldToScreenCoords 
( 
const Vec3 
worldCoords  ) 
const 

inline 
Returns the screen space equivalent of a point in world coordinates.
Ideally, window space and screen space would be the same space. They are both defined by the viewport and have the same offset and dimension. However, screen coordinates have the origin in the top left while window coordinates have the origin in the bottom left.
This method is important for converting world coordinates to event coordinates (such as a mouse click).
 Parameters

worldCoords  The point in wprld coordinates 
 Returns
 the screen space equivalent of a point in world coordinates.