Hi Paul,

I have considering having a ConstNodeVisitor in the past, it would require
duplication the double dispatch and traverse mechansim in the OSG, so we'd
have to have duplicate Node::accept(NodeVistior) and
Node::accept(ConstNodeVisitor), and Node::traverse(NodeVistior) and
Node::traverse(ConstNodeVisitor) methods in many of the Node subclasses.
The accept can be done with macros, but having a const and non const
traverse method is a bit of burden - means duplicated code, which in turns
means potential for bugs.

Robert.

On 5/9/07, Paul Martz <[EMAIL PROTECTED]> wrote:

 Hi Robert -- I've just discovered I can't run a NodeVisitor from within a
const member function or on a const Node.

I have a custom node that needs to know when the bounding sphere changes
so that it can run a NodeVisitor and compute a bounding box. As far as I
know, the only way my node knows when the bounding sphere changes is to
override computeBound() or add a compute bounding sphere callback. In
either case, my node is const, which prevents me from calling apply() to run
a NodeVisitor to compute the bounding box.

My NodeVisitor doesn't change the structure of the scene graph or alter
any data, it just collects info. So, I'm wondering if we might consider
adding a constApply() method, declared as const, that would allow
NodeVisitors to traverse the scene graph to collect data?

If you have suggestions on how I can resolve this issue, I'd appreciate
it. Perhaps I could compute my bounding box by computing the bounding
sphere, then taking its radius and doing some algebra on it instead of
running a NodeVisitor...

Even if I do find a way to work around this, the concept of a const
NodeVisitor seems like something that would have value.

Paul Martz
*Skew Matrix Software LLC*
http://www.skew-matrix.com
303 859 9466


_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to