[ODE] triangle mesh geometry class

Pawel S unixbird at yahoo.se
Fri Jul 15 16:41:36 MST 2005


Here is what I use. Very plain and simple.

// defs
typedef int tVertIndexTriangle[ 3 ];
typedef double tVertexAsArray[ 3 ];

typedef struct
{
	int m_iNumVerts;
	int m_iNumTris;
	tVertexAsArray* m_pVerts;
	tVertIndexTriangle * m_pTris;
} tTriMesh;


// vars

tTriMesh TerrainMesh;
dTriMeshDataID TerrainMeshDataID;
dGeomID GeomTerrain;


// initialize

// TerrainMesh is filled with data by a ObjectLoader somewhere else
TerrainMeshDataID = dGeomTriMeshDataCreate();
dGeomTriMeshDataBuildDouble(
	TerrainMeshDataID,          // dTriMeshDataID
	TerrainMesh.m_pVerts,       // const void*  a pointer to an array
	                            // holding the vertices
	sizeof( tVertexAsArray ),   // int          how large is the
	                            // memory footprint of one vertex
	TerrainMesh.m_iNumVerts,    // int          how many vertices
	TerrainMesh.m_pTris,        // const void*  a pointer to an array
	                            // holding the indices to vertices
	TerrainMesh.m_iNumTris * 3, // int          how many vertex
	                            // indices total in the mesh
	sizeof( uint ) * 3          // int          how large is the
	                            // memory footprint of an array
	                            // holding the indices to vertices in
	                            // a triangle
);
GeomTerrain = dCreateTriMesh( WorldSpace, TerrainMeshDataID, 0, 0, 0 );


--- e990152 at dee.isep.ipp.pt wrote:

> 
> Does anyone have source code example of how to use the triangle mesh
> geometry
> class ?
> 
> best regards
> Goulart


---
As we enjoy great advantages from inventions of others, we should be
glad of an opportunity to serve others by any invention of ours; and
this we should do freely and generously.
						Benjamin Franklin


More information about the ODE mailing list