Thanks for the info. I think I'm on the right track and have a rough prototype working.
Question: Just from looking at the StateSet::merge() code, it doesn't appear to support the PROTECTED mode -- OVERRIDE for some ancestor state always overrides child state. Is that intentional, or is it something I should fix and submit a patch for? Thanks again, -Paul > HI Paul, > > There isn't a convinience method for getting the current > state inherited down to a node. The CullVisitor doesn't do > it, its actually the draw traversal which does the actual > accumulation of state via the osg::State class. The > Optimizer doesn't do it either. > > To implement it you'll need the a stack of StateSet from root > the drawable leaf. One could try and use osg::State for this > purpose, but it would be inefficient as it'll accumulate all > state not just one particular mode or attribute. > > Robert. > > On 7/26/07, Paul Martz <[EMAIL PROTECTED]> wrote: > > > > > > Hi Robert -- I'm trying to find the best way to get a snapshot of > > current State at any given Node as it is traversed by some > > NodeVisitor. In other words, within apply(Node&) of my custom > > NodeVisitor, I'd like to know if current State would have, > for example, polygon offset enabled or disabled. > > > > This seems like a common enough operation. CullVisitor must > do it, and > > I imagine Optimizer also has a need to track state. Yet > there doesn't > > seem to be a "StateVisitor" that I can use off the shelf > for this purpose. > > > > I see CullVisitor uses the State class internally. This > comes close to > > doing what I need, but it seems more geared towards managing OpenGL > > state, rather than simply tracking OSG state attributes and > modes. (I > > can get the last applied mode, for example, but I'm not applying a > > mode -- no current context > > -- I just want to know what the current mode value is.) > > > > Seems like I can keep a stack of StateSets, and each time I > hit a new > > node, I push a copy onto the top of the stack and StateSet::merge() > > with the new Node's StateSet. Oddly, merge() doesn't appear > to support > > the PROTECTED mode value (is this intentional?). > > > > Another method would be to essentially emulate what State > does: keep a > > stack for each mode and attribute, and push/modify then pop > as appropriate. > > However, I prefer the convenience of using merge(). > > > > Anyhow, I wondered if there was some other mechanism that I wasn't > > aware of or hadn't considered yet. For example, is there > some way to > > get an accumulated StateSet given, say, a NodePath? > > > > Any info would be appreciated. > > > > (Posting at 20:20 UT July 26.) > > > > Paul Martz > > Skew Matrix Software LLC > > http://www.skew-matrix.com > > 303 859 9466 > > > > _______________________________________________ > > osg-users mailing list > > [email protected] > > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph. > > org > > > > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-opensce negraph.org _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

