Visualization Library 2.0.0

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Public Member Functions | Protected Attributes | List of all members
vl::Viewport Class Reference

Implements the viewport and clearing settings associated to a Camera. More...

#include <Viewport.hpp>

+ Inheritance diagram for vl::Viewport:

Public Member Functions

 Viewport ()
 
 Viewport (int x, int y, int w, int h)
 
void activate () const
 
bool null ()
 
void set (int x, int y, int w, int h)
 
void setX (int x)
 
int x () const
 
void setY (int y)
 
int y () const
 
void setWidth (int width)
 
int width () const
 
void setHeight (int height)
 
int height () const
 
fvec2 center () const
 
RectI rect () const
 Returns the rectangular area that defines the viewport computed as RectI(x(), y(), x()+width()-1, y()+height()-1). More...
 
void setClearColor (float r, float g, float b, float a)
 
void setClearColor (const fvec4 &color)
 
const fvec4clearColor () const
 
void setClearColorInt (int r, int g, int b, int a)
 
void setClearColorInt (const ivec4 &color)
 
const ivec4clearColorInt () const
 
void setClearColorUInt (unsigned int r, unsigned int g, unsigned int b, unsigned int a)
 
void setClearColorUInt (const uvec4 &color)
 
const uvec4clearColorUInt () const
 
void setClearStencil (int stencil)
 
int clearStencil () const
 
void setClearDepth (real depth)
 
real clearDepth () const
 
void setClearFlags (EClearFlags clear_flags)
 Usually you want to use rather RendererAbstract::setClearFlags() More...
 
EClearFlags clearFlags () const
 
void setClearColorMode (EClearColorMode mode)
 
EClearColorMode clearColorMode () const
 
bool isPointInside (int x, int y, int framebuffer_height) const
 Returns true if the given point is inside the Viewport. More...
 
void setScissorEnabled (bool enable)
 If scissor setup is enabled (by default it is), then glScissor is called during activate(). More...
 
bool isScissorEnabled () const
 
- Public Member Functions inherited from vl::Object
 Object ()
 Constructor. More...
 
 Object (const Object &other)
 Copy constructor: copies the name, ref count mutex and user data. More...
 
Objectoperator= (const Object &other)
 Copy operator: copies the object's name, ref count mutex and user data. More...
 
const std::string & objectName () const
 The name of the object, by default set to the object's class name. More...
 
void setObjectName (const char *name)
 The name of the object, by default set to the object's class name in debug builds. More...
 
void setObjectName (const std::string &name)
 The name of the object, by default set to the object's class name in debug builds. More...
 
void setRefCountMutex (IMutex *mutex)
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
IMutexrefCountMutex ()
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
const IMutexrefCountMutex () const
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
int referenceCount () const
 Returns the number of references of an object. More...
 
void incReference () const
 Increments the reference count of an object. More...
 
void decReference ()
 Decrements the reference count of an object and deletes it if both automaticDelete() is true the count reaches 0. More...
 
void setAutomaticDelete (bool autodel_on)
 If set to true the Object is deleted when its reference count reaches 0. More...
 
bool automaticDelete () const
 If set to true the Object is deleted when its reference count reaches 0. More...
 
template<class T >
T * as ()
 Casts an Object to the specified class. More...
 
template<class T >
const T * as () const
 Casts an Object to the specified class. More...
 

Protected Attributes

fvec4 mClearColor
 
ivec4 mClearColorInt
 
uvec4 mClearColorUInt
 
real mClearDepth
 
int mClearStencil
 
EClearFlags mClearFlags
 
EClearColorMode mClearColorMode
 
int mX
 
int mY
 
int mWidth
 
int mHeight
 
bool mScissorEnabled
 
- Protected Attributes inherited from vl::Object
std::string mObjectName
 
IMutexmRefCountMutex
 
int mReferenceCount
 
bool mAutomaticDelete
 

Additional Inherited Members

- Protected Member Functions inherited from vl::Object
virtual ~Object ()
 

Detailed Description

Implements the viewport and clearing settings associated to a Camera.

Supports glClearColor, glClearColorIiEXT and glClearColorIuiEXT (see GL_EXT_texture_integer).

See also
Camera, Rendering, Renderer

Definition at line 51 of file Viewport.hpp.

Constructor & Destructor Documentation

◆ Viewport() [1/2]

Viewport::Viewport ( )

◆ Viewport() [2/2]

Viewport::Viewport ( int  x,
int  y,
int  w,
int  h 
)

Member Function Documentation

◆ activate()

void Viewport::activate ( ) const

◆ center()

fvec2 vl::Viewport::center ( ) const
inline

◆ clearColor()

const fvec4& vl::Viewport::clearColor ( ) const
inline

Definition at line 81 of file Viewport.hpp.

Referenced by vlX::VLXClassWrapper_Viewport::exportViewport().

◆ clearColorInt()

const ivec4& vl::Viewport::clearColorInt ( ) const
inline

Definition at line 85 of file Viewport.hpp.

Referenced by vlX::VLXClassWrapper_Viewport::exportViewport().

◆ clearColorMode()

EClearColorMode vl::Viewport::clearColorMode ( ) const
inline

Definition at line 102 of file Viewport.hpp.

Referenced by activate(), and vlX::VLXClassWrapper_Viewport::exportViewport().

◆ clearColorUInt()

const uvec4& vl::Viewport::clearColorUInt ( ) const
inline

Definition at line 89 of file Viewport.hpp.

Referenced by vlX::VLXClassWrapper_Viewport::exportViewport().

◆ clearDepth()

real vl::Viewport::clearDepth ( ) const
inline

Definition at line 95 of file Viewport.hpp.

Referenced by vlX::VLXClassWrapper_Viewport::exportViewport().

◆ clearFlags()

EClearFlags vl::Viewport::clearFlags ( ) const
inline

Definition at line 99 of file Viewport.hpp.

Referenced by vlX::VLXClassWrapper_Viewport::exportViewport().

◆ clearStencil()

int vl::Viewport::clearStencil ( ) const
inline

Definition at line 92 of file Viewport.hpp.

Referenced by vlX::VLXClassWrapper_Viewport::exportViewport().

◆ height()

int vl::Viewport::height ( ) const
inline

◆ isPointInside()

bool Viewport::isPointInside ( int  x,
int  y,
int  framebuffer_height 
) const

Returns true if the given point is inside the Viewport.

Definition at line 152 of file Viewport.cpp.

References height(), width(), x(), and y().

◆ isScissorEnabled()

bool vl::Viewport::isScissorEnabled ( ) const
inline

Definition at line 114 of file Viewport.hpp.

◆ null()

bool vl::Viewport::null ( )
inline

Definition at line 61 of file Viewport.hpp.

◆ rect()

RectI vl::Viewport::rect ( ) const
inline

Returns the rectangular area that defines the viewport computed as RectI(x(), y(), x()+width()-1, y()+height()-1).

Definition at line 77 of file Viewport.hpp.

Referenced by vl::Scissor::enable().

◆ set()

void vl::Viewport::set ( int  x,
int  y,
int  w,
int  h 
)
inline

◆ setClearColor() [1/2]

void vl::Viewport::setClearColor ( float  r,
float  g,
float  b,
float  a 
)
inline

Definition at line 79 of file Viewport.hpp.

Referenced by vlX::VLXClassWrapper_Viewport::importViewport().

◆ setClearColor() [2/2]

void vl::Viewport::setClearColor ( const fvec4 color)
inline

Definition at line 80 of file Viewport.hpp.

◆ setClearColorInt() [1/2]

void vl::Viewport::setClearColorInt ( int  r,
int  g,
int  b,
int  a 
)
inline

Definition at line 83 of file Viewport.hpp.

Referenced by vlX::VLXClassWrapper_Viewport::importViewport().

◆ setClearColorInt() [2/2]

void vl::Viewport::setClearColorInt ( const ivec4 color)
inline

Definition at line 84 of file Viewport.hpp.

◆ setClearColorMode()

void vl::Viewport::setClearColorMode ( EClearColorMode  mode)
inline

Definition at line 101 of file Viewport.hpp.

Referenced by vlX::VLXClassWrapper_Viewport::importViewport().

◆ setClearColorUInt() [1/2]

void vl::Viewport::setClearColorUInt ( unsigned int  r,
unsigned int  g,
unsigned int  b,
unsigned int  a 
)
inline

Definition at line 87 of file Viewport.hpp.

Referenced by vlX::VLXClassWrapper_Viewport::importViewport().

◆ setClearColorUInt() [2/2]

void vl::Viewport::setClearColorUInt ( const uvec4 color)
inline

Definition at line 88 of file Viewport.hpp.

◆ setClearDepth()

void vl::Viewport::setClearDepth ( real  depth)
inline

Definition at line 94 of file Viewport.hpp.

Referenced by vlX::VLXClassWrapper_Viewport::importViewport().

◆ setClearFlags()

void vl::Viewport::setClearFlags ( EClearFlags  clear_flags)
inline

◆ setClearStencil()

void vl::Viewport::setClearStencil ( int  stencil)
inline

Definition at line 91 of file Viewport.hpp.

Referenced by vlX::VLXClassWrapper_Viewport::importViewport().

◆ setHeight()

void vl::Viewport::setHeight ( int  height)
inline

Definition at line 70 of file Viewport.hpp.

Referenced by vlX::VLXClassWrapper_Viewport::importViewport().

◆ setScissorEnabled()

void vl::Viewport::setScissorEnabled ( bool  enable)
inline

If scissor setup is enabled (by default it is), then glScissor is called during activate().

Definition at line 113 of file Viewport.hpp.

◆ setWidth()

void vl::Viewport::setWidth ( int  width)
inline

Definition at line 68 of file Viewport.hpp.

Referenced by vlX::VLXClassWrapper_Viewport::importViewport().

◆ setX()

void vl::Viewport::setX ( int  x)
inline

Definition at line 64 of file Viewport.hpp.

Referenced by vlX::VLXClassWrapper_Viewport::importViewport().

◆ setY()

void vl::Viewport::setY ( int  y)
inline

Definition at line 66 of file Viewport.hpp.

Referenced by vlX::VLXClassWrapper_Viewport::importViewport().

◆ width()

int vl::Viewport::width ( ) const
inline

◆ x()

int vl::Viewport::x ( ) const
inline

◆ y()

int vl::Viewport::y ( ) const
inline

Member Data Documentation

◆ mClearColor

fvec4 vl::Viewport::mClearColor
protected

Definition at line 117 of file Viewport.hpp.

Referenced by activate(), and Viewport().

◆ mClearColorInt

ivec4 vl::Viewport::mClearColorInt
protected

Definition at line 118 of file Viewport.hpp.

Referenced by activate().

◆ mClearColorMode

EClearColorMode vl::Viewport::mClearColorMode
protected

Definition at line 124 of file Viewport.hpp.

Referenced by Viewport().

◆ mClearColorUInt

uvec4 vl::Viewport::mClearColorUInt
protected

Definition at line 119 of file Viewport.hpp.

Referenced by activate().

◆ mClearDepth

real vl::Viewport::mClearDepth
protected

Definition at line 121 of file Viewport.hpp.

Referenced by activate(), and Viewport().

◆ mClearFlags

EClearFlags vl::Viewport::mClearFlags
protected

Definition at line 123 of file Viewport.hpp.

Referenced by activate(), and Viewport().

◆ mClearStencil

int vl::Viewport::mClearStencil
protected

Definition at line 122 of file Viewport.hpp.

Referenced by activate(), and Viewport().

◆ mHeight

int vl::Viewport::mHeight
protected

Definition at line 128 of file Viewport.hpp.

Referenced by activate(), and Viewport().

◆ mScissorEnabled

bool vl::Viewport::mScissorEnabled
protected

Definition at line 130 of file Viewport.hpp.

Referenced by activate(), and Viewport().

◆ mWidth

int vl::Viewport::mWidth
protected

Definition at line 127 of file Viewport.hpp.

Referenced by activate(), and Viewport().

◆ mX

int vl::Viewport::mX
protected

Definition at line 125 of file Viewport.hpp.

Referenced by activate(), and Viewport().

◆ mY

int vl::Viewport::mY
protected

Definition at line 126 of file Viewport.hpp.

Referenced by activate(), and Viewport().


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