On 5/3/07, christophe loustaunau <[EMAIL PROTECTED]> wrote:

Hi,

I wan't to modifie the value of some vertex of my scene.

I read a model from a file and store it in a node :

osg::ref_ptr<osg::Node> node (new osg::Node());
node=osgDB::readNodeFile(file);

Then i wan't to change the value of some vertex of that node.
I have made a class with a node visitor :

class Planet : public osg::NodeCallback
{
public:
         ...
         virtual void operator()( osg::Node* node, osg::NodeVisitor* nv )
         {
              // Continue traversing so that OSG can proces/ any other
nodes with callbacks.
              traverse( node, nv );
         }
         ...
}

But now i don't know how to get the array of vertex with this NodeVisitor,
i haven't found any function to do this.

If someone knows how to do this it will be helpfull.
thanks.


Hi Christophe,

In an OSG scene, vertex are stored into geometries (osg::Geometry, derived
from osg::Drawable), and geometries are stored into an osg::Geode (which
derive from osg::Node).

So in your visitor, you have to check if your current node is a Geode, if
yes, you can retrieve the drawables and check if they are geometries, and if
it is the case, you have all the needed methods to modify the vertex into
the osg::Geometry class.

I hope this helps !

--
Serge Lages
http://www.magrathea-engine.org
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to