Performance optimization for btCompoundShape::setLocalScaling

Thanks to Mirza, See Issue 487

backward compatibility fix for recent improvement in btRaycastVehicle 'rollinfluence'
Thanks to Mihail, See Issue 468
This commit is contained in:
erwin.coumans
2011-03-04 20:16:50 +00:00
parent b167f69ca2
commit fd4ae96697
3 changed files with 11 additions and 6 deletions

View File

@@ -85,7 +85,7 @@ void btCompoundShape::addChildShape(const btTransform& localTransform,btCollisio
}
void btCompoundShape::updateChildTransform(int childIndex, const btTransform& newChildTransform)
void btCompoundShape::updateChildTransform(int childIndex, const btTransform& newChildTransform,bool shouldRecalculateLocalAabb)
{
m_children[childIndex].m_transform = newChildTransform;
@@ -99,7 +99,10 @@ void btCompoundShape::updateChildTransform(int childIndex, const btTransform& ne
m_dynamicAabbTree->update(m_children[childIndex].m_node,bounds);
}
recalculateLocalAabb();
if (shouldRecalculateLocalAabb)
{
recalculateLocalAabb();
}
}
void btCompoundShape::removeChildShapeByIndex(int childShapeIndex)
@@ -283,10 +286,12 @@ void btCompoundShape::setLocalScaling(const btVector3& scaling)
childScale = childScale * scaling / m_localScaling;
m_children[i].m_childShape->setLocalScaling(childScale);
childTrans.setOrigin((childTrans.getOrigin())*scaling);
updateChildTransform(i, childTrans);
recalculateLocalAabb();
updateChildTransform(i, childTrans,false);
}
m_localScaling = scaling;
recalculateLocalAabb();
}