Visualization Library

A lightweight C++ OpenGL middleware for 2D/3D graphics
[Home] [Tutorials] [All Classes] [Grouped Classes]

vl::EdgeRenderer Class Reference

The EdgeRenderer class implements a special Renderer that automatically extracts and renders the edges of the objects in the scene. More...

#include <EdgeRenderer.hpp>

Inheritance diagram for vl::EdgeRenderer:

vl::Renderer vl::Object

List of all members.

Classes

class  WFInfo

Public Member Functions

virtual const char * className ()
 Returns the name of the class.
 EdgeRenderer ()
void render (const RenderQueue *render_queue, Camera *camera)
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.
WFInfo * declareActor (Actor *act)
 Generates and caches all the information needed to render the edges of the given Actor.
void clearCache ()
 Clears the cache containing the Actor and edge information.
void setActorDirty (Actor *actor)
 Removes all the edge/rendering information relative to the specified Actor from the cache.
void setShowHiddenLines (bool show)
 If set to true shows also the hidden lines with a dashed pattern.
bool showHiddenLines () const
 If set to true shows also the hidden lines with a dashed pattern.
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.
bool showCreases () const
 If set to true shows not only the edges that define the silhouette of an object but also the crease edges.
void setCreaseAngle (float degrees)
 The minimum angle (in degrees) considered to generate crease-edges (default is 44 degrees).
float creaseAngle () const
 The minimum angle (in degrees) considered to generate crease-edges (default is 44 degrees).
void setSmoothLines (bool smooth)
 If set to true the lines will be rendered using antialiasing.
bool smoothLines () const
 If set to true the lines will be rendered using antialiasing.
void setLineWidth (float width)
 Defines the width of the rendered edges.
float lineWidth () const
 Defines the width of the rendered edges.
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.
const fvec4defaultLineColor () const
 Defines the default color of the rendered edges. You can also define a per-Actor color using the declareActor() method.
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.
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.
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.
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.

Protected Member Functions

void updateActorCache (const RenderQueue *render_queue)
void renderSolids (Camera *camera)
void renderLines (Camera *camera)

Protected Attributes

std::map< ref< Actor >, ref
< WFInfo > > 
mActorCache
std::map< ref< Actor >, ref
< WFInfo > > 
mVisibleActors
fvec4 mDefaultLineColor
float mLineWidth
float mPolygonOffsetFactor
float mPolygonOffsetUnits
float mCreaseAngle
bool mShowHiddenLines
bool mShowCreases
bool mSmoothLines


Detailed Description

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.

See also:

Constructor & Destructor Documentation

vl::EdgeRenderer::EdgeRenderer (  )  [inline]


Member Function Documentation

virtual const char* vl::EdgeRenderer::className (  )  [inline, virtual]

Returns the name of the class.

Reimplemented from vl::Renderer.

void EdgeRenderer::render ( const RenderQueue render_queue,
Camera camera 
) [virtual]

Reimplemented from vl::Renderer.

EdgeRenderer::WFInfo * EdgeRenderer::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.

EdgeRenderer::WFInfo * EdgeRenderer::declareActor ( Actor act  ) 

Generates and caches all the information needed to render the edges of the given Actor.

void vl::EdgeRenderer::clearCache (  )  [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.

void vl::EdgeRenderer::setActorDirty ( Actor actor  )  [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.

void vl::EdgeRenderer::setShowHiddenLines ( bool  show  )  [inline]

If set to true shows also the hidden lines with a dashed pattern.

bool vl::EdgeRenderer::showHiddenLines (  )  const [inline]

If set to true shows also the hidden lines with a dashed pattern.

void vl::EdgeRenderer::setShowCreases ( bool  show  )  [inline]

If set to true shows not only the edges that define the silhouette of an object but also the crease edges.

bool vl::EdgeRenderer::showCreases (  )  const [inline]

If set to true shows not only the edges that define the silhouette of an object but also the crease edges.

void vl::EdgeRenderer::setCreaseAngle ( float  degrees  )  [inline]

The minimum angle (in degrees) considered to generate crease-edges (default is 44 degrees).

float vl::EdgeRenderer::creaseAngle (  )  const [inline]

The minimum angle (in degrees) considered to generate crease-edges (default is 44 degrees).

void vl::EdgeRenderer::setSmoothLines ( bool  smooth  )  [inline]

If set to true the lines will be rendered using antialiasing.

bool vl::EdgeRenderer::smoothLines (  )  const [inline]

If set to true the lines will be rendered using antialiasing.

void vl::EdgeRenderer::setLineWidth ( float  width  )  [inline]

Defines the width of the rendered edges.

float vl::EdgeRenderer::lineWidth (  )  const [inline]

Defines the width of the rendered edges.

void vl::EdgeRenderer::setDefaultLineColor ( const fvec4 c  )  [inline]

Defines the default color of the rendered edges. You can also define a per-Actor color using the declareActor() method.

const fvec4& vl::EdgeRenderer::defaultLineColor (  )  const [inline]

Defines the default color of the rendered edges. You can also define a per-Actor color using the declareActor() method.

void vl::EdgeRenderer::setPolygonOffsetFactor ( float  factor  )  [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.

float vl::EdgeRenderer::polygonOffsetFactor (  )  const [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.

void vl::EdgeRenderer::setPolygonOffsetUnits ( float  units  )  [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.

float vl::EdgeRenderer::polygonOffsetUnits (  )  const [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.

void EdgeRenderer::updateActorCache ( const RenderQueue render_queue  )  [protected]

void EdgeRenderer::renderSolids ( Camera camera  )  [protected]

void EdgeRenderer::renderLines ( Camera camera  )  [protected]


Member Data Documentation

std::map< ref<Actor>, ref<WFInfo> > vl::EdgeRenderer::mActorCache [protected]

std::map< ref<Actor>, ref<WFInfo> > vl::EdgeRenderer::mVisibleActors [protected]

float vl::EdgeRenderer::mLineWidth [protected]

float vl::EdgeRenderer::mCreaseAngle [protected]


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

Visualization Library v2010.06 Reference Documentation
Copyright 2005-2009 Michele Bosi. All rights reserved.
Updated on Tue Jun 1 00:57:14 2010.
Permission is granted to use this page to write and publish articles regarding Visualization Library.