Jump to content
  • Advertisement
Sign in to follow this  
lucky6969b

[Bullet] Adding Static Meshes into btBvhTriangleMeshShape that have more than 65535 indices?

This topic is 543 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello,

For the argument of 3*sizeof(int), why I can't load the Mesh Shape in 16bit format for the index.

If I load the mesh with 32bit index and the mesh has less than 65535 indices, it will overflow the vertex buffer.

I have tried to use 3* sizeof(WORD) as index stride and I can't put (WORD*)pIndexData, because bullet won't recognize the prototype,

Any ideas?

 

Thanks

Jack

 

	indexVertexArrays =
            new btTriangleIndexVertexArray(pMesh->GetNumFaces(),
            (int*)pIndexData, 3 * sizeof(int), pMesh->GetNumVertices(),
            (btScalar*)pVertexData, dwVertexSize);
	        // For non-moving objects only
        staticShape = new btBvhTriangleMeshShape(indexVertexArrays, true);
	
Edited by lucky6969b

Share this post


Link to post
Share on other sites
Advertisement

I was able to create indexed triangle vertex arrays with 16-bit index format in Bullet by calling the 0-argument constructor and specifying the stride manually.

 

            typedef unsigned short IndexFormat;			

            pMesh->m_pTriMesh = new btTriangleIndexVertexArray();

			btIndexedMesh iMesh;
			iMesh.m_numTriangles        = pMesh->m_numFaces;
			iMesh.m_triangleIndexBase   = (const unsigned char *)pMesh->m_pIndices;
			iMesh.m_triangleIndexStride = 3 * sizeof(IndexFormat);
			iMesh.m_numVertices         = pMesh->m_numVertices;
			iMesh.m_vertexBase          = (const unsigned char *)pMesh->m_pVertices;
			iMesh.m_vertexStride        = sizeof(D3DXVECTOR3);
			pMesh->m_pTriMesh->addIndexedMesh( iMesh, PHY_SHORT );

 

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!