r19455 to Re-enable vertex welding for soft-bodies failed even on simple cases like a cube with scrambled mesh data.

Please test before committing.

m_vertexArray has no doubles now and is not aligned to 3, using m_triFaceArray to get the verts for each face.
This commit is contained in:
Campbell Barton 2009-03-30 00:40:19 +00:00
parent b182778e71
commit c1b41b20b0

@ -1577,10 +1577,14 @@ btCollisionShape* CcdShapeConstructionInfo::CreateBulletShape()
btTriangleMesh* collisionMeshData = new btTriangleMesh(true,false); btTriangleMesh* collisionMeshData = new btTriangleMesh(true,false);
collisionMeshData->m_weldingThreshold = m_weldingThreshold1; collisionMeshData->m_weldingThreshold = m_weldingThreshold1;
bool removeDuplicateVertices=true; bool removeDuplicateVertices=true;
// m_vertexArray is necessarily a multiple of 3 // m_vertexArray not in multiple of 3 anymore, use m_triFaceArray
for (int i=0;i<m_vertexArray.size(); i+=3 ) for(int i=0; i<m_triFaceArray.size(); i+=3) {
{ collisionMeshData->addTriangle(
collisionMeshData->addTriangle(m_vertexArray[i+2],m_vertexArray[i+1],m_vertexArray[i],removeDuplicateVertices); m_vertexArray[m_triFaceArray[i]],
m_vertexArray[m_triFaceArray[i+1]],
m_vertexArray[m_triFaceArray[i+2]],
removeDuplicateVertices
);
} }
indexVertexArrays = collisionMeshData; indexVertexArrays = collisionMeshData;