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 Member Functions | Protected Attributes | List of all members
vl::Clear Class Reference

The Clear class is a Renderable used to clear the whole or a portion of the color, stencil or depth buffer. More...

#include <Clear.hpp>

+ Inheritance diagram for vl::Clear:

Public Member Functions

 Clear ()
 
virtual void render_Implementation (const Actor *, const Shader *, const Camera *, OpenGLContext *) const
 
void setClearColorBuffer (bool clear)
 
void setClearDepthBuffer (bool clear)
 
void setClearStencilBuffer (bool clear)
 
void setClearColorValue (const fvec4 &clear_val)
 
void setClearColorValueInt (const ivec4 &clear_val)
 
void setClearColorValueUInt (const uvec4 &clear_val)
 
void setClearDepthValue (float clear_val)
 
void setClearStencilValue (int clear_val)
 
void setClearColorMode (EClearColorMode mode)
 
EClearColorMode clearColorMode () const
 
void setScissorBox (int x, int y, int w, int h)
 Defines which portion of the rendering buffers should be cleared. More...
 
void getScissorBox (int &x, int &y, int &w, int &h)
 
virtual void updateDirtyBufferObject (EBufferObjectUpdateMode)
 Uploads the data stored in the local buffers on the GPU memory. More...
 
virtual void deleteBufferObject ()
 Destroys the BufferObject (vertex buffer objects) associated to this a Renderable. More...
 
- Public Member Functions inherited from vl::Renderable
 Renderable ()
 Constructor. More...
 
virtual ~Renderable ()
 Destructor. More...
 
void render (const Actor *actor, const Shader *shader, const Camera *camera, OpenGLContext *gl_context)
 Renders the Renderable and if necessary compiles the display list and updates the BufferObjects. More...
 
void computeBounds ()
 Recomputes the bounding box and bounding sphere of a Renderable. More...
 
long long boundsUpdateTick () const
 Returns the bounds-update-tick which is a counter incremented every time the bounding box or bounding sphere is updated. More...
 
void setBoundsDirty (bool dirty)
 Marks the bounding box and bounding sphere as dirty in order to be recomputed at the next rendering. More...
 
bool boundsDirty () const
 Returns whether the bounding sphere or bounding box are "dirty", that is, meant to be recomputed. More...
 
void setBoundingBox (const AABB &aabb)
 Sets the bounding box of a Renderable. More...
 
void setBoundingSphere (const Sphere &sphere)
 Sets the bounding sphere of a Renderable. More...
 
const AABBboundingBox () const
 Returns the bounding box of a Renderable without recomputing the bounds if dirty. More...
 
const SphereboundingSphere () const
 Returns the bounding sphere of a Renderable without recomputing the bounds if dirty. More...
 
const AABBboundingBox ()
 Returns the bounding box of a Renderable recomputing the bounds if dirty. More...
 
const SphereboundingSphere ()
 Returns the bounding sphere of a Renderable recomputing the bounds if dirty. More...
 
unsigned int displayList () const
 Returns the display list associated to a Renderable or 0 (zero) if no display list is associated. More...
 
void setDisplayList (unsigned int disp_list)
 Manually assciates a display list to a Renderable (to be used with care). More...
 
bool isDisplayListEnabled () const
 Returns true if display lists are enabled for a Renderable (disabled by default). More...
 
void setDisplayListEnabled (bool enabled)
 Enable/disable display lists (disabled by default). More...
 
bool displayListDirty () const
 Whether the display list associated to a Renderable should be recompiled at the next rendering. More...
 
void setDisplayListDirty (bool dirty)
 Whether the display list associated to a Renderable should be recompiled at the next rendering. More...
 
bool isBufferObjectEnabled () const
 Returns true if BufferObject (vertex buffer object) are enabled for a Renderable (enabled by default). More...
 
void setBufferObjectEnabled (bool enabled)
 Enable/disable BufferObject (vertex buffer object) (enabled by default). More...
 
bool isBufferObjectDirty () const
 Whether BufferObjects associated to a Renderable should be recomputed on the next rendering. More...
 
void setBufferObjectDirty (bool dirty=true)
 Whether BufferObjects associated to a Renderable should be recomputed on the next rendering. More...
 
void deleteDisplayList ()
 Deletes the display list currently associated to a Renderable. More...
 
- 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 Member Functions

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

Protected Attributes

fvec4 mClearColorValue
 
ivec4 mClearColorValueInt
 
uvec4 mClearColorValueUInt
 
int mScissorBox [4]
 
EClearColorMode mClearColorMode
 
float mClearDepthValue
 
int mClearStencilValue
 
bool mClearColorBuffer
 
bool mClearDepthBuffer
 
bool mClearStencilBuffer
 
- Protected Attributes inherited from vl::Object
std::string mObjectName
 
IMutexmRefCountMutex
 
int mReferenceCount
 
bool mAutomaticDelete
 

Detailed Description

The Clear class is a Renderable used to clear the whole or a portion of the color, stencil or depth buffer.

The Clear class is a special Renderable that wraps the functionalities of the following OpenGL functions:

Usually the color, depth and stencil buffers are cleared at the beginning of a rendering when the Viewport is initialized. To handle less common cases the Clear class allows you to perform a clear operation also in the middle of a rendering. Just bind it to an an Actor and setup the appropriate clearing options.

Note

Definition at line 69 of file Clear.hpp.

Constructor & Destructor Documentation

◆ Clear()

Clear::Clear ( )

Definition at line 40 of file Clear.cpp.

References mScissorBox.

Member Function Documentation

◆ clearColorMode()

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

Definition at line 96 of file Clear.hpp.

Referenced by render_Implementation().

◆ computeBounds_Implementation()

virtual void vl::Clear::computeBounds_Implementation ( )
inlineprotectedvirtual

Implements vl::Renderable.

Definition at line 113 of file Clear.hpp.

◆ deleteBufferObject()

virtual void vl::Clear::deleteBufferObject ( )
inlinevirtual

Destroys the BufferObject (vertex buffer objects) associated to this a Renderable.

Note
This function does not touch the local (non GPU) data stored in the buffers associated to the vertex attributes and DrawCall.

Implements vl::Renderable.

Definition at line 110 of file Clear.hpp.

◆ getScissorBox()

void vl::Clear::getScissorBox ( int &  x,
int &  y,
int &  w,
int &  h 
)
inline

Definition at line 104 of file Clear.hpp.

◆ render_Implementation()

void Clear::render_Implementation ( const Actor ,
const Shader ,
const Camera camera,
OpenGLContext  
) const
virtual

◆ setClearColorBuffer()

void vl::Clear::setClearColorBuffer ( bool  clear)
inline

Definition at line 78 of file Clear.hpp.

Referenced by vl::VectorGraphics::clearColor().

◆ setClearColorMode()

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

Definition at line 94 of file Clear.hpp.

◆ setClearColorValue()

void vl::Clear::setClearColorValue ( const fvec4 clear_val)
inline

Definition at line 84 of file Clear.hpp.

Referenced by vl::VectorGraphics::clearColor().

◆ setClearColorValueInt()

void vl::Clear::setClearColorValueInt ( const ivec4 clear_val)
inline

Definition at line 86 of file Clear.hpp.

◆ setClearColorValueUInt()

void vl::Clear::setClearColorValueUInt ( const uvec4 clear_val)
inline

Definition at line 88 of file Clear.hpp.

◆ setClearDepthBuffer()

void vl::Clear::setClearDepthBuffer ( bool  clear)
inline

Definition at line 80 of file Clear.hpp.

◆ setClearDepthValue()

void vl::Clear::setClearDepthValue ( float  clear_val)
inline

Definition at line 90 of file Clear.hpp.

◆ setClearStencilBuffer()

void vl::Clear::setClearStencilBuffer ( bool  clear)
inline

Definition at line 82 of file Clear.hpp.

Referenced by vl::VectorGraphics::clearStencil().

◆ setClearStencilValue()

void vl::Clear::setClearStencilValue ( int  clear_val)
inline

Definition at line 92 of file Clear.hpp.

Referenced by vl::VectorGraphics::clearStencil().

◆ setScissorBox()

void vl::Clear::setScissorBox ( int  x,
int  y,
int  w,
int  h 
)
inline

Defines which portion of the rendering buffers should be cleared.

The parameters 'x', 'y', 'z', 'w' specify a rectangular area in viewport coordinates. Such area is also clipped against the viewport borders. If 'w' or 'h' are set to -1 then the whole viewport is cleared.

Definition at line 102 of file Clear.hpp.

Referenced by vl::VectorGraphics::clearColor(), and vl::VectorGraphics::clearStencil().

◆ updateDirtyBufferObject()

virtual void vl::Clear::updateDirtyBufferObject ( EBufferObjectUpdateMode  )
inlinevirtual

Uploads the data stored in the local buffers on the GPU memory.

If 'discard_local_data' is set to true the memory used by the local buffers is released.

Implements vl::Renderable.

Definition at line 108 of file Clear.hpp.

Member Data Documentation

◆ mClearColorBuffer

bool vl::Clear::mClearColorBuffer
protected

Definition at line 123 of file Clear.hpp.

Referenced by render_Implementation().

◆ mClearColorMode

EClearColorMode vl::Clear::mClearColorMode
protected

Definition at line 120 of file Clear.hpp.

◆ mClearColorValue

fvec4 vl::Clear::mClearColorValue
protected

Definition at line 116 of file Clear.hpp.

Referenced by render_Implementation().

◆ mClearColorValueInt

ivec4 vl::Clear::mClearColorValueInt
protected

Definition at line 117 of file Clear.hpp.

Referenced by render_Implementation().

◆ mClearColorValueUInt

uvec4 vl::Clear::mClearColorValueUInt
protected

Definition at line 118 of file Clear.hpp.

Referenced by render_Implementation().

◆ mClearDepthBuffer

bool vl::Clear::mClearDepthBuffer
protected

Definition at line 124 of file Clear.hpp.

Referenced by render_Implementation().

◆ mClearDepthValue

float vl::Clear::mClearDepthValue
protected

Definition at line 121 of file Clear.hpp.

Referenced by render_Implementation().

◆ mClearStencilBuffer

bool vl::Clear::mClearStencilBuffer
protected

Definition at line 125 of file Clear.hpp.

Referenced by render_Implementation().

◆ mClearStencilValue

int vl::Clear::mClearStencilValue
protected

Definition at line 122 of file Clear.hpp.

Referenced by render_Implementation().

◆ mScissorBox

int vl::Clear::mScissorBox[4]
protected

Definition at line 119 of file Clear.hpp.

Referenced by Clear(), and render_Implementation().


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