On 17 October 2016 at 15:48, Davide Raccagni <davide.racca...@gmail.com> wrote:
> thanks for your quick reply. If I have well understood, the NameMask allow to
> define up to 32 masks (32 bit). My problem is that I have an unpredictable
> number of layers (in general more than 32): this is the reason why I have
> used DrawableCullCallback. As an alternative you suggest to use Switch: in
> this case I could define a class that extends Switch class and override
> getValue function returning a value in accordance to Layer visibility. What
> do you think about?
You needn't subclass from osg::Switch, you could just subclass from
osg::Group and override the traverse(.) method to provide the decision
about whether to traverse the subgraph or not.
Another approach is manage the switching on/off at a higher level but
use the NodeMask 0x0 or 0xffffffff as the two states for whether to
rendering or not a subgraph.
osg-users mailing list