]> git.mxchange.org Git - simgear.git/blobdiff - simgear/scene/util/SGStateAttributeVisitor.hxx
hla: Provide a directly property based api for property data element.
[simgear.git] / simgear / scene / util / SGStateAttributeVisitor.hxx
index cd38141375aa5d08b46614d03eaa5aa13a9be6aa..b35747fcdf2e961d01f1943ab2ff0062e479810b 100644 (file)
 #ifndef SG_SCENE_STATEATTRIBUTEVISITOR_HXX
 #define SG_SCENE_STATEATTRIBUTEVISITOR_HXX
 
+#include <osg/Geode>
+#include <osg/Node>
+#include <osg/NodeVisitor>
+#include <osg/StateSet>
+
 class SGStateAttributeVisitor : public osg::NodeVisitor {
 public:
-  SGStateAttributeVisitor() :
-    osg::NodeVisitor(osg::NodeVisitor::NODE_VISITOR,
-                     osg::NodeVisitor::TRAVERSE_ALL_CHILDREN)
-  { }
-
-  virtual void apply(osg::StateSet::RefAttributePair&)
-  { }
-  virtual void apply(osg::StateSet::AttributeList& attrList)
-  {
-    osg::StateSet::AttributeList::iterator i;
-    i = attrList.begin();
-    while (i != attrList.end()) {
-      apply(i->second);
-      ++i;
-    }
-  }
-  virtual void apply(osg::StateSet* stateSet)
-  {
-    if (!stateSet)
-      return;
-    apply(stateSet->getAttributeList());
-  }
-
-  virtual void apply(osg::Node& node)
-  {
-    apply(node.getStateSet());
-    traverse(node);
-  }
-  virtual void apply(osg::Geode& node)
-  {
-    unsigned nDrawables = node.getNumDrawables();
-    for (unsigned i = 0; i < nDrawables; ++i)
-      apply(node.getDrawable(i)->getStateSet());
-    apply(node.getStateSet());
-    traverse(node);
-  }
+  SGStateAttributeVisitor();
+  virtual void apply(osg::StateSet::RefAttributePair&);
+  virtual void apply(osg::StateSet::AttributeList& attrList);
+  virtual void apply(osg::StateSet* stateSet);
+  virtual void apply(osg::Node& node);
+  virtual void apply(osg::Geode& node);
 };
 
 #endif