# Visualization Library

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

[Home] [Tutorials] [All Classes] [Grouped Classes]

Public Member Functions | Protected Member Functions | Protected Attributes

# vl::OcclusionCullRenderer Class Reference

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

`#include <OcclusionCullRenderer.hpp>`

Inheritance diagram for vl::OcclusionCullRenderer:

List of all members.

## Public Member Functions

| OcclusionCullRenderer ()
| Constructor.
virtual const RenderQueue * | render (const RenderQueue *in_render_queue, Camera *camera, real frame_clock)
| Renders using the wrapped renderer but also performing occlusion culling.
void | setWrappedRenderer (Renderer *renderer)
| The renderer to be wrapped by this occlusion culling renderer.
const Renderer * | wrappedRenderer () const
| The renderer to be wrapped by this occlusion culling renderer.
Renderer * | wrappedRenderer ()
| The renderer to we wrapped by this occlusion culling renderer.
void | setOcclusionThreshold (int threshold)
| The number of pixels visible for an actor to be considered occluded (default = 0)
int | occlusionThreshold () const
| The number of pixels visible for an actor to be considered occluded (default = 0)
const Framebuffer * | framebuffer () const
| Returns the wrapped Renderer's Framebuffer.
Framebuffer * | framebuffer ()
| Returns the wrapped Renderer's Framebuffer.
int | statsTotalObjects () const
| Returns the total number or objects candidate for rendering before occlusion culling.
int | statsOccludedObjects () const
| Returns the number or objects not rendered due to the occlusion culling.
Shader * | occlusionShader ()
| The Shader used to render the bounding boxes during the occlusion culling query.
const Shader * | occlusionShader () const
| The Shader used to render the bounding boxes during the occlusion culling query.
void | setOcclusionShader (Shader *occ_sh)
| The Shader used to render the bounding boxes during the occlusion culling query.

## Protected Member Functions

void | render_pass1 (const RenderQueue *in_render_queue)
| Retrieves the occlusion culling query results from the previous rendering frame.
void | render_pass2 (const RenderQueue *in_render_queue, Camera *camera)
| Performs a new set of occlusion culling queries to be tested the next frame.

## Protected Attributes

vl::ref< Renderer > | mWrappedRenderer
ref< Shader > | mOcclusionShader
ref< RenderQueue > | mCulledRenderQueue
int | mOcclusionThreshold
Renderer * | mPrevWrapRenderer
int | mStatsTotalObjects
int | mStatsOccludedObjects

## 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 | ( | ) |

Constructor.

Definition at line 41 of file OcclusionCullRenderer.cpp.

References vl::EN_CULL_FACE, vl::EN_DEPTH_TEST, vl::EN_POLYGON_OFFSET_FILL, vl::FU_LEQUAL, mCulledRenderQueue, mOcclusionShader, mOcclusionThreshold, mPrevWrapRenderer, mStatsOccludedObjects, mStatsTotalObjects, NULL, and VL_DEBUG_SET_OBJECT_NAME.

## Member Function Documentation

const RenderQueue * OcclusionCullRenderer::render | ( | const RenderQueue * | in_render_queue,
|  | Camera * | camera,
|  | real | frame_clock
| ) |  | `[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::enableMask(), vl::Log::error(), vl::ref< T >::get(), mCulledRenderQueue, mWrappedRenderer, render_pass1(), render_pass2(), VL_CHECK_OGL, and VL_TRAP.

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.

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.

Renderer* vl::OcclusionCullRenderer::wrappedRenderer | ( | ) | `[inline]`

The renderer to we wrapped by this occlusion culling renderer.

Definition at line 62 of file OcclusionCullRenderer.hpp.

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.

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().

const Framebuffer * OcclusionCullRenderer::framebuffer | ( | ) | const`[virtual]`

Returns the wrapped Renderer's Framebuffer.

Reimplemented from vl::Renderer.

Definition at line 133 of file OcclusionCullRenderer.cpp.

References mWrappedRenderer, and NULL.

Referenced by render_pass2().

Framebuffer * OcclusionCullRenderer::framebuffer | ( | ) | `[virtual]`

Returns the wrapped Renderer's Framebuffer.

Reimplemented from vl::Renderer.

Definition at line 141 of file OcclusionCullRenderer.cpp.

References mWrappedRenderer, and NULL.

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.

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.

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.

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.

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.

void OcclusionCullRenderer::render_pass1 | ( | const RenderQueue * | in_render_queue ) | `[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::Actor::enableMask(), vl::Log::error(), vl::ref< T >::get(), 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().

void OcclusionCullRenderer::render_pass2 | ( | const RenderQueue * | in_render_queue,
|  | Camera * | camera
| ) |  | `[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::Actor::enableMask(), vl::RendererAbstract::enableMask(), framebuffer(), vl::ref< T >::get(), vl::Matrix4< T_Scalar >::getT(), 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::Shader::scissor(), vl::Actor::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::Vector3< T_Scalar >::x(), vl::Viewport::x(), vl::Vector3< T_Scalar >::y(), vl::Viewport::y(), and vl::Vector3< T_Scalar >::z().

Referenced by render().

## Member Data Documentation

vl::ref<Renderer> vl::OcclusionCullRenderer::mWrappedRenderer`[protected]`

Definition at line 105 of file OcclusionCullRenderer.hpp.

Referenced by framebuffer(), render(), render_pass1(), render_pass2(), and setWrappedRenderer().

ref<Shader> vl::OcclusionCullRenderer::mOcclusionShader`[protected]`

Definition at line 106 of file OcclusionCullRenderer.hpp.

Referenced by OcclusionCullRenderer(), and render_pass2().

ref<RenderQueue> vl::OcclusionCullRenderer::mCulledRenderQueue`[protected]`

Definition at line 107 of file OcclusionCullRenderer.hpp.

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

int vl::OcclusionCullRenderer::mOcclusionThreshold`[protected]`

Definition at line 108 of file OcclusionCullRenderer.hpp.

Referenced by OcclusionCullRenderer().

Renderer* vl::OcclusionCullRenderer::mPrevWrapRenderer`[protected]`

Definition at line 109 of file OcclusionCullRenderer.hpp.

Referenced by OcclusionCullRenderer(), and render_pass1().

int vl::OcclusionCullRenderer::mStatsTotalObjects`[protected]`

Definition at line 110 of file OcclusionCullRenderer.hpp.

Referenced by OcclusionCullRenderer(), and render_pass1().

int vl::OcclusionCullRenderer::mStatsOccludedObjects`[protected]`

Definition at line 111 of file OcclusionCullRenderer.hpp.

Referenced by OcclusionCullRenderer(), and render_pass1().

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

- D:/VL/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vlGraphics/OcclusionCullRenderer.hpp
- D:/VL/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vlGraphics/OcclusionCullRenderer.cpp

Visualization Library v2011.09.1162 Reference Documentation
Copyright 2005-2011 Michele Bosi. All rights reserved.
Updated on Thu Jan 26 2012 00:44:41.
Permission is granted to use this page to write and publish articles regarding Visualization Library.