Visualization Library 2.0.0
A lightweight C++ OpenGL middleware for 2D/3D graphics
|
[Download] [Tutorials] [All Classes] [Grouped Classes] |
Wraps a Renderer performing occlusion culling acceleration. More...
#include <OcclusionCullRenderer.hpp>
Public Member Functions | |
OcclusionCullRenderer () | |
Constructor. More... | |
virtual const RenderQueue * | render (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 Renderer * | wrappedRenderer () const |
The renderer to be wrapped by this occlusion culling renderer. More... | |
Renderer * | wrappedRenderer () |
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 Framebuffer * | framebuffer () const |
Returns the wrapped Renderer's Framebuffer. More... | |
Framebuffer * | framebuffer () |
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... | |
Shader * | occlusionShader () |
The Shader used to render the bounding boxes during the occlusion culling query. More... | |
const Shader * | occlusionShader () 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 RenderQueue * | renderRaw (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 ProjViewTransfCallback * | projViewTransfCallback () const |
ProjViewTransfCallback * | projViewTransfCallback () |
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 Framebuffer * | framebuffer () const |
The Framebuffer on which the rendering is performed. More... | |
Framebuffer * | framebuffer () |
The Framebuffer on which the rendering is performed. More... | |
Public Member Functions inherited from vl::RendererAbstract | |
RendererAbstract () | |
RendererAbstract & | operator= (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... | |
Object & | operator= (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... | |
IMutex * | refCountMutex () |
The mutex used to protect the reference counting of an Object across multiple threads. More... | |
const IMutex * | refCountMutex () 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< Renderer > | mWrappedRenderer |
ref< Shader > | mOcclusionShader |
ref< RenderQueue > | mCulledRenderQueue |
int | mOcclusionThreshold |
Renderer * | mPrevWrapRenderer |
int | mStatsTotalObjects |
int | mStatsOccludedObjects |
Protected Attributes inherited from vl::Renderer | |
ref< Framebuffer > | mFramebuffer |
vl::ref< EnableSet > | mDummyEnables |
vl::ref< RenderStateSet > | mDummyStateSet |
std::map< unsigned int, ref< Shader > > | mShaderOverrideMask |
std::vector< RenderStateSlot > | mOverriddenDefaultRenderStates |
ref< ProjViewTransfCallback > | mProjViewTransfCallback |
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 |
IMutex * | mRefCountMutex |
int | mReferenceCount |
bool | mAutomaticDelete |
Wraps a Renderer performing occlusion culling acceleration.
For more information see OpenGL-Accelerated Occlusion Culling Tutorial
Definition at line 44 of file OcclusionCullRenderer.hpp.
OcclusionCullRenderer::OcclusionCullRenderer | ( | ) |
Constructor.
Definition at line 41 of file OcclusionCullRenderer.cpp.
References vl::EN_CULL_FACE, vl::EN_DEPTH_TEST, vl::EN_POLYGON_OFFSET_FILL, vl::Shader::enable(), vl::FU_LEQUAL, vl::Shader::gocColorMask(), vl::Shader::gocDepthFunc(), vl::Shader::gocDepthMask(), vl::Shader::gocPolygonOffset(), mCulledRenderQueue, mOcclusionShader, mOcclusionThreshold, mPrevWrapRenderer, mStatsOccludedObjects, mStatsTotalObjects, NULL, vl::DepthFunc::set(), vl::DepthMask::set(), vl::PolygonOffset::set(), and vl::ColorMask::set().
|
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().
|
virtual |
Returns the wrapped Renderer's Framebuffer.
Implements vl::RendererAbstract.
Definition at line 141 of file OcclusionCullRenderer.cpp.
References mWrappedRenderer, and NULL.
|
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.
|
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.
|
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().
|
virtual |
Renders using the wrapped renderer but also performing occlusion culling.
Reimplemented from vl::Renderer.
Definition at line 68 of file OcclusionCullRenderer.cpp.
References vl::RendererAbstract::dispatchOnRendererFinished(), vl::RendererAbstract::dispatchOnRendererStarted(), vl::RendererAbstract::enableMask(), vl::Log::error(), vl::RendererAbstract::incrementRenderTick(), mCulledRenderQueue, mWrappedRenderer, render_pass1(), render_pass2(), VL_CHECK_OGL, and VL_TRAP.
|
protected |
Retrieves the occlusion culling query results from the previous rendering frame.
Definition at line 149 of file OcclusionCullRenderer.cpp.
References vl::RenderQueue::at(), vl::Log::error(), vl::Has_Occlusion_Query, vl::RenderToken::mActor, mCulledRenderQueue, mPrevWrapRenderer, mStatsOccludedObjects, mStatsTotalObjects, mWrappedRenderer, vl::Actor::occlusionQuery(), vl::Actor::occlusionQueryTick(), occlusionThreshold(), vl::RenderQueue::size(), VL_CHECK, and VL_CHECK_OGL.
Referenced by render().
|
protected |
Performs a new set of occlusion culling queries to be tested the next frame.
Definition at line 199 of file OcclusionCullRenderer.cpp.
References vl::OpenGLContext::applyEnables(), vl::OpenGLContext::applyRenderStates(), vl::RenderQueue::at(), vl::Renderable::boundingBox(), vl::Actor::boundingBox(), vl::Actor::createOcclusionQuery(), vl::Scissor::enable(), vl::RendererAbstract::enableMask(), framebuffer(), vl::Shader::getEnableSet(), vl::Shader::getRenderStateSet(), vl::Matrix4< T_Scalar >::getT(), vl::Shader::glslProgram(), vl::Has_Occlusion_Query, vl::Viewport::height(), vl::AABB::isInside(), vl::Actor::isOccludee(), vl::RenderToken::mActor, vl::AABB::maxCorner(), vl::Renderer::mDummyEnables, vl::Renderer::mDummyStateSet, vl::AABB::minCorner(), mOcclusionShader, vl::Camera::modelingMatrix(), vl::RenderToken::mRenderable, vl::RenderToken::mShader, mWrappedRenderer, NULL, vl::Actor::occlusionQuery(), vl::Framebuffer::openglContext(), vl::Renderer::projViewTransfCallback(), vl::OpenGLContext::resetEnables(), vl::OpenGLContext::resetRenderStates(), vl::Actor::scissor(), vl::Shader::scissor(), vl::Actor::setOcclusionQueryTick(), vl::RenderQueue::size(), vl::Actor::transform(), vl::ProjViewTransfCallback::updateMatrices(), vl::Camera::viewport(), VL_CHECK, VL_CHECK_OGL, vl::Viewport::width(), vl::Viewport::x(), vl::Vector3< T_Scalar >::x(), vl::Viewport::y(), vl::Vector3< T_Scalar >::y(), and vl::Vector3< T_Scalar >::z().
Referenced by render().
|
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.
|
inline |
The number of pixels visible for an actor to be considered occluded (default = 0)
Definition at line 65 of file OcclusionCullRenderer.hpp.
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.
|
inline |
Returns the number or objects not rendered due to the occlusion culling.
Definition at line 80 of file OcclusionCullRenderer.hpp.
|
inline |
Returns the total number or objects candidate for rendering before occlusion culling.
Definition at line 77 of file OcclusionCullRenderer.hpp.
|
inline |
The renderer to be wrapped by this occlusion culling renderer.
Definition at line 59 of file OcclusionCullRenderer.hpp.
|
inline |
The renderer to we wrapped by this occlusion culling renderer.
Definition at line 62 of file OcclusionCullRenderer.hpp.
|
protected |
Definition at line 107 of file OcclusionCullRenderer.hpp.
Referenced by OcclusionCullRenderer(), render(), and render_pass1().
Definition at line 106 of file OcclusionCullRenderer.hpp.
Referenced by OcclusionCullRenderer(), and render_pass2().
|
protected |
Definition at line 108 of file OcclusionCullRenderer.hpp.
Referenced by OcclusionCullRenderer().
|
protected |
Definition at line 109 of file OcclusionCullRenderer.hpp.
Referenced by OcclusionCullRenderer(), and render_pass1().
|
protected |
Definition at line 111 of file OcclusionCullRenderer.hpp.
Referenced by OcclusionCullRenderer(), and render_pass1().
|
protected |
Definition at line 110 of file OcclusionCullRenderer.hpp.
Referenced by OcclusionCullRenderer(), and render_pass1().
Definition at line 105 of file OcclusionCullRenderer.hpp.
Referenced by framebuffer(), render(), render_pass1(), render_pass2(), and setWrappedRenderer().
Visualization Library 2.0.0 Reference Documentation
Updated on Wed Dec 23 2020 12:44:10.
© Copyright Michele Bosi. All rights reserved.