Visualization Library 2.0.0
A 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. More... | |
Rendering (const Rendering &other) | |
Copy constructor. More... | |
Rendering & | operator= (const Rendering &other) |
Assignment operator. More... | |
virtual void | render () |
Executes the rendering. More... | |
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. More... | |
RenderQueueSorter * | renderQueueSorter () |
The RenderQueueSorter used to perform the sorting of the objects to be rendered, if NULL no sorting is performed. More... | |
const Collection< Renderer > & | renderers () const |
The list of Renderers used to perform the rendering. More... | |
Collection< Renderer > & | renderers () |
The list of Renderers used to perform the rendering. More... | |
void | setRenderer (Renderer *renderer) |
Uitlity function: clears the renderers() list and adds the specified one. More... | |
const Renderer * | renderer () const |
Utility function: returns the first renderer installed or NULL if none is found. More... | |
Renderer * | renderer () |
Utility function: returns the first renderer installed or NULL if none is found. More... | |
void | setCamera (Camera *camera) |
The Camera that defines the point of view and viewport to be used when rendering the scene. More... | |
const Camera * | camera () const |
The Camera that defines the point of view and viewport to be used when rendering the scene. More... | |
Camera * | camera () |
The Camera that defines the point of view and viewport to be used when rendering the scene. More... | |
Collection< SceneManager > * | sceneManagers () |
Returns the list of SceneManager[s] containing the Actor[s] to be rendered. More... | |
const Collection< SceneManager > * | sceneManagers () const |
Returns the list of SceneManager[s] containing the Actor[s] to be rendered. More... | |
void | setTransform (Transform *transform) |
The root of the Transform tree updated at every rendering frame. More... | |
const Transform * | transform () const |
The root of the Transform tree updated at every rendering frame. More... | |
Transform * | transform () |
The root of the Transform tree updated at every rendering frame. More... | |
void | setEvaluateLOD (bool evaluate_lod) |
Whether the Level-Of-Detail should be evaluated or not. More... | |
bool | evaluateLOD () const |
Whether the Level-Of-Detail should be evaluated or not. More... | |
void | setShaderAnimationEnabled (bool animate_shaders) |
Whether Shader::shaderAnimator()->updateShader() should be called or not. More... | |
bool | shaderAnimationEnabled () const |
Whether Shader::shaderAnimator()->updateShader() should be called or not. More... | |
void | setCullingEnabled (bool enabled) |
Whether the installed SceneManager[s] should perform Actor culling or not in order to maximize the rendering performances. More... | |
bool | cullingEnabled () const |
Whether the installed SceneManager[s] should perform Actor culling or not in order to maximize the rendering performances. More... | |
void | setAutomaticResourceInit (bool enable) |
Whether OpenGL resources such as textures and GLSL programs should be automatically initialized when first used. More... | |
bool | automaticResourceInit () const |
Whether OpenGL resources such as textures and GLSL programs should be automatically initialized before the rendering takes place. More... | |
bool | nearFarClippingPlanesOptimized () const |
Returns whether near/far planes optimization is enabled. More... | |
void | setNearFarClippingPlanesOptimized (bool enabled) |
Enabled/disables near/far planes optimization. More... | |
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. More... | |
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. More... | |
Public Member Functions inherited from vl::RenderingAbstract | |
RenderingAbstract () | |
Constructor. More... | |
RenderingAbstract & | operator= (const RenderingAbstract &other) |
void | dispatchOnRenderingStarted () |
Calls the RenderEventCallback::onRenderingStarted() method of all the active callback objects. More... | |
void | dispatchOnRenderingFinished () |
Calls the RenderEventCallback::onRenderingFinished() method of all the active callback objects. More... | |
Collection< RenderEventCallback > * | onStartedCallbacks () |
Returns the list of RenderEventCallback objects registered to the onRenderingStarted() event notification. More... | |
const Collection< RenderEventCallback > * | onStartedCallbacks () const |
Returns the list of RenderEventCallback objects registered to the onRenderingStarted() event notification. More... | |
Collection< RenderEventCallback > * | onFinishedCallbacks () |
Returns the list of RenderEventCallback objects registered to the onRenderingFinished() event notification. More... | |
const Collection< RenderEventCallback > * | onFinishedCallbacks () const |
Returns the list of RenderEventCallback objects registered to the onRenderingFinished() event notification. More... | |
void | setEnableMask (unsigned int mask) |
The enable mask of the Rendering, used to define wheter the rendering is enabled or not, and which objects should be rendered. More... | |
unsigned int | enableMask () const |
The enable mask of the Rendering, used to define wheter the rendering is enabled or not, and which objects should be rendered. More... | |
bool | isEnabled (unsigned int mask) |
bool | isEnabled (const Actor *actor) |
void | setFrameClock (real cur_time) |
The update time of the current rendering frame. More... | |
real | frameClock () const |
The update time of the current rendering frame. 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 | fillRenderQueue (ActorCollection *actor_list) |
RenderQueue * | renderQueue () |
ActorCollection * | actorQueue () |
Protected Member Functions inherited from vl::Object | |
virtual | ~Object () |
Protected Attributes | |
ref< RenderQueueSorter > | mRenderQueueSorter |
ref< ActorCollection > | mActorQueue |
ref< RenderQueue > | mRenderQueue |
Collection< 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 |
Protected Attributes inherited from vl::RenderingAbstract | |
ref< Collection< RenderEventCallback > > | mOnStartedCallbacks |
ref< Collection< RenderEventCallback > > | mOnFinishedCallbacks |
real | mFrameClock |
unsigned int | mEnableMask |
Protected Attributes inherited from vl::Object | |
std::string | mObjectName |
IMutex * | mRefCountMutex |
int | mReferenceCount |
bool | mAutomaticDelete |
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, and mTransform.
|
inline |
Copy constructor.
Definition at line 78 of file Rendering.hpp.
|
inlineprotected |
Definition at line 212 of file Rendering.hpp.
Referenced by render().
|
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().
|
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(), vl::Applet::initialize(), render(), and vl::Applet::resizeEvent().
|
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.
|
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().
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.
|
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().
|
protected |
Definition at line 275 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::RenderingAbstract::enableMask(), vl::Effect::enableMask(), vl::Actor::enableMask(), evaluateLOD(), vl::Effect::evaluateLOD(), vl::Actor::evaluateLOD(), vl::RenderingAbstract::frameClock(), vl::Shader::glslProgram(), vl::Shader::gocRenderStateSet(), vl::Texture::handle(), vl::RenderingAbstract::isEnabled(), vl::ShaderAnimator::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().
|
inline |
Returns whether near/far planes optimization is enabled.
Definition at line 185 of file Rendering.hpp.
Referenced by render().
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.
|
virtual |
Executes the rendering.
Implements vl::RenderingAbstract.
Definition at line 83 of file Rendering.cpp.
References actorQueue(), vl::Collection< T >::at(), vl::Actor::boundingSphere(), camera(), vl::RenderQueue::clear(), vl::Collection< T >::clear(), vl::Camera::computeFrustumPlanes(), vl::Camera::computeNearFarOptimizedProjMatrix(), vl::Transform::computeWorldMatrixRecursive(), cullingEnabled(), vl::RenderingAbstract::dispatchOnRenderingFinished(), vl::RenderingAbstract::dispatchOnRenderingStarted(), vl::RenderingAbstract::enableMask(), vl::Log::error(), fillRenderQueue(), vl::RenderingAbstract::frameClock(), vl::Camera::frustum(), vl::RenderingAbstract::isEnabled(), nearFarClippingPlanesOptimized(), NULL, vl::Frustum::planes(), vl::RCS_RenderingFinished, vl::RCS_RenderingStarted, renderers(), renderQueue(), renderQueueSorter(), vl::OpenGLContext::resetContextStates(), vl::Collection< T >::resize(), sceneManagers(), vl::Camera::setModelingMatrix(), vl::Collection< T >::size(), vl::RenderQueue::sort(), transform(), VL_CHECK, VL_CHECK_OGL, and VL_TRAP.
|
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().
|
inline |
Utility function: returns the first renderer installed or NULL if none is found.
Definition at line 119 of file Rendering.hpp.
References NULL.
|
inline |
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().
|
inline |
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.
|
inlineprotected |
Definition at line 211 of file Rendering.hpp.
Referenced by fillRenderQueue(), and render().
|
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().
|
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(), vl::Applet::initialize(), and render().
|
inline |
Returns the list of SceneManager[s] containing the Actor[s] to be rendered.
Definition at line 140 of file Rendering.hpp.
|
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.
|
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.
|
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.
|
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.
|
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.
|
inline |
Uitlity function: clears the renderers() list and adds the specified one.
Definition at line 103 of file Rendering.hpp.
|
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.
|
inline |
Whether Shader::shaderAnimator()->updateShader() should be called or not.
Definition at line 163 of file Rendering.hpp.
|
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.
|
inline |
Whether Shader::shaderAnimator()->updateShader() should be called or not.
Definition at line 168 of file Rendering.hpp.
Referenced by fillRenderQueue().
|
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().
|
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.
|
protected |
Definition at line 216 of file Rendering.hpp.
Referenced by Rendering().
|
protected |
Definition at line 224 of file Rendering.hpp.
Referenced by operator=().
Definition at line 219 of file Rendering.hpp.
Referenced by operator=(), and Rendering().
|
protected |
Definition at line 225 of file Rendering.hpp.
Referenced by operator=().
Definition at line 222 of file Rendering.hpp.
Referenced by fillRenderQueue().
|
protected |
Definition at line 226 of file Rendering.hpp.
Referenced by operator=().
|
protected |
Definition at line 228 of file Rendering.hpp.
Referenced by operator=().
|
protected |
Definition at line 218 of file Rendering.hpp.
Referenced by operator=(), and Rendering().
|
protected |
Definition at line 217 of file Rendering.hpp.
Referenced by Rendering().
|
protected |
Definition at line 215 of file Rendering.hpp.
Referenced by operator=(), and Rendering().
|
protected |
Definition at line 221 of file Rendering.hpp.
Referenced by operator=(), and Rendering().
|
protected |
Definition at line 227 of file Rendering.hpp.
Referenced by operator=().
Definition at line 220 of file Rendering.hpp.
Referenced by operator=(), and Rendering().
Visualization Library 2.0.0 Reference Documentation
Updated on Wed Dec 23 2020 12:44:11.
© Copyright Michele Bosi. All rights reserved.