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::OcclusionCullRenderer Class Reference

Wraps a Renderer performing occlusion culling acceleration. More...

#include <OcclusionCullRenderer.hpp>

+ Inheritance diagram for vl::OcclusionCullRenderer:

Public Member Functions

 OcclusionCullRenderer ()
 Constructor. More...
 
virtual const RenderQueuerender (const RenderQueue *in_render_queue, Camera *camera, real frame_clock)
 Renders using the wrapped renderer but also performing occlusion culling. More...
 
void setWrappedRenderer (Renderer *renderer)
 The renderer to be wrapped by this occlusion culling renderer. More...
 
const RendererwrappedRenderer () const
 The renderer to be wrapped by this occlusion culling renderer. More...
 
RendererwrappedRenderer ()
 The renderer to we wrapped by this occlusion culling renderer. More...
 
void setOcclusionThreshold (int threshold)
 The number of pixels visible for an actor to be considered occluded (default = 0) More...
 
int occlusionThreshold () const
 The number of pixels visible for an actor to be considered occluded (default = 0) More...
 
const Framebufferframebuffer () const
 Returns the wrapped Renderer's Framebuffer. More...
 
Framebufferframebuffer ()
 Returns the wrapped Renderer's Framebuffer. More...
 
int statsTotalObjects () const
 Returns the total number or objects candidate for rendering before occlusion culling. More...
 
int statsOccludedObjects () const
 Returns the number or objects not rendered due to the occlusion culling. More...
 
ShaderocclusionShader ()
 The Shader used to render the bounding boxes during the occlusion culling query. More...
 
const ShaderocclusionShader () const
 The Shader used to render the bounding boxes during the occlusion culling query. More...
 
void setOcclusionShader (Shader *occ_sh)
 The Shader used to render the bounding boxes during the occlusion culling query. More...
 
- Public Member Functions inherited from vl::Renderer
 Renderer ()
 
virtual ~Renderer ()
 
const RenderQueuerenderRaw (const RenderQueue *in_render_queue, Camera *camera, real frame_clock)
 Used by render() to loop through the render queue. More...
 
void setProjViewTransfCallback (ProjViewTransfCallback *callback)
 
const ProjViewTransfCallbackprojViewTransfCallback () const
 
ProjViewTransfCallbackprojViewTransfCallback ()
 
const std::map< unsigned int, ref< Shader > > & shaderOverrideMask () const
 A bitmask/Shader map used to everride the Shader of those Actors whose enable mask satisfy the following condition: (Actors::enableMask() & bitmask) != 0. More...
 
std::map< unsigned int, ref< Shader > > & shaderOverrideMask ()
 A bitmask/Shader map used to everride the Shader of those Actors whose enable mask satisfy the following condition: (Actors::enableMask() & bitmask) != 0. More...
 
std::vector< RenderStateSlot > & overriddenDefaultRenderStates ()
 Render states that will be used as default by the opengl context by this renderer. More...
 
const std::vector< RenderStateSlot > & overriddenDefaultRenderStates () const
 Render states that will be used as default by the opengl context by this renderer. More...
 
bool isEnabled (unsigned int mask)
 
bool isEnabled (const Actor *actor)
 
void setFramebuffer (Framebuffer *framebuffer)
 The Framebuffer on which the rendering is performed. More...
 
const Framebufferframebuffer () const
 The Framebuffer on which the rendering is performed. More...
 
Framebufferframebuffer ()
 The Framebuffer on which the rendering is performed. More...
 
- Public Member Functions inherited from vl::RendererAbstract
 RendererAbstract ()
 
RendererAbstractoperator= (const RendererAbstract &other)
 
void dispatchOnRendererStarted ()
 Dispatches the onRendererStarted() event to the registered RenderEventCallback objects. More...
 
void dispatchOnRendererFinished ()
 Dispatches the onRendererFinished() event to the registered RenderEventCallback objects. More...
 
Collection< RenderEventCallback > * onFinishedCallbacks ()
 Returns the list of RenderEventCallback objects registered to onRendererFinished() event notification. More...
 
const Collection< RenderEventCallback > * onFinishedCallbacks () const
 Returns the list of RenderEventCallback objects registered to onRendererFinished() event notification. More...
 
Collection< RenderEventCallback > * onStartedCallbacks ()
 Returns the list of RenderEventCallback objects registered to onRendererStarted() event notification. More...
 
const Collection< RenderEventCallback > * onStartedCallbacks () const
 Returns the list of RenderEventCallback objects registered to onRendererStarted() event notification. More...
 
unsigned long renderTick () const
 The current render tick number, equivalent to the number or calls made to the render() method. More...
 
void incrementRenderTick ()
 Increments the rendering tick count. More...
 
void setClearFlags (EClearFlags clear_flags)
 The clear flags used to clear the viewport. More...
 
EClearFlags clearFlags () const
 The clear flags used to clear the viewport. More...
 
void setEnableMask (unsigned int mask)
 Enable mask used to enable/disable the rendering of matching Actors. More...
 
unsigned int enableMask () const
 Enable mask used to enable/disable the rendering of matching Actors. More...
 
void setFrameClock (real t)
 The current rendring frame time. More...
 
real frameClock () const
 The current rendring frame time. 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

void render_pass1 (const RenderQueue *in_render_queue)
 Retrieves the occlusion culling query results from the previous rendering frame. More...
 
void render_pass2 (const RenderQueue *in_render_queue, Camera *camera)
 Performs a new set of occlusion culling queries to be tested the next frame. More...
 
- Protected Member Functions inherited from vl::Object
virtual ~Object ()
 

Protected Attributes

vl::ref< RenderermWrappedRenderer
 
ref< ShadermOcclusionShader
 
ref< RenderQueuemCulledRenderQueue
 
int mOcclusionThreshold
 
RenderermPrevWrapRenderer
 
int mStatsTotalObjects
 
int mStatsOccludedObjects
 
- Protected Attributes inherited from vl::Renderer
ref< FramebuffermFramebuffer
 
vl::ref< EnableSetmDummyEnables
 
vl::ref< RenderStateSetmDummyStateSet
 
std::map< unsigned int, ref< Shader > > mShaderOverrideMask
 
std::vector< RenderStateSlotmOverriddenDefaultRenderStates
 
ref< ProjViewTransfCallbackmProjViewTransfCallback
 
- Protected Attributes inherited from vl::RendererAbstract
ref< Collection< RenderEventCallback > > mOnFinishedCallbacks
 
ref< Collection< RenderEventCallback > > mOnStartedCallbacks
 
unsigned long mRenderTick
 
unsigned int mEnableMask
 
EClearFlags mClearFlags
 
real mFrameClock
 
- Protected Attributes inherited from vl::Object
std::string mObjectName
 
IMutexmRefCountMutex
 
int mReferenceCount
 
bool mAutomaticDelete
 

Detailed Description

Wraps a Renderer performing occlusion culling acceleration.

For more information see OpenGL-Accelerated Occlusion Culling Tutorial

Definition at line 44 of file OcclusionCullRenderer.hpp.

Constructor & Destructor Documentation

◆ OcclusionCullRenderer()

OcclusionCullRenderer::OcclusionCullRenderer ( )

Member Function Documentation

◆ framebuffer() [1/2]

const Framebuffer * OcclusionCullRenderer::framebuffer ( ) const
virtual

Returns the wrapped Renderer's Framebuffer.

Implements vl::RendererAbstract.

Definition at line 133 of file OcclusionCullRenderer.cpp.

References mWrappedRenderer, and NULL.

Referenced by render_pass2().

◆ framebuffer() [2/2]

Framebuffer * OcclusionCullRenderer::framebuffer ( )
virtual

Returns the wrapped Renderer's Framebuffer.

Implements vl::RendererAbstract.

Definition at line 141 of file OcclusionCullRenderer.cpp.

References mWrappedRenderer, and NULL.

◆ occlusionShader() [1/2]

Shader* vl::OcclusionCullRenderer::occlusionShader ( )
inline

The Shader used to render the bounding boxes during the occlusion culling query.

For example if you have problems with the zbuffer percision you can access the Shader to modify the polygon offset settings.

Definition at line 85 of file OcclusionCullRenderer.hpp.

◆ occlusionShader() [2/2]

const Shader* vl::OcclusionCullRenderer::occlusionShader ( ) const
inline

The Shader used to render the bounding boxes during the occlusion culling query.

For example if you have problems with the zbuffer percision you can access the Shader to modify the polygon offset settings.

Definition at line 90 of file OcclusionCullRenderer.hpp.

◆ occlusionThreshold()

int vl::OcclusionCullRenderer::occlusionThreshold ( ) const
inline

The number of pixels visible for an actor to be considered occluded (default = 0)

Definition at line 68 of file OcclusionCullRenderer.hpp.

Referenced by render_pass1().

◆ render()

const RenderQueue * OcclusionCullRenderer::render ( const RenderQueue in_render_queue,
Camera camera,
real  frame_clock 
)
virtual

◆ render_pass1()

void OcclusionCullRenderer::render_pass1 ( const RenderQueue in_render_queue)
protected

◆ render_pass2()

void OcclusionCullRenderer::render_pass2 ( const RenderQueue in_render_queue,
Camera camera 
)
protected

◆ setOcclusionShader()

void vl::OcclusionCullRenderer::setOcclusionShader ( Shader occ_sh)
inline

The Shader used to render the bounding boxes during the occlusion culling query.

For example if you have problems with the zbuffer percision you can access the Shader to modify the polygon offset settings.

Definition at line 95 of file OcclusionCullRenderer.hpp.

◆ setOcclusionThreshold()

void vl::OcclusionCullRenderer::setOcclusionThreshold ( int  threshold)
inline

The number of pixels visible for an actor to be considered occluded (default = 0)

Definition at line 65 of file OcclusionCullRenderer.hpp.

◆ setWrappedRenderer()

void OcclusionCullRenderer::setWrappedRenderer ( Renderer renderer)

The renderer to be wrapped by this occlusion culling renderer.

Definition at line 128 of file OcclusionCullRenderer.cpp.

References mWrappedRenderer.

◆ statsOccludedObjects()

int vl::OcclusionCullRenderer::statsOccludedObjects ( ) const
inline

Returns the number or objects not rendered due to the occlusion culling.

Definition at line 80 of file OcclusionCullRenderer.hpp.

◆ statsTotalObjects()

int vl::OcclusionCullRenderer::statsTotalObjects ( ) const
inline

Returns the total number or objects candidate for rendering before occlusion culling.

Definition at line 77 of file OcclusionCullRenderer.hpp.

◆ wrappedRenderer() [1/2]

const Renderer* vl::OcclusionCullRenderer::wrappedRenderer ( ) const
inline

The renderer to be wrapped by this occlusion culling renderer.

Definition at line 59 of file OcclusionCullRenderer.hpp.

◆ wrappedRenderer() [2/2]

Renderer* vl::OcclusionCullRenderer::wrappedRenderer ( )
inline

The renderer to we wrapped by this occlusion culling renderer.

Definition at line 62 of file OcclusionCullRenderer.hpp.

Member Data Documentation

◆ mCulledRenderQueue

ref<RenderQueue> vl::OcclusionCullRenderer::mCulledRenderQueue
protected

Definition at line 107 of file OcclusionCullRenderer.hpp.

Referenced by OcclusionCullRenderer(), render(), and render_pass1().

◆ mOcclusionShader

ref<Shader> vl::OcclusionCullRenderer::mOcclusionShader
protected

Definition at line 106 of file OcclusionCullRenderer.hpp.

Referenced by OcclusionCullRenderer(), and render_pass2().

◆ mOcclusionThreshold

int vl::OcclusionCullRenderer::mOcclusionThreshold
protected

Definition at line 108 of file OcclusionCullRenderer.hpp.

Referenced by OcclusionCullRenderer().

◆ mPrevWrapRenderer

Renderer* vl::OcclusionCullRenderer::mPrevWrapRenderer
protected

Definition at line 109 of file OcclusionCullRenderer.hpp.

Referenced by OcclusionCullRenderer(), and render_pass1().

◆ mStatsOccludedObjects

int vl::OcclusionCullRenderer::mStatsOccludedObjects
protected

Definition at line 111 of file OcclusionCullRenderer.hpp.

Referenced by OcclusionCullRenderer(), and render_pass1().

◆ mStatsTotalObjects

int vl::OcclusionCullRenderer::mStatsTotalObjects
protected

Definition at line 110 of file OcclusionCullRenderer.hpp.

Referenced by OcclusionCullRenderer(), and render_pass1().

◆ mWrappedRenderer

vl::ref<Renderer> vl::OcclusionCullRenderer::mWrappedRenderer
protected

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