Bullet trunk:
void btCompoundShape::updateChildTransform(int childIndex, const
btTransform& newChildTransform)
{
...
recalculateLocalAabb();
}
...
void btCompoundShape::setLocalScaling(const btVector3& scaling)
{
for(int i = 0; i < m_children.size(); i++)
{
...
updateChildTransform(i, childTrans);
recalculateLocalAabb();
}
m_localScaling = scaling;
}
Note that there's one recalculateLocalAabb at the end of updateChildTransform,
and then another one right after the call to updateChildTransform in
setLocalScaling. The second is obviously superfluous, but, without knowing this
code in and out, it also seems that only a single call to recalculateLocalAabb
is needed at the end of setLocalScaling. This change makes the creation time of
a 5000 shape compound shape go from several seconds to ~0. Resulting code:
void btCompoundShape::updateChildTransform(int childIndex, const
btTransform& newChildTransform, bool shouldRecalculateLocalAabb = true)
{
...
if(shouldRecalculateLocalAabb)
recalculateLocalAabb();
}
...
void btCompoundShape::setLocalScaling(const btVector3& scaling)
{
for(int i = 0; i < m_children.size(); i++)
{
...
updateChildTransform(i, childTrans, false);
}
m_localScaling = scaling;
recalculateLocalAabb();
}
Original issue reported on code.google.com by mirza.ga...@gmail.com on 3 Mar 2011 at 6:11
Original issue reported on code.google.com by
mirza.ga...@gmail.com
on 3 Mar 2011 at 6:11