Fixes for FPU exceptions, thanks to Phil Knight for reporting and John McCutchan for fix/workarounds.

Added new cluster collision methods for soft bodies, thanks to Nathanael Presson.
Enable/disable textures/shadows for specific demos.
This commit is contained in:
erwin.coumans
2008-08-01 01:04:45 +00:00
parent af4520801b
commit 4894f24c9a
31 changed files with 169 additions and 59 deletions

View File

@@ -231,11 +231,11 @@ btCollisionAlgorithmCreateFunc* btDefaultCollisionConfiguration::getCollisionAlg
if ((proxyType0 == TRIANGLE_SHAPE_PROXYTYPE ) && (proxyType1==SPHERE_SHAPE_PROXYTYPE))
{
return m_triangleSphereCF;
}
}
if ((proxyType0 == BOX_SHAPE_PROXYTYPE) && (proxyType1 == BOX_SHAPE_PROXYTYPE))
{
//return m_boxBoxCF;
return m_boxBoxCF;
}
if (btBroadphaseProxy::isConvex(proxyType0) && (proxyType1 == STATIC_PLANE_PROXYTYPE))

View File

@@ -803,10 +803,10 @@ void btOptimizedBvh::walkStacklessQuantizedTreeAgainstRay(btNodeOverlapCallback*
btVector3 rayDirection = (rayTarget-raySource);
rayDirection.normalize ();
lambda_max = rayDirection.dot(rayTarget-raySource);
///what about division by zero?
rayDirection[0] = btScalar(1.0) / rayDirection[0];
rayDirection[1] = btScalar(1.0) / rayDirection[1];
rayDirection[2] = btScalar(1.0) / rayDirection[2];
///what about division by zero? --> just set rayDirection[i] to 1.0
rayDirection[0] = rayDirection[0] == btScalar(0.0) ? btScalar(1.0) : btScalar(1.0) / rayDirection[0];
rayDirection[1] = rayDirection[1] == btScalar(0.0) ? btScalar(1.0) : btScalar(1.0) / rayDirection[1];
rayDirection[2] = rayDirection[2] == btScalar(0.0) ? btScalar(1.0) : btScalar(1.0) / rayDirection[2];
unsigned int sign[3] = { rayDirection[0] < 0.0, rayDirection[1] < 0.0, rayDirection[2] < 0.0};
#endif
@@ -1365,3 +1365,4 @@ m_bvhQuantization(self.m_bvhQuantization)
}

View File

@@ -901,7 +901,8 @@ if(gjk_status==GJK::eStatus::Valid)
const btVector3 delta= results.witnesses[0]-
results.witnesses[1];
const btScalar length= delta.length();
results.normal = delta/length;
if (length >= SIMD_EPSILON)
results.normal = delta/length;
return(-length);
}
}

View File

@@ -137,7 +137,10 @@ bool btSubsimplexConvexCast::calcTimeOfImpact(
result.m_fraction = lambda;
result.m_normal = n.normalized();
if (n.length2() >= (SIMD_EPSILON*SIMD_EPSILON))
result.m_normal = n.normalized();
else
result.m_normal = btVector3(btScalar(0.0), btScalar(0.0), btScalar(0.0));
//don't report time of impact for motion away from the contact normal (or causes minor penetration)
if (result.m_normal.dot(r)>=-result.m_allowedPenetration)
@@ -151,3 +154,4 @@ bool btSubsimplexConvexCast::calcTimeOfImpact(

View File

@@ -1723,7 +1723,9 @@ void btSoftBody::updateNormals()
}
for(i=0,ni=m_nodes.size();i<ni;++i)
{
m_nodes[i].m_n.normalize();
btScalar len = m_nodes[i].m_n.length();
if (len>SIMD_EPSILON)
m_nodes[i].m_n /= len;
}
}