Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

osg::StripeGraphOp Class Reference
[Geometry]

#include <OSGStripeGraphOp.h>

Inheritance diagram for osg::StripeGraphOp:

osg::SingleTypeGraphOp< Type > 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)

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< Type >.

Definition at line 68 of file OSGStripeGraphOp.h.

00068 { return "StripeGraphOp"; };

GraphOp * StripeGraphOp::create  )  [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, and FWARNING.

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< Type >.

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             for(UInt32 i = 0; i < t->size(); ++i)
00124             {
00125                 if(t->getValue(i) == GL_TRIANGLE_STRIP)
00126                 {
00127                     return true;
00128                 }
00129             }
00130         }
00131         createSharedIndex(geo);
00132         createOptimizedPrimitives(geo, 1, true, true, 16, false, _stitch);
00133     }
00134     
00135     return true;
00136 }

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

Implements osg::SingleTypeGraphOp< Type >.

Definition at line 138 of file OSGStripeGraphOp.cpp.

00139 {
00140     return true;
00141 }

bool GraphOp::traverse NodePtr root  )  [virtual, inherited]
 

Reimplemented in osg::MakeTransparentGraphOp, osg::MaterialMergeGraphOp, osg::MergeGraphOp, osg::SharePtrGraphOp, osg::SplitGraphOp, and osg::VerifyGraphOp.

Definition at line 94 of file OSGGraphOp.cpp.

References osg::Action::Continue, osg::osgTypedMethodFunctor1ObjPtrCPtrRef(), osg::osgTypedMethodFunctor2ObjPtrCPtrRef(), osg::GraphOp::traverseEnter(), and osg::GraphOp::traverseLeave().

Referenced by osg::VerifyGraphOp::traverse(), osg::MaterialMergeGraphOp::traverse(), and osg::MakeTransparentGraphOp::traverse().

00095 {
00096     Action::ResultE res;
00097     res = ::traverse(node,
00098           osgTypedMethodFunctor1ObjPtrCPtrRef<Action::ResultE,
00099           GraphOp,
00100           NodePtr>(this,&GraphOp::traverseEnter),
00101           osgTypedMethodFunctor2ObjPtrCPtrRef<Action::ResultE,
00102           GraphOp,
00103           NodePtr,
00104           Action::ResultE>(this,&GraphOp::traverseLeave));
00105 
00106     if (res == Action::Continue) 
00107         return true;
00108     else 
00109         return false;
00110 }

const std::string & GraphOp::getName void   )  [inherited]
 

Definition at line 112 of file OSGGraphOp.cpp.

References osg::GraphOp::_name.

Referenced by osg::GraphOpFactory::registerOp(), 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.

00118 {
00119     _name = name;
00120 };

void GraphOp::addToExcludeList 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 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]
 

Definition at line 174 of file OSGGraphOp.cpp.

References osg::getName(), osg::GraphOp::isInExcludeListNames(), and osg::GraphOp::isInExcludeListNodes().

Referenced by osg::MergeGraphOp::processGeometries(), osg::MergeGraphOp::processGroups(), osg::MergeGraphOp::processTransformations(), osg::SplitGraphOp::splitNode(), and osg::SplitGraphOp::traverseLeave().

00175 {
00176     if (isInExcludeListNodes(node) || (OSG::getName(node)!=NULL && isInExcludeListNames(OSG::getName(node))))
00177         return true;
00178     else
00179         return false;
00180 }


Member Data Documentation

bool osg::StripeGraphOp::_force [private]
 

Definition at line 106 of file OSGStripeGraphOp.h.

Referenced by setParams(), and travNodeEnter().

bool osg::StripeGraphOp::_stitch [private]
 

Definition at line 107 of file OSGStripeGraphOp.h.

Referenced by setParams(), and travNodeEnter().

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

Definition at line 161 of file OSGGraphOp.h.

Referenced by osg::GraphOp::addToExcludeList(), osg::GraphOp::clearExcludeList(), osg::GraphOp::isInExcludeListNodes(), osg::MergeGraphOp::mergeOnce(), and osg::GraphOp::removeFromExcludeList().

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

Definition at line 162 of file OSGGraphOp.h.

Referenced by osg::GraphOp::addToExcludeList(), osg::GraphOp::clearExcludeList(), osg::GraphOp::isInExcludeListNames(), and osg::GraphOp::removeFromExcludeList().


The documentation for this class was generated from the following files:
Generated on Thu Aug 25 04:14:12 2005 for OpenSG by  doxygen 1.4.3