Visualization Library v1.0.3A lightweight C++ OpenGL middleware for 2D/3D graphics |
[Download] [Tutorials] [All Classes] [Grouped Classes] |
The Rendering class collects all the information to perform the rendering of a scene. More...
#include <Rendering.hpp>
Public Member Functions | |
Rendering () | |
Constructor. | |
Rendering (const Rendering &other) | |
Copy constructor. | |
Rendering & | operator= (const Rendering &other) |
Assignment operator. | |
virtual void | render () |
Executes the rendering. | |
void | setRenderQueueSorter (RenderQueueSorter *render_queue_sorter) |
The RenderQueueSorter used to perform the sorting of the objects to be rendered, if NULL no sorting is performed. | |
RenderQueueSorter * | renderQueueSorter () |
The RenderQueueSorter used to perform the sorting of the objects to be rendered, if NULL no sorting is performed. | |
const std::vector< ref < Renderer > > & | renderers () const |
The list of Renderers used to perform the rendering. | |
std::vector< ref< Renderer > > & | renderers () |
The list of Renderers used to perform the rendering. | |
void | setRenderer (Renderer *renderer) |
Uitlity function: clears the renderers() list and adds the specified one. | |
const Renderer * | renderer () const |
Utility function: returns the first renderer installed or NULL if none is found. | |
Renderer * | renderer () |
Utility function: returns the first renderer installed or NULL if none is found. | |
void | setCamera (Camera *camera) |
The Camera that defines the point of view and viewport to be used when rendering the scene. | |
const Camera * | camera () const |
The Camera that defines the point of view and viewport to be used when rendering the scene. | |
Camera * | camera () |
The Camera that defines the point of view and viewport to be used when rendering the scene. | |
Collection< SceneManager > * | sceneManagers () |
Returns the list of SceneManager[s] containing the Actor[s] to be rendered. | |
const Collection< SceneManager > * | sceneManagers () const |
Returns the list of SceneManager[s] containing the Actor[s] to be rendered. | |
void | setTransform (Transform *transform) |
The root of the Transform tree updated at every rendering frame. | |
const Transform * | transform () const |
The root of the Transform tree updated at every rendering frame. | |
Transform * | transform () |
The root of the Transform tree updated at every rendering frame. | |
void | setEvaluateLOD (bool evaluate_lod) |
Whether the Level-Of-Detail should be evaluated or not. | |
bool | evaluateLOD () const |
Whether the Level-Of-Detail should be evaluated or not. | |
void | setShaderAnimationEnabled (bool animate_shaders) |
Whether Shader::shaderAnimator()->updateShader() should be called or not. | |
bool | shaderAnimationEnabled () const |
Whether Shader::shaderAnimator()->updateShader() should be called or not. | |
void | setCullingEnabled (bool enabled) |
Whether the installed SceneManager[s] should perform Actor culling or not in order to maximize the rendering performances. | |
bool | cullingEnabled () const |
Whether the installed SceneManager[s] should perform Actor culling or not in order to maximize the rendering performances. | |
void | setAutomaticResourceInit (bool enable) |
Whether OpenGL resources such as textures and GLSL programs should be automatically initialized when first used. | |
bool | automaticResourceInit () const |
Whether OpenGL resources such as textures and GLSL programs should be automatically initialized before the rendering takes place. | |
bool | nearFarClippingPlanesOptimized () const |
Returns whether near/far planes optimization is enabled. | |
void | setNearFarClippingPlanesOptimized (bool enabled) |
Enabled/disables near/far planes optimization. | |
const std::map< unsigned int, ref< Effect > > & | effectOverrideMask () const |
A bitmask/Effect map used to everride the Effect of those Actors whose enable mask satisfy the following condition: (Actors::enableMask() & bitmask) != 0. | |
std::map< unsigned int, ref < Effect > > & | effectOverrideMask () |
A bitmask/Effect map used to everride the Effect of those Actors whose enable mask satisfy the following condition: (Actors::enableMask() & bitmask) != 0. | |
Protected Member Functions | |
void | fillRenderQueue (ActorCollection *actor_list) |
RenderQueue * | renderQueue () |
ActorCollection * | actorQueue () |
Protected Attributes | |
ref< RenderQueueSorter > | mRenderQueueSorter |
ref< ActorCollection > | mActorQueue |
ref< RenderQueue > | mRenderQueue |
std::vector< ref< Renderer > > | mRenderers |
ref< Camera > | mCamera |
ref< Transform > | mTransform |
ref< Collection< SceneManager > > | mSceneManagers |
std::map< unsigned int, ref < Effect > > | mEffectOverrideMask |
bool | mAutomaticResourceInit |
bool | mCullingEnabled |
bool | mEvaluateLOD |
bool | mShaderAnimationEnabled |
bool | mNearFarClippingPlanesOptimized |
The Rendering class collects all the information to perform the rendering of a scene.
The Rendering class performs the following steps:
To be included in the rendering an Actor must have an enableMask() and Effect::enableMask() such that "(Actor::enableMask() & Rendering::enableMask()) != 0"
and "(Actor::effect()->enableMask() & Rendering::enableMask()) != 0"
.
Definition at line 69 of file Rendering.hpp.
Rendering::Rendering | ( | ) |
Constructor.
Definition at line 44 of file Rendering.cpp.
References mActorQueue, mCamera, mRenderers, mRenderQueue, mRenderQueueSorter, mSceneManagers, mTransform, and VL_DEBUG_SET_OBJECT_NAME.
vl::Rendering::Rendering | ( | const Rendering & | other ) | [inline] |
Copy constructor.
Definition at line 78 of file Rendering.hpp.
Assignment operator.
Definition at line 61 of file Rendering.cpp.
References mAutomaticResourceInit, mCamera, mCullingEnabled, vl::RenderingAbstract::mEnableMask, mEvaluateLOD, mNearFarClippingPlanesOptimized, mRenderers, mRenderQueueSorter, mSceneManagers, mShaderAnimationEnabled, and mTransform.
void Rendering::render | ( | ) | [virtual] |
Executes the rendering.
Implements vl::RenderingAbstract.
Definition at line 83 of file Rendering.cpp.
References actorQueue(), vl::Collection< T >::at(), vl::Actor::boundingSphere(), vl::SceneManager::boundsDirty(), camera(), vl::RenderQueue::clear(), vl::Collection< T >::clear(), vl::SceneManager::computeBounds(), vl::Camera::computeFrustumPlanes(), vl::Camera::computeNearFarOptimizedProjMatrix(), vl::Transform::computeWorldMatrixRecursive(), vl::Frustum::cull(), vl::SceneManager::cullingEnabled(), cullingEnabled(), vl::RenderingAbstract::enableMask(), vl::Log::error(), vl::SceneManager::extractActors(), vl::SceneManager::extractVisibleActors(), fillRenderQueue(), vl::RenderingAbstract::frameClock(), vl::Camera::frustum(), vl::RenderingAbstract::isEnabled(), nearFarClippingPlanesOptimized(), NULL, vl::Frustum::planes(), vl::RCS_RenderingFinished, vl::RCS_RenderingStarted, renderers(), renderQueue(), renderQueueSorter(), sceneManagers(), vl::Camera::setModelingMatrix(), vl::Collection< T >::size(), vl::RenderQueue::sort(), transform(), VL_CHECK, VL_CHECK_OGL, and VL_TRAP.
void vl::Rendering::setRenderQueueSorter | ( | RenderQueueSorter * | render_queue_sorter ) | [inline] |
The RenderQueueSorter used to perform the sorting of the objects to be rendered, if NULL no sorting is performed.
Definition at line 87 of file Rendering.hpp.
RenderQueueSorter* vl::Rendering::renderQueueSorter | ( | ) | [inline] |
The RenderQueueSorter used to perform the sorting of the objects to be rendered, if NULL no sorting is performed.
Definition at line 90 of file Rendering.hpp.
Referenced by render().
The list of Renderers used to perform the rendering.
The output of one Renderer::render() operation will be fed as input for the next Renderer::render() operation.
Definition at line 95 of file Rendering.hpp.
Referenced by render().
The list of Renderers used to perform the rendering.
The output of one Renderer::render() operation will be fed as input for the next Renderer::render() operation.
Definition at line 100 of file Rendering.hpp.
void vl::Rendering::setRenderer | ( | Renderer * | renderer ) | [inline] |
Uitlity function: clears the renderers() list and adds the specified one.
Definition at line 103 of file Rendering.hpp.
const Renderer* vl::Rendering::renderer | ( | ) | const [inline] |
Utility function: returns the first renderer installed or NULL if none is found.
Definition at line 110 of file Rendering.hpp.
References NULL.
Referenced by vl::Applet::resizeEvent().
Renderer* vl::Rendering::renderer | ( | ) | [inline] |
Utility function: returns the first renderer installed or NULL if none is found.
Definition at line 119 of file Rendering.hpp.
References NULL.
void vl::Rendering::setCamera | ( | Camera * | camera ) | [inline] |
The Camera that defines the point of view and viewport to be used when rendering the scene.
Definition at line 128 of file Rendering.hpp.
const Camera* vl::Rendering::camera | ( | ) | const [inline] |
The Camera that defines the point of view and viewport to be used when rendering the scene.
Definition at line 131 of file Rendering.hpp.
Referenced by fillRenderQueue(), render(), and vl::Applet::resizeEvent().
Camera* vl::Rendering::camera | ( | ) | [inline] |
The Camera that defines the point of view and viewport to be used when rendering the scene.
Definition at line 134 of file Rendering.hpp.
Collection<SceneManager>* vl::Rendering::sceneManagers | ( | ) | [inline] |
Returns the list of SceneManager[s] containing the Actor[s] to be rendered.
Definition at line 137 of file Rendering.hpp.
Referenced by vl::TrackballManipulator::adjustView(), vl::EdgeExtractor::extractEdges(), and render().
const Collection<SceneManager>* vl::Rendering::sceneManagers | ( | ) | const [inline] |
Returns the list of SceneManager[s] containing the Actor[s] to be rendered.
Definition at line 140 of file Rendering.hpp.
void vl::Rendering::setTransform | ( | Transform * | transform ) | [inline] |
The root of the Transform tree updated at every rendering frame.
For more information about how and when using it see the documentation of Transform.
Definition at line 144 of file Rendering.hpp.
const Transform* vl::Rendering::transform | ( | ) | const [inline] |
The root of the Transform tree updated at every rendering frame.
For more information about how and when using it see the documentation of Transform.
Definition at line 148 of file Rendering.hpp.
Referenced by render().
Transform* vl::Rendering::transform | ( | ) | [inline] |
The root of the Transform tree updated at every rendering frame.
For more information about how and when using it see the documentation of Transform.
Definition at line 152 of file Rendering.hpp.
void vl::Rendering::setEvaluateLOD | ( | bool | evaluate_lod ) | [inline] |
Whether the Level-Of-Detail should be evaluated or not.
When disabled lod #0 is used.
Definition at line 155 of file Rendering.hpp.
bool vl::Rendering::evaluateLOD | ( | ) | const [inline] |
Whether the Level-Of-Detail should be evaluated or not.
When disabled lod #0 is used.
Definition at line 158 of file Rendering.hpp.
Referenced by fillRenderQueue().
void vl::Rendering::setShaderAnimationEnabled | ( | bool | animate_shaders ) | [inline] |
Whether Shader::shaderAnimator()->updateShader() should be called or not.
Definition at line 163 of file Rendering.hpp.
bool vl::Rendering::shaderAnimationEnabled | ( | ) | const [inline] |
Whether Shader::shaderAnimator()->updateShader() should be called or not.
Definition at line 168 of file Rendering.hpp.
Referenced by fillRenderQueue().
void vl::Rendering::setCullingEnabled | ( | bool | enabled ) | [inline] |
Whether the installed SceneManager[s] should perform Actor culling or not in order to maximize the rendering performances.
Definition at line 171 of file Rendering.hpp.
bool vl::Rendering::cullingEnabled | ( | ) | const [inline] |
Whether the installed SceneManager[s] should perform Actor culling or not in order to maximize the rendering performances.
Definition at line 174 of file Rendering.hpp.
Referenced by render().
void vl::Rendering::setAutomaticResourceInit | ( | bool | enable ) | [inline] |
Whether OpenGL resources such as textures and GLSL programs should be automatically initialized when first used.
Enabling this features forces VL to keep track of which resources are used for each rendering, which might slighly impact the rendering time, thus to obtain the maximum performances disable this option and manually initialize your textures and GLSL shaders.
Definition at line 179 of file Rendering.hpp.
bool vl::Rendering::automaticResourceInit | ( | ) | const [inline] |
Whether OpenGL resources such as textures and GLSL programs should be automatically initialized before the rendering takes place.
Definition at line 182 of file Rendering.hpp.
Referenced by fillRenderQueue().
bool vl::Rendering::nearFarClippingPlanesOptimized | ( | ) | const [inline] |
Returns whether near/far planes optimization is enabled.
Definition at line 185 of file Rendering.hpp.
Referenced by render().
void vl::Rendering::setNearFarClippingPlanesOptimized | ( | bool | enabled ) | [inline] |
Enabled/disables near/far planes optimization.
When enabled, the automatic near/far clipping planes optimization modifies the projection matrix of the current camera to minimize z-fighting artifacts. If later you disable this feature you might want to recompute the original projection matrix of the camera using the method vl::Camera::setProjectionPerspective().
Definition at line 191 of file Rendering.hpp.
A bitmask/Effect map used to everride the Effect of those Actors whose enable mask satisfy the following condition: (Actors::enableMask() & bitmask) != 0.
Useful when you want to override the Effect of a whole set of Actors. If multiple mask/effect pairs match an Actor's enable mask then the effect with the corresponding lowest mask will be used. See also vl::Actor::enableMask() and vl::Renderer::shaderOverrideMask().
Definition at line 197 of file Rendering.hpp.
A bitmask/Effect map used to everride the Effect of those Actors whose enable mask satisfy the following condition: (Actors::enableMask() & bitmask) != 0.
Useful when you want to override the Effect of a whole set of Actors. If multiple mask/effect pairs match an Actor's enable mask then the effect with the corresponding lowest mask will be used. See also vl::Actor::enableMask() and vl::Renderer::shaderOverrideMask().
Definition at line 203 of file Rendering.hpp.
void Rendering::fillRenderQueue | ( | ActorCollection * | actor_list ) | [protected] |
Definition at line 270 of file Rendering.cpp.
References vl::Collection< T >::at(), automaticResourceInit(), camera(), vl::Actor::computeBounds(), vl::Texture::createTexture(), vl::Actor::effect(), vl::Collection< T >::empty(), vl::Effect::enableMask(), vl::Actor::enableMask(), vl::RenderingAbstract::enableMask(), vl::Actor::evaluateLOD(), evaluateLOD(), vl::Effect::evaluateLOD(), vl::RenderingAbstract::frameClock(), vl::ref< T >::get(), vl::Shader::glslProgram(), vl::Shader::gocRenderStateSet(), vl::ShaderAnimator::isEnabled(), vl::RenderingAbstract::isEnabled(), vl::Shader::lastUpdateTime(), vl::GLSLProgram::linked(), vl::GLSLProgram::linkProgram(), vl::Effect::lod(), vl::Actor::lod(), vl::RenderToken::mActor, mEffectOverrideMask, vl::RenderToken::mEffectRenderRank, vl::RenderToken::mNextPass, vl::RenderToken::mRenderable, vl::RenderStateSlot::mRS, vl::RenderToken::mShader, vl::RenderQueue::newToken(), NULL, renderQueue(), vl::Effect::renderRank(), vl::RenderStateSet::renderStates(), vl::RenderStateSet::renderStatesCount(), vl::RS_TextureSampler, vl::Shader::setLastUpdateTime(), vl::Texture::setupParams(), shaderAnimationEnabled(), vl::Shader::shaderAnimator(), vl::Collection< T >::size(), vl::TextureSampler::texture(), vl::RenderStateSlot::type(), vl::ShaderAnimator::updateShader(), and VL_CHECK.
Referenced by render().
RenderQueue* vl::Rendering::renderQueue | ( | ) | [inline, protected] |
Definition at line 211 of file Rendering.hpp.
Referenced by fillRenderQueue(), and render().
ActorCollection* vl::Rendering::actorQueue | ( | ) | [inline, protected] |
Definition at line 212 of file Rendering.hpp.
Referenced by render().
ref<RenderQueueSorter> vl::Rendering::mRenderQueueSorter [protected] |
Definition at line 215 of file Rendering.hpp.
Referenced by operator=(), and Rendering().
ref<ActorCollection> vl::Rendering::mActorQueue [protected] |
Definition at line 216 of file Rendering.hpp.
Referenced by Rendering().
ref<RenderQueue> vl::Rendering::mRenderQueue [protected] |
Definition at line 217 of file Rendering.hpp.
Referenced by Rendering().
std::vector< ref<Renderer> > vl::Rendering::mRenderers [protected] |
Definition at line 218 of file Rendering.hpp.
Referenced by operator=(), and Rendering().
ref<Camera> vl::Rendering::mCamera [protected] |
Definition at line 219 of file Rendering.hpp.
Referenced by operator=(), and Rendering().
ref<Transform> vl::Rendering::mTransform [protected] |
Definition at line 220 of file Rendering.hpp.
Referenced by operator=(), and Rendering().
ref<Collection<SceneManager> > vl::Rendering::mSceneManagers [protected] |
Definition at line 221 of file Rendering.hpp.
Referenced by operator=(), and Rendering().
std::map<unsigned int, ref<Effect> > vl::Rendering::mEffectOverrideMask [protected] |
Definition at line 222 of file Rendering.hpp.
Referenced by fillRenderQueue().
bool vl::Rendering::mAutomaticResourceInit [protected] |
Definition at line 224 of file Rendering.hpp.
Referenced by operator=().
bool vl::Rendering::mCullingEnabled [protected] |
Definition at line 225 of file Rendering.hpp.
Referenced by operator=().
bool vl::Rendering::mEvaluateLOD [protected] |
Definition at line 226 of file Rendering.hpp.
Referenced by operator=().
bool vl::Rendering::mShaderAnimationEnabled [protected] |
Definition at line 227 of file Rendering.hpp.
Referenced by operator=().
bool vl::Rendering::mNearFarClippingPlanesOptimized [protected] |
Definition at line 228 of file Rendering.hpp.
Referenced by operator=().