From Marco Jez, fixes to osgFX so that effects are compiled correctly.

Fixed title name of osgkeyboardmouse example.
This commit is contained in:
Robert Osfield
2003-12-16 23:43:37 +00:00
parent 7fcdf9b82d
commit 6bdbe942b1
4 changed files with 13 additions and 2 deletions

View File

@@ -214,7 +214,7 @@ int main( int argc, char **argv )
// create the window to draw to.
osg::ref_ptr<Producer::RenderSurface> renderSurface = new Producer::RenderSurface;
renderSurface->setWindowName("osgsimple");
renderSurface->setWindowName("osgkeyboardmouse");
renderSurface->setWindowRectangle(100,100,800,600);
renderSurface->useBorder(true);
renderSurface->realize();

View File

@@ -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;

View File

@@ -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! :)

View File

@@ -23,6 +23,11 @@ Validator::Validator(const Validator &copy, const osg::CopyOp &copyop)
{
}
void Validator::compile(osg::State &state) const
{
apply(state);
}
void Validator::apply(osg::State &state) const
{
if (!effect_) return;