Thanks for the explanation. I'm not entirely clear on what you are
after, so will provide some general comments.
First up, in the OSG a parent node is always traversed before
children, so if you stop traversal at a parent none of the children
will be traversed. So if you set the NodeMask of the parent ot 0 then
non of the children will be traversed. So you can't use this to
achieve the result you want.
The osg::Node's NodeMask is a 32bit mask which is and'd against the
NodeVisitor's TraversalMask, for the cull traversal this TraversalMask
is set by the View(er)'s Camera's(inherited from osg::CullSettings)
If the classes of objects you have are limited to 32 different
components then it might be possible to use the NodeMask to toggle
on/off different subgraphs by changing the CullMask. For insrtance
your A, B, C, D etc. classifications could each be mapped to a
separate bit, then your CullMask would set the appropriate bit you
want to see at one time. If possible to use this approach it's really
lightweight and utilizes standard OSG features.
Another approach is to use osg::Switch to toggle on/off different subgrahs.
Another approach is to use a custom osg::Group or NodeCallback that
overrides the traverse implementation and makes it's own judgement on
whether to traverse the children or not. For instance you might have
some global state that tells you want parts you want to see, and this
could global state could be shared between the callbacks/Nodes.
On 27 April 2017 at 06:58, Yura Ivanov <> wrote:
We have scene with a lot of objects (1_Scene.png). Objects that have same name are instances of one object. Instances differ by transform. The count of instances of the same object can be up to 1000. User at a single time must see:
1) all instances of one object (2_C_only.png, 4_F_only.png), or
2) all instances of one object and it's direct children only (3_C_and_1st_level.png).
Read this topic online here:
Post generated by Mail2Forum