Hi Diallo, On Wed, Mar 4, 2009 at 10:00 AM, Diallo <[email protected]> wrote: > I need to access to all vertexs of a 3d object loaded as node from a ac3D > file. > I am working on FlightGear Project and we need to integrate a collision > system, so we need to access to every vertex (or triangles) of a given model.
Vertex and primitive data is stored in osg::Geometry leaves on the scene graph, and one model loaded from a format such as ac3d may well have a whole subgraph containing many leaves, including under transforms. This means a single node doesn't directly have vertices or primitives, rather its the root of graph containing leaves that contain the vertices and geometry. To go find the geometry leaves you'll need first to write a custom NodeVisitor, and then once you have located the Geode's that contain the Drawables (Geometry subclasses from Drawable) you either dynamic_cast to Geometry and then access the vertex and primitive data, or use functors to access the data. The use of functors work with all Drawables and enable the automatically decomposition of polygon primitives into triangles making it easier to deal with different types of primitive data. An example of this in action is in the src/osgUtil/IntersectionVisitor.cpp and src/osgUtil/LineSegmentIntersector.cpp. Robert. _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

