Hi Alex,
The scene graph may be a single node or whole hierachy representing
the whole world, so won't can grab a node a get vertex data from it,
what you have to do is traverse the scene graph and when you come
across Geode (the geometry node) do a getDrawable(i) to get its
Drawables. These Drawables are the leaves of the scene graph.
What you need to do is have a look at various examples of
NodeVisitor's that are implemented in around the scene graph, these do
traversal on the scene graph and allow you to easily find all the
Geode's and get access to the Drawables. Do a search through the
scene graph for examples of NodeVisitor. Right now it'll see a bit
bewildering, but stick with it, NodeVisitors will be become your
friend which will help you out all over the place.
Robert.
On 3/8/07, amalric alexandre <[EMAIL PROTECTED]> wrote:
Hi osg-users,
My problem is that I want to add a specific transformation on a model, like
a projection on a another model. So I decided to get each vertex of the
first model and to compute it's intersection on the other model. To do that
I need to access each vertex of my osg::node wich represent my model.
First problem : I don't succeed to cast my osg::node in osg::Drawable
without having a null pointer.
Here is my sample code :
osg::Node* nodeProj = (osg::Node*) sg->getSceneGraphModel(projID);
if (!nodeProj)
return false;
osg::Group* group = nodeModel->asGroup();
osg::Drawable* drawable = dynamic_cast<osg::Drawable*> (group);
ProjectionFunctor pf;
if(drawable)
drawable->accept(pf);
The struct ProjectionFunctor is derived from osg::PrimitiveFunctor like
ComputeBound in Drawable.cpp, and for now it makes nothing because my
drawable is null, and I'm becomming crazy about that.
Is there any better way to get vertex data ??
Thank you all
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/