Hi Stephane, On Thu, May 22, 2008 at 4:02 PM, Stephane Lamoliatte <[EMAIL PROTECTED]> wrote: > Robert, don't you think this feature could be done by some kind of custom > osgFX::Effect node ?
You could probably write a custom node that overrides the cull callback and post processes/rebuild the StateGraph it's generated. I don't think this is an example of a osgFX::Effect though, such as class might belong in osgFX though. It might still be most efficient to tailor CullVisitor to do the remapping of the StateSet, such as by tweaking the pushStateSet method, that currently looks like: inline void pushStateSet(const osg::StateSet* ss) { _currentStateGraph = _currentStateGraph->find_or_insert(ss); if (_numberOfEncloseOverrideRenderBinDetails==0 && ss->useRenderBinDetails() && !ss->getBinName().empty()) { _currentRenderBin = _currentRenderBin->find_or_insert(ss->getBinNumber(),ss->getBinName()); } if (ss->getRenderBinMode()==osg::StateSet::OVERRIDE_RENDERBIN_DETAILS) { ++_numberOfEncloseOverrideRenderBinDetails; } } One could possible add a check against an internal map of StateSet inside this function. The only draw back to adding this into CullVisitor is that it'd add an extra bool check to see if one needed to do the look up. i.e. inline void pushStateSet(const osg::StateSet* ss) { if (_doStateSetSubstituion) { StateSetMap::iterator itr = _statesetSubsitutionMap.find(ss); if (itr!= _statesetSubsitutionMap.end()) ss = itr->second.get(); } _currentStateGraph = _currentStateGraph->find_or_insert(ss); if (_numberOfEncloseOverrideRenderBinDetails==0 && ss->useRenderBinDetails() && !ss->getBinName().empty()) { _currentRenderBin = _currentRenderBin->find_or_insert(ss->getBinNumber(),ss->getBinName()); } if (ss->getRenderBinMode()==osg::StateSet::OVERRIDE_RENDERBIN_DETAILS) { ++_numberOfEncloseOverrideRenderBinDetails; } } The custom node would then populate the push and pop _statesetSubsitutionMap settings in its cull traversal. Feel free to experiment with such an implementation and it works out send it in to osg-submissions for consideration as part of the core OSG. Robert. _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org