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