Hi Jannik,

You changes make sense.  Now that we have NodeVisitor::asCullVisitor() we
can replace the dynamic_cast<osgUtil::CullVisitor*>() so I've adopted this.
the code changes I checked into git master are below.

Cheers,
Robert.

$ git diff
diff --git a/src/osgFX/Technique.cpp b/src/osgFX/Technique.cpp
index 0ca7cc8..1104dad 100644
--- a/src/osgFX/Technique.cpp
+++ b/src/osgFX/Technique.cpp
@@ -42,28 +42,30 @@ void
Technique::traverse_implementation(osg::NodeVisitor& nv, Effect* fx)
     }

     // special actions must be taken if the node visitor is actually a
CullVisitor
-    osgUtil::CullVisitor *cv = nv.asCullVisitor();
-
-    // traverse all passes
-    for (int i=0; i<getNumPasses(); ++i) {
-
-        // push the i-th pass' StateSet if necessary
-        if (cv) {
+    osgUtil::CullVisitor* cv = nv.asCullVisitor();
+    if (cv)
+    {
+        // traverse all passes
+        for (int i=0; i<getNumPasses(); ++i)
+        {
+            // push the i-th pass' StateSet
             cv->pushStateSet(_passes[i].get());
-        }

-        // traverse the override node if defined, otherwise
-        // traverse children as a Group would do
-        osg::Node *override = getOverrideChild(i);
-        if (override) {
-            override->accept(nv);
-        } else {
-            fx->inherited_traverse(nv);
-        }
+            // traverse the override node if defined, otherwise
+            // traverse children as a Group would do
+            osg::Node *override = getOverrideChild(i);
+            if (override) {
+                override->accept(nv);
+            } else {
+                fx->inherited_traverse(nv);
+            }

-        // pop the StateSet if necessary
-        if (cv) {
+            // pop the StateSet
             cv->popStateSet();
         }
     }
+    else
+    {
+        fx->inherited_traverse(nv);
+    }
 }
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to