Hi Mark On 6/8/07, Mark Hurry <[EMAIL PROTECTED]> wrote:
Hi, I need some advice on whether it is possible to switch nodes on and off within an instanced model on the fly 1) The model is loaded only once but is instanced a number of times 2) Each instance of the model may require different nodes switched on and off. 3) Having each instance inherit whatever nodes have been switched on/off by another instance is *not* acceptable I have gone through the tutorials and examples but have not seen anything that cover this. Any suggestions or pointers in the right direction would be much appreciated, I as I have hit a brickwall with this problem
I'd clone the rootnode (or as early in the subtree as possible) while keeping the statesets and subnodes of the original model (unless you want to modify the statesets on the fly too, in which case they should also be duplicated). Use the osg::CopyOp members to tell the OSG what you want to duplicate in your clones, and what you want to share. The basic rule is that each parameter that is going to differ from instance to instance should be copied. e.g. for a very simple model with osg::Switch containing n geodes that you want to be able to switch on/off, you only have to duplicate the switch. The geodes can be shared by all switches. Note that this won't work if you use a group and setNodeMask() on the geodes, precisely because they are shared. (hence the usefulness of the switch against the group). Thibault
_______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
