Hi Sonya, Hard-wired casting of objects like you suggest will only work for scene graphs created by loaders is one very specific way and will fail if there is any variation away from this. I would strongly recommend not hard-wiring applications in this way.
The NodeVisitor is designed to make it easy to traverse through the scene graph and apply operations to different types of Nodes. In svn/trunk life is actually a little easier as I've refactored osg::Drawable so it's subclassed from osg::Node so can be directly handled by a NodeVisitor::apply(osg::Geometry&) implementation. NodeVisitor is such a useful tool that it really is one of the pieces of the OSG that all users should master, it simplifies so many tasks, you just need to take the initial steps to learn about it and then it'll be your friend for life. In terms of finding a specific node in the scene graph, there are various means for doing this, the most common is naming a node in the modelling programming and then searching for this named node in the scene graph with your custom NodeVisitor. Robert. On 30 August 2014 07:48, Sonya Blade <[email protected]> wrote: > Dear All, > > Google search reveals that it's been discussed couple of times in the > forum and mailing list, > it 's been mentioned to use the NodeVisitor for that purpose. But isn't > there more direct method > of retriving the geometry data from loaded model? > > Something like that: > osg::ref_ptr<osg::Node> load_nd = > osgDB::readNodeFile("....//Wavefront.obj"); > osg::Geometry* geo = load_nd->asGeode()->getDrawable(0)->asGeometry(); > > Because even if I use the nodeVisitor I have to know exact location of > where geometry is stored > in the loader node. > > Regards, > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > >
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

