Visualization Library 2.1.0

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

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Public Member Functions | Protected Attributes | List of all members
vl::Renderer Class Reference

The Renderer class executes the actual rendering on the given RenderQueue. More...

#include <Renderer.hpp>

+ Inheritance diagram for vl::Renderer:

Public Member Functions

 Renderer ()
 
virtual ~Renderer ()
 
virtual const RenderQueuerender (const RenderQueue *in_render_queue, Camera *camera, real frame_clock)
 Takes as input the render queue to render and returns a possibly filtered render queue for further processing. More...
 
const RenderQueuerenderRaw (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 ProjViewTransfCallbackprojViewTransfCallback () const
 
ProjViewTransfCallbackprojViewTransfCallback ()
 
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 (FramebufferObject *framebuffer)
 The Framebuffer on which the rendering is performed. More...
 
const FramebufferObjectframebuffer () const
 The Framebuffer on which the rendering is performed. More...
 
FramebufferObjectframebuffer ()
 The Framebuffer on which the rendering is performed. More...
 
- Public Member Functions inherited from vl::RendererAbstract
 RendererAbstract ()
 
RendererAbstractoperator= (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...
 
Objectoperator= (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...
 
IMutexrefCountMutex ()
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
const IMutexrefCountMutex () 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 Attributes

ref< FramebufferObjectmFramebuffer
 
vl::ref< EnableSetmDummyEnables
 
vl::ref< RenderStateSetmDummyStateSet
 
std::map< unsigned int, ref< Shader > > mShaderOverrideMask
 
std::vector< RenderStateSlotmOverriddenDefaultRenderStates
 
ref< ProjViewTransfCallbackmProjViewTransfCallback
 
- 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
 
IMutexmRefCountMutex
 
int mReferenceCount
 
bool mAutomaticDelete
 

Additional Inherited Members

- Protected Member Functions inherited from vl::Object
virtual ~Object ()
 

Detailed Description

The Renderer class executes the actual rendering on the given RenderQueue.

See also
Rendering

Definition at line 49 of file Renderer.hpp.

Constructor & Destructor Documentation

◆ Renderer()

Renderer::Renderer ( )

Definition at line 46 of file Renderer.cpp.

References mDummyEnables, mDummyStateSet, mProjViewTransfCallback, and NULL.

◆ ~Renderer()

virtual vl::Renderer::~Renderer ( )
inlinevirtual

Definition at line 56 of file Renderer.hpp.

Member Function Documentation

◆ framebuffer() [1/2]

const FramebufferObject* vl::Renderer::framebuffer ( ) const
inlinevirtual

The Framebuffer on which the rendering is performed.

Implements vl::RendererAbstract.

Definition at line 100 of file Renderer.hpp.

Referenced by render(), vl::EdgeRenderer::render(), vl::EdgeRenderer::renderLines(), renderRaw(), vl::EdgeRenderer::renderSolids(), and vl::Applet::resizeEvent().

◆ framebuffer() [2/2]

FramebufferObject* vl::Renderer::framebuffer ( )
inlinevirtual

The Framebuffer on which the rendering is performed.

Implements vl::RendererAbstract.

Definition at line 103 of file Renderer.hpp.

◆ isEnabled() [1/2]

bool vl::Renderer::isEnabled ( unsigned int  mask)
inline

Definition at line 93 of file Renderer.hpp.

Referenced by vl::EdgeRenderer::render(), and renderRaw().

◆ isEnabled() [2/2]

bool vl::Renderer::isEnabled ( const Actor actor)
inline

Definition at line 94 of file Renderer.hpp.

References vl::Actor::enableMask(), and vl::Actor::isEnabled().

◆ overriddenDefaultRenderStates() [1/2]

std::vector<RenderStateSlot>& vl::Renderer::overriddenDefaultRenderStates ( )
inline

Render states that will be used as default by the opengl context by this renderer.

Useful for example to setup the default left/right color mask for anaglyph stereo rendering.

Definition at line 87 of file Renderer.hpp.

Referenced by render().

◆ overriddenDefaultRenderStates() [2/2]

const std::vector<RenderStateSlot>& vl::Renderer::overriddenDefaultRenderStates ( ) const
inline

Render states that will be used as default by the opengl context by this renderer.

Useful for example to setup the default left/right color mask for anaglyph stereo rendering.

Definition at line 91 of file Renderer.hpp.

◆ projViewTransfCallback() [1/2]

const ProjViewTransfCallback* vl::Renderer::projViewTransfCallback ( ) const
inline

Definition at line 69 of file Renderer.hpp.

Referenced by vl::OcclusionCullRenderer::render_pass2(), and renderRaw().

◆ projViewTransfCallback() [2/2]

ProjViewTransfCallback* vl::Renderer::projViewTransfCallback ( )
inline

Definition at line 71 of file Renderer.hpp.

◆ render()

const RenderQueue * Renderer::render ( const RenderQueue in_render_queue,
Camera camera,
real  frame_clock 
)
virtual

◆ renderRaw()

const RenderQueue * Renderer::renderRaw ( const RenderQueue in_render_queue,
Camera camera,
real  frame_clock 
)

Used by render() to loop through the render queue.

Does not activate the framebuffer, does not activate the viewport, does not clear the viewport, does not setup the override states, does not issue the OnRendererStarted/Finished callbacks.

Definition at line 88 of file Renderer.cpp.

References vl::OpenGLContext::applyEnables(), vl::OpenGLContext::applyRenderStates(), vl::GLSLProgram::applyUniformSet(), vl::OpenGLContext::areUniformsColliding(), vl::RenderQueue::at(), vl::OpenGLContext::bindVAS(), vl::Log::bug(), vl::Actor::dispatchOnActorRenderStarted(), vl::Scissor::enable(), vl::Actor::enableMask(), vl::Log::error(), framebuffer(), vl::Shader::getEnableSet(), vl::Shader::getRenderStateSet(), vl::Actor::getUniformSet(), vl::GLSLProgram::getUniformSet(), vl::Shader::getUniformSet(), vl::RenderStateSet::glslProgram(), vl::Shader::glslProgram(), vl::GLSLProgram::handle(), vl::Has_Fixed_Function_Pipeline, vl::Viewport::height(), vl::GLSLProgram::infoLog(), isEnabled(), vl::GLSLProgram::linked(), vl::RenderToken::mActor, mDummyEnables, mDummyStateSet, vl::RenderToken::mNextPass, vl::RenderToken::mRenderable, vl::RenderToken::mShader, mShaderOverrideMask, NULL, vl::Object::objectName(), vl::FramebufferObject::openglContext(), projViewTransfCallback(), vl::Renderable::render(), vl::Actor::scissor(), vl::Shader::scissor(), vl::RenderQueue::size(), vl::Actor::transform(), vl::UniformSet::uniforms(), vl::ProjViewTransfCallback::updateMatrices(), vl::GLSLProgram::validateProgram(), vl::Camera::viewport(), VL_CHECK, VL_CHECK_OGL, VL_TRAP, vl::Viewport::width(), vl::Viewport::x(), and vl::Viewport::y().

Referenced by render().

◆ setFramebuffer()

void vl::Renderer::setFramebuffer ( FramebufferObject framebuffer)
inline

The Framebuffer on which the rendering is performed.

Definition at line 97 of file Renderer.hpp.

◆ setProjViewTransfCallback()

void vl::Renderer::setProjViewTransfCallback ( ProjViewTransfCallback callback)
inline

Definition at line 67 of file Renderer.hpp.

◆ shaderOverrideMask() [1/2]

const std::map<unsigned int, ref<Shader> >& vl::Renderer::shaderOverrideMask ( ) const
inline

A bitmask/Shader map used to everride the Shader of those Actors whose enable mask satisfy the following condition: (Actors::enableMask() & bitmask) != 0.

Useful when you want to override the Shader of a whole set of Actors. If multiple mask/shader pairs match an Actor's enable mask then the shader with the corresponding lowest mask will be used. See also vl::Actor::enableMask() and vl::Rendering::effectOverrideMask().

Definition at line 77 of file Renderer.hpp.

◆ shaderOverrideMask() [2/2]

std::map<unsigned int, ref<Shader> >& vl::Renderer::shaderOverrideMask ( )
inline

A bitmask/Shader map used to everride the Shader of those Actors whose enable mask satisfy the following condition: (Actors::enableMask() & bitmask) != 0.

Useful when you want to override the Shader of a whole set of Actors. If multiple mask/shader pairs match an Actor's enable mask then the shader with the corresponding lowest mask will be used. See also vl::Actor::enableMask() and vl::Rendering::effectOverrideMask().

Definition at line 83 of file Renderer.hpp.

Member Data Documentation

◆ mDummyEnables

vl::ref<EnableSet> vl::Renderer::mDummyEnables
protected

Definition at line 109 of file Renderer.hpp.

Referenced by vl::OcclusionCullRenderer::render_pass2(), Renderer(), and renderRaw().

◆ mDummyStateSet

vl::ref<RenderStateSet> vl::Renderer::mDummyStateSet
protected

Definition at line 110 of file Renderer.hpp.

Referenced by vl::OcclusionCullRenderer::render_pass2(), Renderer(), and renderRaw().

◆ mFramebuffer

ref<FramebufferObject> vl::Renderer::mFramebuffer
protected

Definition at line 106 of file Renderer.hpp.

◆ mOverriddenDefaultRenderStates

std::vector<RenderStateSlot> vl::Renderer::mOverriddenDefaultRenderStates
protected

Definition at line 114 of file Renderer.hpp.

◆ mProjViewTransfCallback

ref<ProjViewTransfCallback> vl::Renderer::mProjViewTransfCallback
protected

Definition at line 116 of file Renderer.hpp.

Referenced by Renderer().

◆ mShaderOverrideMask

std::map<unsigned int, ref<Shader> > vl::Renderer::mShaderOverrideMask
protected

Definition at line 112 of file Renderer.hpp.

Referenced by renderRaw().


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