Apple contribution for OSX SSE and iOS NEON optimizations unit tests, thanks to Jordan Hubbard, Ian Ollmann and Hristo Hristov.
For OSX: cd build ./premake_osx xcode4 for iOS: cd build ./ios_build.sh ./ios_run.sh Also integrated the branches/StackAllocation to make it easier to multi-thread collision detection in the near future. It avoids changing the btCollisionObject while performing collision detection. As this is a large patch, some stuff might be temporarily broken, I'll keep an eye out on issues.
This commit is contained in:
@@ -39,10 +39,11 @@ btMultiSphereShape::btMultiSphereShape (const btVector3* positions,const btScala
|
||||
|
||||
}
|
||||
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN( _a, _b) ((_a) < (_b) ? (_a) : (_b))
|
||||
#endif
|
||||
btVector3 btMultiSphereShape::localGetSupportingVertexWithoutMargin(const btVector3& vec0)const
|
||||
{
|
||||
int i;
|
||||
btVector3 supVec(0,0,0);
|
||||
|
||||
btScalar maxDot(btScalar(-BT_LARGE_FLOAT));
|
||||
@@ -66,18 +67,23 @@ btMultiSphereShape::btMultiSphereShape (const btVector3* positions,const btScala
|
||||
const btScalar* rad = &m_radiArray[0];
|
||||
int numSpheres = m_localPositionArray.size();
|
||||
|
||||
for (i=0;i<numSpheres;i++)
|
||||
{
|
||||
vtx = (*pos) +vec*m_localScaling*(*rad) - vec * getMargin();
|
||||
pos++;
|
||||
rad++;
|
||||
newDot = vec.dot(vtx);
|
||||
if (newDot > maxDot)
|
||||
for( int k = 0; k < numSpheres; k+= 128 )
|
||||
{
|
||||
btVector3 temp[128];
|
||||
int inner_count = MIN( numSpheres - k, 128 );
|
||||
for( long i = 0; i < inner_count; i++ )
|
||||
{
|
||||
temp[i] = (*pos) +vec*m_localScaling*(*rad) - vec * getMargin();
|
||||
pos++;
|
||||
rad++;
|
||||
}
|
||||
long i = vec.maxDot( temp, inner_count, newDot);
|
||||
if( newDot > maxDot )
|
||||
{
|
||||
maxDot = newDot;
|
||||
supVec = vtx;
|
||||
supVec = temp[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return supVec;
|
||||
|
||||
@@ -98,18 +104,25 @@ btMultiSphereShape::btMultiSphereShape (const btVector3* positions,const btScala
|
||||
const btVector3* pos = &m_localPositionArray[0];
|
||||
const btScalar* rad = &m_radiArray[0];
|
||||
int numSpheres = m_localPositionArray.size();
|
||||
for (int i=0;i<numSpheres;i++)
|
||||
{
|
||||
vtx = (*pos) +vec*m_localScaling*(*rad) - vec * getMargin();
|
||||
pos++;
|
||||
rad++;
|
||||
newDot = vec.dot(vtx);
|
||||
if (newDot > maxDot)
|
||||
{
|
||||
maxDot = newDot;
|
||||
supportVerticesOut[j] = vtx;
|
||||
}
|
||||
}
|
||||
|
||||
for( int k = 0; k < numSpheres; k+= 128 )
|
||||
{
|
||||
btVector3 temp[128];
|
||||
int inner_count = MIN( numSpheres - k, 128 );
|
||||
for( long i = 0; i < inner_count; i++ )
|
||||
{
|
||||
temp[i] = (*pos) +vec*m_localScaling*(*rad) - vec * getMargin();
|
||||
pos++;
|
||||
rad++;
|
||||
}
|
||||
long i = vec.maxDot( temp, inner_count, newDot);
|
||||
if( newDot > maxDot )
|
||||
{
|
||||
maxDot = newDot;
|
||||
supportVerticesOut[j] = temp[i];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user