Visualization Library 2.0.0
A lightweight C++ OpenGL middleware for 2D/3D graphics
|
[Download] [Tutorials] [All Classes] [Grouped Classes] |
The EdgeRenderer class implements a special Renderer that automatically extracts and renders the edges of the objects in the scene. More...
#include <EdgeRenderer.hpp>
Public Member Functions | |
EdgeRenderer () | |
const RenderQueue * | render (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... | |
WFInfo * | declareActor (Actor *act, const fvec4 &color) |
Generates and caches all the information needed to render the edges of the given Actor using the specified color. More... | |
WFInfo * | declareActor (Actor *act) |
Generates and caches all the information needed to render the edges of the given Actor. More... | |
void | clearCache () |
Clears the cache containing the Actor and edge information. More... | |
void | setActorDirty (Actor *actor) |
Removes all the edge/rendering information relative to the specified Actor from the cache. More... | |
void | setShowHiddenLines (bool show) |
If set to true shows also the hidden lines with a dashed pattern. More... | |
bool | showHiddenLines () const |
If set to true shows also the hidden lines with a dashed pattern. More... | |
void | setShowCreases (bool show) |
If set to true shows not only the edges that define the silhouette of an object but also the crease edges. More... | |
bool | showCreases () const |
If set to true shows not only the edges that define the silhouette of an object but also the crease edges. More... | |
void | setCreaseAngle (float degrees) |
The minimum angle (in degrees) considered to generate crease-edges (default is 44 degrees). More... | |
float | creaseAngle () const |
The minimum angle (in degrees) considered to generate crease-edges (default is 44 degrees). More... | |
void | setSmoothLines (bool smooth) |
If set to true the lines will be rendered using antialiasing. More... | |
bool | smoothLines () const |
If set to true the lines will be rendered using antialiasing. More... | |
void | setLineWidth (float width) |
Defines the width of the rendered edges. More... | |
float | lineWidth () const |
Defines the width of the rendered edges. More... | |
void | setDefaultLineColor (const fvec4 &c) |
Defines the default color of the rendered edges. You can also define a per-Actor color using the declareActor() method. More... | |
const fvec4 & | defaultLineColor () const |
Defines the default color of the rendered edges. You can also define a per-Actor color using the declareActor() method. More... | |
void | setPolygonOffsetFactor (float factor) |
Defines the factor parameter used to render the lines over the polygons. See also http://www.opengl.org/sdk/docs/man/xhtml/glPolygonOffset.xml for more information. More... | |
float | polygonOffsetFactor () const |
Defines the factor parameter used to render the lines over the polygons. See also http://www.opengl.org/sdk/docs/man/xhtml/glPolygonOffset.xml for more information. More... | |
void | setPolygonOffsetUnits (float units) |
Defines the units parameter used to render the lines over the polygons. See also http://www.opengl.org/sdk/docs/man/xhtml/glPolygonOffset.xml for more information. More... | |
float | polygonOffsetUnits () const |
Defines the units parameter used to render the lines over the polygons. See also http://www.opengl.org/sdk/docs/man/xhtml/glPolygonOffset.xml for more information. More... | |
Public Member Functions inherited from vl::Renderer | |
Renderer () | |
virtual | ~Renderer () |
const RenderQueue * | renderRaw (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 ProjViewTransfCallback * | projViewTransfCallback () const |
ProjViewTransfCallback * | projViewTransfCallback () |
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 (Framebuffer *framebuffer) |
The Framebuffer on which the rendering is performed. More... | |
const Framebuffer * | framebuffer () const |
The Framebuffer on which the rendering is performed. More... | |
Framebuffer * | framebuffer () |
The Framebuffer on which the rendering is performed. More... | |
Public Member Functions inherited from vl::RendererAbstract | |
RendererAbstract () | |
RendererAbstract & | operator= (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... | |
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 | renderSolids (Camera *camera, real frame_clock) |
void | renderLines (Camera *camera) |
Protected Member Functions inherited from vl::Object | |
virtual | ~Object () |
The EdgeRenderer class implements a special Renderer that automatically extracts and renders the edges of the objects in the scene.
In order to efficiently and transparently render the edges of the objects present in the scene the EdgeRenderer class keeps an internal cache of Geometry and Actor objects that contain the extracted edges. For this reason if the Geometry of an Actor changes or if an Actor is removed from the scene you should call the setActorDirty() method. This way the cached information relative to that Actor will be removed and will be recreated only if/when such Actor becomes visible again. Call the clearCache() method to invalidate the whole cache. In order to minimized the amount of memory used by the cache it is important to keep the cache as clean and up to date as possible. The color used to render the edges can be set globally using the setDefaultLineColor() method or by Actor using the declareActor() method.
Definition at line 55 of file EdgeRenderer.hpp.
|
inline |
Definition at line 69 of file EdgeRenderer.hpp.
|
inline |
Clears the cache containing the Actor and edge information.
Call this function when a significant part of the scene changed or was removed. The cache will be automatically rebuild at the next rendering frames.
Definition at line 84 of file EdgeRenderer.hpp.
|
inline |
The minimum angle (in degrees) considered to generate crease-edges (default is 44 degrees).
Definition at line 104 of file EdgeRenderer.hpp.
Referenced by declareActor().
Generates and caches all the information needed to render the edges of the given Actor using the specified color.
Definition at line 244 of file EdgeRenderer.cpp.
References creaseAngle(), vl::EdgeExtractor::edges(), vl::EdgeExtractor::extractEdges(), vl::EdgeExtractor::generateEdgeGeometry(), vl::ref< T >::get(), mActorCache, NULL, and vl::EdgeExtractor::setCreaseAngle().
Referenced by render().
EdgeRenderer::WFInfo * EdgeRenderer::declareActor | ( | Actor * | act | ) |
Generates and caches all the information needed to render the edges of the given Actor.
Definition at line 272 of file EdgeRenderer.cpp.
References creaseAngle(), vl::EdgeExtractor::edges(), vl::EdgeExtractor::extractEdges(), vl::EdgeExtractor::generateEdgeGeometry(), vl::ref< T >::get(), mActorCache, mDefaultLineColor, NULL, and vl::EdgeExtractor::setCreaseAngle().
|
inline |
Defines the default color of the rendered edges. You can also define a per-Actor color using the declareActor() method.
Definition at line 119 of file EdgeRenderer.hpp.
|
inline |
Defines the width of the rendered edges.
Definition at line 114 of file EdgeRenderer.hpp.
|
inline |
Defines the factor
parameter used to render the lines over the polygons. See also http://www.opengl.org/sdk/docs/man/xhtml/glPolygonOffset.xml for more information.
Definition at line 124 of file EdgeRenderer.hpp.
Referenced by render().
|
inline |
Defines the units
parameter used to render the lines over the polygons. See also http://www.opengl.org/sdk/docs/man/xhtml/glPolygonOffset.xml for more information.
Definition at line 128 of file EdgeRenderer.hpp.
Referenced by render().
|
virtual |
Takes as input the render queue to render and returns a possibly filtered render queue for further processing.
Renderer's implementation of this function always returns in_render_queue
.
Reimplemented from vl::Renderer.
Definition at line 40 of file EdgeRenderer.cpp.
References vl::Viewport::activate(), vl::Framebuffer::activate(), vl::Camera::applyProjMatrix(), vl::RenderQueue::at(), vl::OpenGLContext::bindVAS(), vl::RendererAbstract::clearFlags(), declareActor(), vl::RendererAbstract::dispatchOnRendererFinished(), vl::RendererAbstract::dispatchOnRendererStarted(), vl::RendererAbstract::enableMask(), vl::RendererAbstract::framebuffer(), vl::Renderer::framebuffer(), vl::globalSettings(), vl::RendererAbstract::incrementRenderTick(), vl::Renderer::isEnabled(), vl::RenderToken::mActor, mLineWidth, mVisibleActors, NULL, vl::Framebuffer::openglContext(), polygonOffsetFactor(), polygonOffsetUnits(), renderLines(), renderSolids(), vl::Viewport::setClearFlags(), showHiddenLines(), vl::RenderQueue::size(), smoothLines(), vl::Camera::viewport(), VL_CHECK, and VL_CHECK_OGL.
|
protected |
Definition at line 199 of file EdgeRenderer.cpp.
References vl::Camera::applyViewMatrix(), vl::Renderer::framebuffer(), vl::ref< T >::get(), mVisibleActors, NULL, vl::Framebuffer::openglContext(), vl::Matrix4< T_Scalar >::ptr(), vl::Actor::transform(), vl::Camera::viewMatrix(), and vl::Transform::worldMatrix().
Referenced by render().
|
protected |
Definition at line 150 of file EdgeRenderer.cpp.
References vl::Camera::applyViewMatrix(), vl::Renderer::framebuffer(), vl::ref< T >::get(), vl::Actor::lod(), mVisibleActors, NULL, vl::Framebuffer::openglContext(), vl::Matrix4< T_Scalar >::ptr(), vl::Renderable::render(), showCreases(), vl::Actor::transform(), vl::Camera::viewMatrix(), VL_CHECK, and vl::Transform::worldMatrix().
Referenced by render().
|
inline |
Removes all the edge/rendering information relative to the specified Actor from the cache.
Call this function when an Actor's Geometry changed or when you know that an Actor that was previously visible won't be visible anymore, for example because it has been removed from the scene. Note that if the Actor becomes visible at any point later the cache will be automatically rebuilt.
Definition at line 89 of file EdgeRenderer.hpp.
|
inline |
The minimum angle (in degrees) considered to generate crease-edges (default is 44 degrees).
Definition at line 102 of file EdgeRenderer.hpp.
References vl::degrees().
|
inline |
Defines the default color of the rendered edges. You can also define a per-Actor color using the declareActor() method.
Definition at line 117 of file EdgeRenderer.hpp.
|
inline |
Defines the width of the rendered edges.
Definition at line 112 of file EdgeRenderer.hpp.
|
inline |
Defines the factor
parameter used to render the lines over the polygons. See also http://www.opengl.org/sdk/docs/man/xhtml/glPolygonOffset.xml for more information.
Definition at line 122 of file EdgeRenderer.hpp.
|
inline |
Defines the units
parameter used to render the lines over the polygons. See also http://www.opengl.org/sdk/docs/man/xhtml/glPolygonOffset.xml for more information.
Definition at line 126 of file EdgeRenderer.hpp.
|
inline |
If set to true
shows not only the edges that define the silhouette of an object but also the crease edges.
Definition at line 97 of file EdgeRenderer.hpp.
|
inline |
If set to true
shows also the hidden lines with a dashed pattern.
Definition at line 92 of file EdgeRenderer.hpp.
|
inline |
If set to true
the lines will be rendered using antialiasing.
Definition at line 107 of file EdgeRenderer.hpp.
|
inline |
If set to true
shows not only the edges that define the silhouette of an object but also the crease edges.
Definition at line 99 of file EdgeRenderer.hpp.
Referenced by renderSolids().
|
inline |
If set to true
shows also the hidden lines with a dashed pattern.
Definition at line 94 of file EdgeRenderer.hpp.
Referenced by render().
|
inline |
If set to true
the lines will be rendered using antialiasing.
Definition at line 109 of file EdgeRenderer.hpp.
Referenced by render().
Definition at line 135 of file EdgeRenderer.hpp.
Referenced by declareActor().
|
protected |
Definition at line 141 of file EdgeRenderer.hpp.
|
protected |
Definition at line 137 of file EdgeRenderer.hpp.
Referenced by declareActor().
|
protected |
Definition at line 138 of file EdgeRenderer.hpp.
Referenced by render().
|
protected |
Definition at line 139 of file EdgeRenderer.hpp.
|
protected |
Definition at line 140 of file EdgeRenderer.hpp.
|
protected |
Definition at line 143 of file EdgeRenderer.hpp.
|
protected |
Definition at line 142 of file EdgeRenderer.hpp.
|
protected |
Definition at line 144 of file EdgeRenderer.hpp.
Definition at line 136 of file EdgeRenderer.hpp.
Referenced by render(), renderLines(), and renderSolids().
Visualization Library 2.0.0 Reference Documentation
Updated on Wed Dec 23 2020 12:44:08.
© Copyright Michele Bosi. All rights reserved.