From 6bdbe942b17e174e4c0ae2ecef630f6948acdd04 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 16 Dec 2003 23:43:37 +0000 Subject: [PATCH] From Marco Jez, fixes to osgFX so that effects are compiled correctly. Fixed title name of osgkeyboardmouse example. --- examples/osgkeyboardmouse/osgkeyboardmouse.cpp | 2 +- include/osgFX/Validator | 1 + src/osgFX/Effect.cpp | 7 ++++++- src/osgFX/Validator.cpp | 5 +++++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/examples/osgkeyboardmouse/osgkeyboardmouse.cpp b/examples/osgkeyboardmouse/osgkeyboardmouse.cpp index 6bd172cea..194128906 100644 --- a/examples/osgkeyboardmouse/osgkeyboardmouse.cpp +++ b/examples/osgkeyboardmouse/osgkeyboardmouse.cpp @@ -214,7 +214,7 @@ int main( int argc, char **argv ) // create the window to draw to. osg::ref_ptr renderSurface = new Producer::RenderSurface; - renderSurface->setWindowName("osgsimple"); + renderSurface->setWindowName("osgkeyboardmouse"); renderSurface->setWindowRectangle(100,100,800,600); renderSurface->useBorder(true); renderSurface->realize(); diff --git a/include/osgFX/Validator b/include/osgFX/Validator index 9812a0e25..f7ed60bac 100644 --- a/include/osgFX/Validator +++ b/include/osgFX/Validator @@ -45,6 +45,7 @@ namespace osgFX META_StateAttribute(osgFX, Validator, VALIDATOR); void apply(osg::State &state) const; + void compile(osg::State &state) const; inline int compare(const osg::StateAttribute &sa) const; diff --git a/src/osgFX/Effect.cpp b/src/osgFX/Effect.cpp index 931da0f75..4940004cc 100644 --- a/src/osgFX/Effect.cpp +++ b/src/osgFX/Effect.cpp @@ -122,9 +122,14 @@ void Effect::traverse(osg::NodeVisitor &nv) tech = techs_[global_sel_tech_].get(); } - // if we could find an active technique, then continue with traversal + // if we could find an active technique, then continue with traversal, + // else go for default traversal (no effect) if (tech) { tech->traverse(nv, this); + } else { + if (nv.getTraversalMode() == osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) { + inherited_traverse(nv); + } } // wow, we're finished! :) diff --git a/src/osgFX/Validator.cpp b/src/osgFX/Validator.cpp index b44c40aa9..25e941467 100644 --- a/src/osgFX/Validator.cpp +++ b/src/osgFX/Validator.cpp @@ -23,6 +23,11 @@ Validator::Validator(const Validator ©, const osg::CopyOp ©op) { } +void Validator::compile(osg::State &state) const +{ + apply(state); +} + void Validator::apply(osg::State &state) const { if (!effect_) return;