VR-Forces 4.5 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
makVrv::DtSplitBackfacePolyVisitor Class Reference

DtSplitBackfacePolyVisitor identifies two-sided polygons and duplicates the geometry as a set of two single-sided polygons, reversing one set of normals in the process. More...

Inheritance diagram for makVrv::DtSplitBackfacePolyVisitor:
Inheritance graph
[legend]

Public Member Functions

 DtSplitBackfacePolyVisitor (bool transparentOnly=false)
 Default CTOR.
virtual ~DtSplitBackfacePolyVisitor ()
 Virtual DTOR.
virtual void apply (osg::Node &node)
 The Visitor apply method used to traverse the scene-graph.
virtual void apply (osg::Geode &geode)
 The Visitor apply method used to traverse the scene-graph.
void processGeometry ()
 Split the geometry cached within this visitor.
void setTransparentOnly (bool enable)
 Set the visitor to only split transparent polygons, leaving opaque polygons as double sided.
bool transparentOnly () const
 Get whether the visitor is only splitting transparent polygons.

Protected Member Functions

void splitGeometry (osg::Geode &geode) const
 Split the double-sided geometry into two single-sided geometries.
bool isDoubleSided (const osg::Node &node) const
 Check the geode for double-sided polygons.
bool isTransparentMaterial (const osg::StateSet &ss) const
 Check if the material is transparent.
bool isTransparentTextures (const osg::StateSet &ss) const
 Check if any texture is transparent.
osg::CullFace * getOrCreateCullFaceAttribute ()
 Get or create a CullFace attribute.

Protected Attributes

osg::ref_ptr< osg::CullFace > myCullFace
osg::NodeList myGeodes
bool myTransparentOnly

Detailed Description

DtSplitBackfacePolyVisitor identifies two-sided polygons and duplicates the geometry as a set of two single-sided polygons, reversing one set of normals in the process.

This is intended to correct some unintended lighting and transparency artifacts that can occur. This visitor splits both transparent and opaque faces unless told to only split transparent, leaving opaque polygons double sided.

Constructor & Destructor Documentation

makVrv::DtSplitBackfacePolyVisitor::DtSplitBackfacePolyVisitor ( bool  transparentOnly = false)

Default CTOR.

Parameters
[in]transparentOnlyis a flag to only split transparent faces.
virtual makVrv::DtSplitBackfacePolyVisitor::~DtSplitBackfacePolyVisitor ( )
virtual

Virtual DTOR.

Member Function Documentation

virtual void makVrv::DtSplitBackfacePolyVisitor::apply ( osg::Node &  node)
virtual

The Visitor apply method used to traverse the scene-graph.

Parameters
[in]nodeis the osg::Node being visited.
Note
Called during scene-graph traversal, do not directly call this function.
virtual void makVrv::DtSplitBackfacePolyVisitor::apply ( osg::Geode &  geode)
virtual

The Visitor apply method used to traverse the scene-graph.

Parameters
[in]geodeis the osg::Geode being visited.
Note
Called during scene-graph traversal, do not directly call this function.
void makVrv::DtSplitBackfacePolyVisitor::processGeometry ( )

Split the geometry cached within this visitor.

Note
Must be called after traversing the tree.
void makVrv::DtSplitBackfacePolyVisitor::setTransparentOnly ( bool  enable)

Set the visitor to only split transparent polygons, leaving opaque polygons as double sided.

Parameters
[in]enableis a flag to only split transparent faces, default is false.
bool makVrv::DtSplitBackfacePolyVisitor::transparentOnly ( ) const

Get whether the visitor is only splitting transparent polygons.

Return values
truevisitor only splits transparent double-sided polygons.
falsevisitor splits all double-sided polygons.
void makVrv::DtSplitBackfacePolyVisitor::splitGeometry ( osg::Geode &  geode) const
protected

Split the double-sided geometry into two single-sided geometries.

Parameters
[in,out]geodeis the geode who's geometry will be modified.
bool makVrv::DtSplitBackfacePolyVisitor::isDoubleSided ( const osg::Node &  node) const
protected

Check the geode for double-sided polygons.

Parameters
[in]nodeis the node to check.
Return values
trueif geometry has double-sided polygons.
falseotherwise.
bool makVrv::DtSplitBackfacePolyVisitor::isTransparentMaterial ( const osg::StateSet &  ss) const
protected

Check if the material is transparent.

Parameters
[in]ssis the state-set to check for transparency.
Return values
trueif there is transparency.
falseotherwise.
bool makVrv::DtSplitBackfacePolyVisitor::isTransparentTextures ( const osg::StateSet &  ss) const
protected

Check if any texture is transparent.

Parameters
[in]ssis the state-set to check for transparency.
Return values
trueif there is transparency.
falseotherwise.
osg::CullFace* makVrv::DtSplitBackfacePolyVisitor::getOrCreateCullFaceAttribute ( )
protected

Get or create a CullFace attribute.

Returns
a CullFace attribute, creating a new one if necessary.

Member Data Documentation

osg::ref_ptr<osg::CullFace> makVrv::DtSplitBackfacePolyVisitor::myCullFace
protected
osg::NodeList makVrv::DtSplitBackfacePolyVisitor::myGeodes
protected
bool makVrv::DtSplitBackfacePolyVisitor::myTransparentOnly
protected

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

Document ID: Generated on Thu Mar 23 18:54:12 EDT 2017 from SVN revision 174804
Copyright © 2005-2017 VT MÄK. All Rights Reserved (www.mak.com)