fix ForkLiftDemo update (previous commit)
implement preallocate{Vertices,Indices} in btTriangleMesh. Fixes Issue 647.
This commit is contained in:
@@ -507,12 +507,13 @@ void ForkLiftDemo::clientMoveAndDisplay()
|
||||
if (m_idle)
|
||||
dt = 1.0/420.f;
|
||||
|
||||
|
||||
int numSimSteps;
|
||||
numSimSteps = m_dynamicsWorld->stepSimulation(dt,maxSimSubSteps);
|
||||
|
||||
|
||||
//#define VERBOSE_FEEDBACK
|
||||
#ifdef VERBOSE_FEEDBACK
|
||||
int numSimSteps = m_dynamicsWorld->stepSimulation(dt,maxSimSubSteps);
|
||||
if (!numSimSteps)
|
||||
if (!numSimSteps)
|
||||
printf("Interpolated transforms\n");
|
||||
else
|
||||
{
|
||||
|
||||
@@ -138,3 +138,25 @@ int btTriangleMesh::getNumTriangles() const
|
||||
}
|
||||
return m_16bitIndices.size() / 3;
|
||||
}
|
||||
|
||||
void btTriangleMesh::preallocateVertices(int numverts)
|
||||
{
|
||||
if (m_use4componentVertices)
|
||||
{
|
||||
m_4componentVertices.reserve(numverts);
|
||||
} else
|
||||
{
|
||||
m_3componentVertices.reserve(numverts);
|
||||
}
|
||||
}
|
||||
|
||||
void btTriangleMesh::preallocateIndices(int numindices)
|
||||
{
|
||||
if (m_use32bitIndices)
|
||||
{
|
||||
m_32bitIndices.reserve(numindices);
|
||||
} else
|
||||
{
|
||||
m_16bitIndices.reserve(numindices);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,8 +55,8 @@ class btTriangleMesh : public btTriangleIndexVertexArray
|
||||
|
||||
int getNumTriangles() const;
|
||||
|
||||
virtual void preallocateVertices(int numverts){(void) numverts;}
|
||||
virtual void preallocateIndices(int numindices){(void) numindices;}
|
||||
virtual void preallocateVertices(int numverts);
|
||||
virtual void preallocateIndices(int numindices);
|
||||
|
||||
///findOrAddVertex is an internal method, use addTriangle instead
|
||||
int findOrAddVertex(const btVector3& vertex, bool removeDuplicateVertices);
|
||||
|
||||
Reference in New Issue
Block a user