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 <http://www.skew-matrix.com/> 
303 859 9466
 
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to