Loading a 50k face object as terrain

Post Reply
lfrodrigues
Posts: 4
Joined: Thu Feb 06, 2014 2:45 pm

Loading a 50k face object as terrain

Post by lfrodrigues »

I need to load a 50k faces object as terrain to simulate a ball rolling on it. Can someone please provide me some pointers on what is the best way to load the object?

The file is in Collada format which means I have a list of vertices and a list of triangles, can I use this information?
bwelch
Posts: 48
Joined: Thu Dec 12, 2013 4:04 pm

Re: Loading a 50k face object as terrain

Post by bwelch »

I've experimented with using a list of vertices and triangles to create a GImpactshape in Bullet. You may be able to find more info on that via a forum search.
Tau
Posts: 25
Joined: Tue May 01, 2012 11:52 am

Re: Loading a 50k face object as terrain

Post by Tau »

If you want heightmap terrain you can use

Code: Select all

btHeightfieldTerrainShape *m_heightfieldShape = new btHeightfieldTerrainShape(x_width, z_height,
					map1d,
					1,
					mapmin, mapmax,
					1, PHY_FLOAT, false);
I'm using this for 2000x2000 heightmaps ~ 8M triangles
or

Code: Select all

        btTriangleMesh* trimesh = new btTriangleMesh();
	for (int i=0; i<mesh->GetNumFaces(); i++)
	{
		btVector3 p1(vecVertices[indexbuffercopy[i*3]].x, vecVertices[indexbuffercopy[i*3]].y, vecVertices[indexbuffercopy[i*3]].z);
		btVector3 p2(vecVertices[indexbuffercopy[i*3+1]].x, vecVertices[indexbuffercopy[i*3+1]].y, vecVertices[indexbuffercopy[i*3+1]].z);
		btVector3 p3(vecVertices[indexbuffercopy[i*3+2]].x, vecVertices[indexbuffercopy[i*3+2]].y, vecVertices[indexbuffercopy[i*3+2]].z);
		trimesh->addTriangle(p1, p2, p3);
	}
	m_colShape = new btBvhTriangleMeshShape(trimesh, true);
I use this for static models like buildings, caves etc.
Post Reply