[osg-users] Only intersecting certain nodes in the scene graph

Mathieu MARACHE mathieu.marache at gmail.com
Thu Jul 3 10:33:51 PDT 2008


Hi,

I'll pitch in for this one :-)

You need to set the mask of the other nodes by removing the mask of your
visitor.

I tried to explain this with a simplified version of the mask using 4 bits
to a collegue recently. Here it goes :

root_node has 2 children, child_1 and child_2.

my intersection visitor's node mask is like yours set to 0001 (0x1)

child_2 node's mask is set to 0001

0001 : visitor
1111 : root_node
1111 : child_1
0001 : child_2

everybody matches your visitor's mask so everybody get's traversed


now the correct solution would be to set child_1 node mask to the complement
to the visitor's mask (here 1110) and don't touch the child_2's one :

0001 : visitor
1111 : root_node
1110 : child_1
1111 : child_2

now everybody except child_1 gets traversed...

HTH
P.S. Paul beat me into this one, but my explanation will hopefully make it
more visual :-)

2008/7/3 Jason Beverage <jasonbeverage at gmail.com>:

> Hi all,
>
> This is probably a very basic question, but I'm having a hard time
> understanding how the traversal masks work when using an
> IntersectionVisitor.
>
> I have a scene that contains an osgdem generated terrain database as well
> as other nodes such as text labels, lines, etc.  In certain situations, I
> only want to compute the intersections against the terrain database.
>
> I created a node mask for the terrain, 0x1, and used setNodeMask to set it
> on the root node of the terrain database.
>
> I am using the computeIntersections function of Viewer and passed along
> that traversal mask hoping that it would only intersect the paged database.
> However, the computeIntersections function is computing intersections
> against all of the nodes in the scene graph instead of just the paged
> database.
>
> Does this usage sound correct or am I way off base?
>
> Thanks!
>
> Jason
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>


-- 
Mathieu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080703/3bd09b35/attachment-0003.htm>


More information about the osg-users mailing list