Hello Sanat,
Yes, I have the local bounding spheres of each of the child nodes. But I'm
still not clear what I need to do to join all the bounding spheres of the child
nodes for the entire model ?
Please search the archives, this has been discussed before. Actually, if
you have a hierarchy of nodes, the bounding sphere of the root of the
subgraph contains the bounding spheres of all child nodes (thus the
scene graph can test a single bounding sphere and discard a whole
subgraph from rendering if it's outside the view frustum, and if it's
inside or intersecting then it will descend and test the children,
recursively). So you could just use the bounding sphere of your Backhoe
Group if you've added the other models as children of it.
But what you're missing is the transformation of a bounding sphere in
the model's local space into world space. If you have two models that
are loaded from the same file, of course their local bounding spheres
will be identical. It's their parents that will transform them to their
final places in the scene. So when I talk about transforming the
bounding sphere from local space to world space, I mean taking in
account the models' parent transforms up to the root of the graph.
Also, a minor note, in the code you posted you're allocating a Node to
each element, and then loading the models from the file. That's one
unnecessary allocation for each node. For example, this:
Stick = new osg::Node(); // 1
// ...
Stick = osgDB::readNodeFile("_BHStic_.lwo"); // 2
could be replaced by only the last line:
Stick = osgDB::readNodeFile("_BHStic_.lwo");
with the same result, because in your code, a new Node will be allocated
at line 1 above, and then in the assignment at line 2 above that Node
will be deleted.
Hope this helps,
J-S
--
______________________________________________________
Jean-Sebastien Guay jean-sebastien.g...@cm-labs.com
http://www.cm-labs.com/
http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org