Visualization Library v1.0.3

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

vl::Rendering Class Reference

The Rendering class collects all the information to perform the rendering of a scene. More...

#include <Rendering.hpp>

Inheritance diagram for vl::Rendering:
vl::RenderingAbstract vl::Object

List of all members.

Public Member Functions

 Rendering ()
 Constructor.
 Rendering (const Rendering &other)
 Copy constructor.
Renderingoperator= (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.
RenderQueueSorterrenderQueueSorter ()
 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 Rendererrenderer () const
 Utility function: returns the first renderer installed or NULL if none is found.
Rendererrenderer ()
 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 Cameracamera () const
 The Camera that defines the point of view and viewport to be used when rendering the scene.
Cameracamera ()
 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 Transformtransform () const
 The root of the Transform tree updated at every rendering frame.
Transformtransform ()
 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)
RenderQueuerenderQueue ()
ActorCollectionactorQueue ()

Protected Attributes

ref< RenderQueueSortermRenderQueueSorter
ref< ActorCollectionmActorQueue
ref< RenderQueuemRenderQueue
std::vector< ref< Renderer > > mRenderers
ref< CameramCamera
ref< TransformmTransform
ref< Collection< SceneManager > > mSceneManagers
std::map< unsigned int, ref
< Effect > > 
mEffectOverrideMask
bool mAutomaticResourceInit
bool mCullingEnabled
bool mEvaluateLOD
bool mShaderAnimationEnabled
bool mNearFarClippingPlanesOptimized

Detailed Description

The Rendering class collects all the information to perform the rendering of a scene.

The Rendering class performs the following steps:

  1. activates the appropriate OpenGLContext
  2. dispatches the onRenderingStarted() event (see RenderEventCallback class).
  3. activates the Framebuffer's framebuffer and draw buffers
  4. recursively computes the world matrix of the installed Transform hierarchy
  5. setups the Camera transform and the Viewport
  6. extracts all the visible Actor[s] from the installed SceneManager[s]
  7. compiles and sorts the RenderQueue using the installed RenderQueueSorter
  8. uses the installed Renderer to perform the rendering of the RenderQueue
  9. dispatches the onRenderingFinished() event (see RenderEventCallback class).

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".

See also:

Definition at line 69 of file Rendering.hpp.


Constructor & Destructor Documentation

Rendering::Rendering (  )
vl::Rendering::Rendering ( const Rendering other ) [inline]

Copy constructor.

Definition at line 78 of file Rendering.hpp.


Member Function Documentation

Rendering & Rendering::operator= ( const Rendering other )
void Rendering::render (  ) [virtual]
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().

const std::vector< ref<Renderer> >& vl::Rendering::renderers (  ) const [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.

Note:
All the renderers must target the same OpenGL context.

Definition at line 95 of file Rendering.hpp.

Referenced by render().

std::vector< ref<Renderer> >& vl::Rendering::renderers (  ) [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.

Note:
All the renderers must target the same OpenGL context.

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.

Note:
Only Shader[s] belonging to visible Actor[s] are animated.

Definition at line 163 of file Rendering.hpp.

bool vl::Rendering::shaderAnimationEnabled (  ) const [inline]

Whether Shader::shaderAnimator()->updateShader() should be called or not.

Note:
Only Shader[s] belonging to visible Actor[s] are animated.

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.

const std::map<unsigned int, ref<Effect> >& vl::Rendering::effectOverrideMask (  ) const [inline]

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.

std::map<unsigned int, ref<Effect> >& vl::Rendering::effectOverrideMask (  ) [inline]

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


Member Data Documentation

Definition at line 215 of file Rendering.hpp.

Referenced by operator=(), and Rendering().

Definition at line 216 of file Rendering.hpp.

Referenced by Rendering().

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

Definition at line 219 of file Rendering.hpp.

Referenced by operator=(), and Rendering().

Definition at line 220 of file Rendering.hpp.

Referenced by operator=(), and Rendering().

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

Definition at line 224 of file Rendering.hpp.

Referenced by operator=().

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

Definition at line 227 of file Rendering.hpp.

Referenced by operator=().

Definition at line 228 of file Rendering.hpp.

Referenced by operator=().


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

Visualization Library v1.0.3 Reference Documentation
Copyright Michele Bosi. All rights reserved.
Updated on Tue Feb 7 2017 00:55:11.
Permission is granted to use this page to write and publish articles regarding Visualization Library.