osg::StripeGraphOp Class Reference
[Geometry]

#include <OSGStripeGraphOp.h>

Inheritance diagram for osg::StripeGraphOp:
osg::SingleTypeGraphOp< Geometry > osg::GraphOp

List of all members.

Public Member Functions

Constructors



 StripeGraphOp (const char *name="Stripe")
GraphOpcreate ()
Destructors



virtual ~StripeGraphOp (void)
Main methods



void setParams (const std::string params)
std::string usage (void)
Main methods



virtual bool traverse (NodePtr &root)
const std::string & getName (void)
void setName (const char *name)
Exclusion



void addToExcludeList (const NodePtr &node)
void addToExcludeList (const std::string &name)
void removeFromExcludeList (NodePtr &node)
void removeFromExcludeList (const std::string &name)
void clearExcludeList (void)
bool isInExcludeListNodes (const NodePtr &node)
bool isInExcludeListNames (const std::string &name)
bool isInExcludeList (NodePtr &node)

Static Public Member Functions

Class Get



static const char * getClassname (void)

Protected Member Functions

bool travNodeEnter (NodePtr node)
bool travNodeLeave (NodePtr node)

Protected Attributes

std::list< NodePtr_excludeListNodes
std::list< std::string > _excludeListNames

Private Attributes

bool _force
bool _stitch

Detailed Description

A base class used to traverse geometries.

Definition at line 59 of file OSGStripeGraphOp.h.


Constructor & Destructor Documentation

StripeGraphOp::StripeGraphOp ( const char *  name = "Stripe"  ) 

Definition at line 71 of file OSGStripeGraphOp.cpp.

Referenced by create().

00071                                             : 
00072     SingleTypeGraphOpGeo(name),
00073     _force(false),
00074     _stitch(false)
00075 {
00076 }

StripeGraphOp::~StripeGraphOp ( void   )  [virtual]

Definition at line 78 of file OSGStripeGraphOp.cpp.

00079 {
00080 }


Member Function Documentation

static const char* osg::StripeGraphOp::getClassname ( void   )  [inline, static]

Reimplemented from osg::SingleTypeGraphOp< Geometry >.

Definition at line 68 of file OSGStripeGraphOp.h.

00068 { return "StripeGraphOp"; };

GraphOp * StripeGraphOp::create ( void   )  [virtual]

Implements osg::GraphOp.

Definition at line 82 of file OSGStripeGraphOp.cpp.

References StripeGraphOp().

00083 {
00084     StripeGraphOp *inst = new StripeGraphOp();
00085     return inst;
00086 }

void StripeGraphOp::setParams ( const std::string  params  )  [virtual]

Implements osg::GraphOp.

Definition at line 88 of file OSGStripeGraphOp.cpp.

References _force, _stitch, FWARNING, and osg::GraphOp::ParamSet::getUnusedParams().

00089 {
00090     ParamSet ps(params);   
00091     
00092     ps("force",  _force);
00093     ps("stitch",  _stitch);
00094     
00095     std::string out = ps.getUnusedParams();
00096     if(out.length())
00097     {
00098         FWARNING(("StripeGraphOp doesn't have parameters '%s'\n.",
00099                 out.c_str()));
00100     }
00101 }

std::string StripeGraphOp::usage ( void   )  [virtual]

Implements osg::GraphOp.

Definition at line 103 of file OSGStripeGraphOp.cpp.

00104 {
00105     return 
00106     "Stripe: Stripe Geometries\n"
00107     "Params: name (type, default)\n"
00108     "  force  (bool, false): force striping even if already striped\n"
00109     "  stitch (bool, false): stitch strips using degenerate triangles\n";
00110 }

bool StripeGraphOp::travNodeEnter ( NodePtr  node  )  [protected, virtual]

Implements osg::SingleTypeGraphOp< Geometry >.

Definition at line 112 of file OSGStripeGraphOp.cpp.

References _force, _stitch, osg::createOptimizedPrimitives(), osg::createSharedIndex(), osg::AttachmentContainerPtr::dcast(), osg::NodePtr::getCore(), and osg::NullFC.

00113 {
00114     GeometryPtr geo = GeometryPtr::dcast(node->getCore());
00115 
00116     if(geo != NullFC)
00117     {
00118         // Check if it's striped already
00119         if (!_force)
00120         {
00121             GeoPTypesPtr t = geo->getTypes();
00122             
00123             if(t != NullFC)
00124             {
00125                 for(UInt32 i = 0; i < t->size(); ++i)
00126                 {
00127                     if(t->getValue(i) == GL_TRIANGLE_STRIP)
00128                     {
00129                         return true;
00130                     }
00131                 }
00132             }
00133         }
00134         createSharedIndex(geo);
00135         createOptimizedPrimitives(geo, 1, true, true, 16, false, _stitch);
00136     }
00137     
00138     return true;
00139 }

bool StripeGraphOp::travNodeLeave ( NodePtr  node  )  [protected, virtual]

Implements osg::SingleTypeGraphOp< Geometry >.

Definition at line 141 of file OSGStripeGraphOp.cpp.

00142 {
00143     return true;
00144 }

bool GraphOp::traverse ( NodePtr root  )  [virtual, inherited]
const std::string & GraphOp::getName ( void   )  [inherited]

Definition at line 112 of file OSGGraphOp.cpp.

References osg::GraphOp::_name.

Referenced by osg::GraphOpFactory::registerOp(), osg::VerifyGraphOp::repairGeometry(), and osg::GraphOpFactory::unRegisterOp().

00113 {
00114     return _name;
00115 };

void GraphOp::setName ( const char *  name  )  [inherited]

Definition at line 117 of file OSGGraphOp.cpp.

References osg::GraphOp::_name.

Referenced by osg::VerifyGraphOp::repairGeometry(), and osg::VerifyGraphOp::traverseEnter().

00118 {
00119     _name = name;
00120 };

void GraphOp::addToExcludeList ( const NodePtr node  )  [inherited]

Definition at line 124 of file OSGGraphOp.cpp.

References osg::GraphOp::_excludeListNodes, and osg::GraphOp::isInExcludeListNodes().

Referenced by osg::MergeGraphOp::excludeListLeave(), and osg::GraphOpSeq::setGraphOps().

00125 {
00126     if (!isInExcludeListNodes(node))
00127         _excludeListNodes.push_back(node);
00128 }

void GraphOp::addToExcludeList ( const std::string &  name  )  [inherited]

Definition at line 130 of file OSGGraphOp.cpp.

References osg::GraphOp::_excludeListNames, and osg::GraphOp::isInExcludeListNames().

00131 {
00132     if (!isInExcludeListNames(name))
00133         _excludeListNames.push_back(name);
00134 }

void GraphOp::removeFromExcludeList ( NodePtr node  )  [inherited]

Definition at line 136 of file OSGGraphOp.cpp.

References osg::GraphOp::_excludeListNodes.

00137 {
00138     _excludeListNodes.remove(node);
00139 }

void GraphOp::removeFromExcludeList ( const std::string &  name  )  [inherited]

Definition at line 141 of file OSGGraphOp.cpp.

References osg::GraphOp::_excludeListNames.

00142 {
00143     _excludeListNames.remove(name);
00144 }

void GraphOp::clearExcludeList ( void   )  [inherited]

Definition at line 146 of file OSGGraphOp.cpp.

References osg::GraphOp::_excludeListNames, and osg::GraphOp::_excludeListNodes.

00147 {
00148     _excludeListNames.clear();
00149     _excludeListNodes.clear();
00150 }

bool GraphOp::isInExcludeListNodes ( const NodePtr node  )  [inherited]

Definition at line 152 of file OSGGraphOp.cpp.

References osg::GraphOp::_excludeListNodes.

Referenced by osg::GraphOp::addToExcludeList(), and osg::GraphOp::isInExcludeList().

00153 {
00154     std::list<NodePtr>::iterator list_iter;
00155     list_iter = std::find(_excludeListNodes.begin(),_excludeListNodes.end(),node);
00156 
00157     if (list_iter==_excludeListNodes.end()) 
00158         return false;
00159     else 
00160         return true;
00161 }

bool GraphOp::isInExcludeListNames ( const std::string &  name  )  [inherited]

Definition at line 163 of file OSGGraphOp.cpp.

References osg::GraphOp::_excludeListNames.

Referenced by osg::GraphOp::addToExcludeList(), and osg::GraphOp::isInExcludeList().

00164 {
00165     std::list<std::string>::iterator namelist_iter;
00166     namelist_iter = std::find(_excludeListNames.begin(),_excludeListNames.end(),name);
00167 
00168     if (namelist_iter==_excludeListNames.end()) 
00169         return false;
00170     else 
00171         return true;
00172 }

bool GraphOp::isInExcludeList ( NodePtr node  )  [inherited]

Member Data Documentation

Definition at line 106 of file OSGStripeGraphOp.h.

Referenced by setParams(), and travNodeEnter().

Definition at line 107 of file OSGStripeGraphOp.h.

Referenced by setParams(), and travNodeEnter().

std::list<NodePtr> osg::GraphOp::_excludeListNodes [protected, inherited]
std::list<std::string> osg::GraphOp::_excludeListNames [protected, inherited]

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

Generated on 8 Feb 2010 for OpenSG by  doxygen 1.6.1