Sanat Talmaki wrote:
Hi,
I am having trouble figuring out how I can get the list of triangles (vertices)
that make up an osg object to use in another algorithm that needs a list of
triangle vertices that make up the model. (I have seen the models I intend to
use in osgviewer using the 'w' key and they are made up of only triangles.
So if I am using either a .osg model or a model loaded through osgDB::readNodeFile(...), I would like to store in memory the list as above.
I was hoping to get some tips on how I can start approaching this. (I hope I
have been able to explain my problem clearly enough)
Have you considered using TriangleFunctor? Wrapped in a NodeVisitor with support
for apply(Drawable&), this would give you a list of all triangles. It's used all
over the place in OSG; see, for example, ReaderWriterSTL.cpp.
I'm about to write some code that needs to convert tri strips and fans to
triangles, and I figured I'd use TriangleFunctor for that task.
If you just need the list of vertices, then one very simple way to do it would
be to copy all the vertex arrays, though this risks including unused vertices
(if they exist). The OpenFlight exporter does this.
--
-Paul Martz Skew Matrix Software
http://www.skew-matrix.com/
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org