Hi Mukund,

It seems like you aren't trying to use the scene graph the way that
scene graphs work - you use decoration of nodes to add behaviors such
as transforms.  So in your case you simply add the Geode to the
MarixTransform node and then the geode and all it's children then are
transformed by it.  There isn't any need for sub-classing, the scene
graph can do everything you need out of the box.   See the
osganimation example to see how it works in practice.

Now, if you really wanted to create a custom node that made management
of your own data easier for the specifics of your application then you
could do this, but it's more work and you'll need to understand more
about the low level mechanisms that the OSG provides.  The
osg::Billboard example is an example that subclasses from osg::Geode
and decorates it's Drawable children with an individual transform that
is computed on the fly to position the drawables appropriate according
to the Billboard settings.

Potentially you could follow this approach, but as the CullVisitor
doesn't know about your custom Geode you can't rely upon the
CullVisitor knowing about the special nature of your custom node like
it can with Billboard (there is a CullVistior::apply(Billboard)) so
you'll need to compute the modelview matrix for each drawable and pass
this to the CullVisitor along with the drawable.

Going this approach is initially more complicated than just using the
OSG classes out of the box, and the saving longer term might not be
that much either so please make sure you really need to this subclass
before heading off trying to do stuff that isn't essential.

Robert.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to