[osg-users] Understanding node/traversal masks

2008-11-27 Thread Morné Pistorius
Hi guys,

I have a scene setup problem that I am sure is easy to solve with OSG
if someone could help me properly understand the use of node masks.
Consider this scene:

   Root
/\
   /  \
   __/ \__
  /\
DecorateGroupRenderGroup
   \   |
\ /\
 \  ___/  \
  \/\
   \___ PAT Subgraph with more objects
 /\
/  \
   GeodeA GeodeB



I have a group of objects that I want to render, all children of the
RenderGroup.  Some of these objects I want to decorate by drawing the
same geometry with a different stateset that enables cartoon outlines
when I pick it.  Now I want to add a subgraph to this decoration, but
I only want to allow some of the nodes within the subgraph to be
affected by the stateset in DecorateGroup.  For example, if I attach
PositionAttitudeTransform PAT to DecorateGroup, I only want GeodeA to
be decorated.

I think one way would be to protect attributes that are overridden by
the stateset in DecorateGroup, but I don't want to have to do that for
all objects that might be picked. I expect this can be done with node
masks, but I am not sure how to set up a node mask so that GeodeB is
drawn only once when RenderGroup is traversed and not drawn when
DecorateGroup is traversed.

I would be really grateful if someone could explain this to me.

Thanks!
Morne Pistorius
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Understanding node/traversal masks

2008-11-27 Thread Roger James




Morn Pistorius wrote:

  Hi guys,

I have a scene setup problem that I am sure is easy to solve with OSG
if someone could help me properly understand the use of node masks.
Consider this scene:

   Root
/\
   /  \
   __/ \__
  /\
DecorateGroupRenderGroup
   \   |
\ /\
 \  ___/  \
  \/\
   \___ PAT Subgraph with more objects
 /\
/  \
   GeodeA GeodeB



I have a group of objects that I want to render, all children of the
RenderGroup.  Some of these objects I want to decorate by drawing the
same geometry with a different stateset that enables cartoon outlines
when I pick it.  Now I want to add a subgraph to this decoration, but
I only want to allow some of the nodes within the subgraph to be
affected by the stateset in DecorateGroup.  For example, if I attach
PositionAttitudeTransform PAT to DecorateGroup, I only want GeodeA to
be decorated.

I think one way would be to protect attributes that are overridden by
the stateset in DecorateGroup, but I don't want to have to do that for
all objects that might be picked. I expect this can be done with node
masks, but I am not sure how to set up a node mask so that GeodeB is
drawn only once when RenderGroup is traversed and not drawn when
DecorateGroup is traversed.

I would be really grateful if someone could explain this to me.


  

The term node mask NodeMask referred to in the method
osg:Node::setNodeMask and the member varibale osg::Node::-nodeMask can
be a little misleading. It may help you to think of it as a set of flag
bits to which a traversal mask is applied. If doing a bit wise AND of
these flag bits and the current traversal mask results in a non zero
value the node will be processed (traversed) otherwise it will be
ignored along with all its children.

Roger


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org