Om  1.0.0
A universal framework for multimedia simulation
Public Member Functions | List of all members
om::graphics::base::Viewport Class Reference

A class that represents a rectangular axis-aligned portion of the screen which should be rendered to. More...

#include <omGraphicsViewport.h>

Public Member Functions

 Viewport ()
 Create a new viewport which covers the entire framebuffer. More...
 
 Viewport (Float width, Float height)
 Create a new viewport with the specified width and height with lower left corner at (0,0). More...
 
 Viewport (Float xMin, Float xMax, Float yMin, Float yMax)
 Create a new viewport which uses the area defined by the given min and max coordinates for each axis. More...
 
 Viewport (const Vector2f &min, const Vector2f &max)
 Create a new viewport which uses the specified minimum and maximum points to define its bounds. More...
 
 Viewport (const AABB2f &newBounds)
 Create a new viewport which uses the specified 2D axis-aligned box to define its bounds. More...
 
Real getWidth () const
 Return the width of this viewport as a fraction of the framebuffer's width. More...
 
Real getHeight () const
 Return the height of this viewport as a fraction of the framebuffer's height. More...
 
Vector2f getSize () const
 Return the 2D size of this viewport as a fraction of the framebuffer's width and height. More...
 
Real getAspectRatio () const
 Return the aspect ratio of this viewport (width/height). More...
 
Vector2f getPosition () const
 Return the position of this viewport's lower left corner on the framebuffer. More...
 
 operator const AABB2f & () const
 Convert this viewport to a 2D axis-aligned bounding box representing the viewport's bounds. More...
 
const AABB2fgetBounds () const
 Return a 2D axis-aligned bounding box representing the bounds of this viewport. More...
 
void setBounds (const AABB2f &newBounds)
 Set a 2D axis-aligned bounding box representing the bounds of this viewport. More...
 
Bool operator== (const Viewport &other) const
 Return whether or not this viewport is exactly the same as another. More...
 
Bool operator!= (const Viewport &other) const
 Return whether or not this viewport is diferent than another. More...
 

Detailed Description

A class that represents a rectangular axis-aligned portion of the screen which should be rendered to.

During rendering, all output is rendered to only the area of the framebuffer specified by the current viewport, the rest is clipped to the outer edge of the viewport. This viewport is given in terms of a rectangular axis-aligned region where (0,0) is the lower left corner of the framebuffer, and (1,1) is the upper-right corner of the framebuffer.

Constructor & Destructor Documentation

om::graphics::base::Viewport::Viewport ( )
inline

Create a new viewport which covers the entire framebuffer.

om::graphics::base::Viewport::Viewport ( Float  width,
Float  height 
)
inline

Create a new viewport with the specified width and height with lower left corner at (0,0).

om::graphics::base::Viewport::Viewport ( Float  xMin,
Float  xMax,
Float  yMin,
Float  yMax 
)
inline

Create a new viewport which uses the area defined by the given min and max coordinates for each axis.

om::graphics::base::Viewport::Viewport ( const Vector2f min,
const Vector2f max 
)
inline

Create a new viewport which uses the specified minimum and maximum points to define its bounds.

om::graphics::base::Viewport::Viewport ( const AABB2f newBounds)
inline

Create a new viewport which uses the specified 2D axis-aligned box to define its bounds.

Member Function Documentation

Real om::graphics::base::Viewport::getWidth ( ) const
inline

Return the width of this viewport as a fraction of the framebuffer's width.

Real om::graphics::base::Viewport::getHeight ( ) const
inline

Return the height of this viewport as a fraction of the framebuffer's height.

Vector2f om::graphics::base::Viewport::getSize ( ) const
inline

Return the 2D size of this viewport as a fraction of the framebuffer's width and height.

Real om::graphics::base::Viewport::getAspectRatio ( ) const
inline

Return the aspect ratio of this viewport (width/height).

Vector2f om::graphics::base::Viewport::getPosition ( ) const
inline

Return the position of this viewport's lower left corner on the framebuffer.

om::graphics::base::Viewport::operator const AABB2f & ( ) const
inline

Convert this viewport to a 2D axis-aligned bounding box representing the viewport's bounds.

const AABB2f& om::graphics::base::Viewport::getBounds ( ) const
inline

Return a 2D axis-aligned bounding box representing the bounds of this viewport.

void om::graphics::base::Viewport::setBounds ( const AABB2f newBounds)
inline

Set a 2D axis-aligned bounding box representing the bounds of this viewport.

Bool om::graphics::base::Viewport::operator== ( const Viewport other) const
inline

Return whether or not this viewport is exactly the same as another.

Bool om::graphics::base::Viewport::operator!= ( const Viewport other) const
inline

Return whether or not this viewport is diferent than another.


The documentation for this class was generated from the following file: