I'm not really sure what you are asking.

You can export any osg data using the .osg plugin.

osgDB::writeNodeFile(*your_node_or_sub_graph,"your_filename.osg")

Then open the file (your_filename.osg) in any text editor and you'll see
your mesh data as Primitives and VertexArrays in Geometrys. The primitives
will be organized/represented based on how the geometry was created in osg.
You can easily write a parser to grab the mesh data from the .osg file.


Brian


[EMAIL PROTECTED] wrote: -----


To: [email protected]
From: "Dusten Sobotta" <[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED]
Date: 10/31/2008 09:49AM
Subject: [osg-users] Computing bullet collision models from .3ds files

I'm developing a 3d engine that will eventually support exporting collision
models from the lowest poly LOD node of a .3ds file for in-game
development.  The following functions can be used to load (or use existing
data in memory) to define the collision box for a .3ds model.



   btTriangleMesh* trimesh = new btTriangleMesh();

   for ( i=0;i<NUM_VERTS_X-1;i++)
   {
      for (int j=0;j<NUM_VERTS_Y-1;j++)
      {
         trimesh->addTriangle(gVertices[j*NUM_VERTS_X+i],gVertices
         [j*NUM_VERTS_X+i+1],gVertices[(j+1)*NUM_VERTS_X+i+1]);
         trimesh->addTriangle(gVertices[j*NUM_VERTS_X+i],gVertices[(j
         +1)*NUM_VERTS_X+i+1],gVertices[(j+1)*NUM_VERTS_X+i]);
      }
   }

   delete[] gVertices;

   bool useQuantizedBvhTree = true;
   btCollisionShape* trimeshShape  = new btBvhTriangleMeshShape
   (trimesh,useQuantizedBvhTree);





OR




   btTriangleIndexVertexArray* indexVertexArrays = new
      btTriangleIndexVertexArray(totalTriangles,
      gIndices,
      indexStride,
      totalVerts,(btScalar*) &gVertices[0].x(),vertStride);

   bool useQuantizedAabbCompression = true;
   trimeshShape  = new btBvhTriangleMeshShape
   (indexVertexArrays,useQuantizedAabbCompression);





I've looked at a lot of the osg functions, and can't seem to find a
function to export the raw triangle mesh.  Do a set of functions exist in
osg to handle this?  If not, -where- should I make my modifications to
support this exportation?


Thanks in advance~
_______________________________________________
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

Reply via email to