some more changes related to PS3 SPU optimizations (16-byte alignment, allowing non-virtual access to data)

This commit is contained in:
ejcoumans
2007-05-25 23:27:49 +00:00
parent 8b453dfd9c
commit eca55afe4d
4 changed files with 60 additions and 29 deletions

View File

@@ -25,6 +25,7 @@ subject to the following restrictions:
class btPolyhedralConvexShape : public btConvexShape
{
protected:
btVector3 m_localAabbMin;
btVector3 m_localAabbMax;
bool m_isLocalAabbValid;
@@ -40,7 +41,38 @@ public:
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia);
inline void getNonvirtualAabb(const btTransform& trans,btVector3& aabbMin,btVector3& aabbMax, btScalar margin) const
{
//lazy evaluation of local aabb
btAssert(m_isLocalAabbValid);
btAssert(m_localAabbMin.getX() <= m_localAabbMax.getX());
btAssert(m_localAabbMin.getY() <= m_localAabbMax.getY());
btAssert(m_localAabbMin.getZ() <= m_localAabbMax.getZ());
btVector3 localHalfExtents = btScalar(0.5)*(m_localAabbMax-m_localAabbMin);
btVector3 localCenter = btScalar(0.5)*(m_localAabbMax+m_localAabbMin);
btMatrix3x3 abs_b = trans.getBasis().absolute();
btPoint3 center = trans(localCenter);
btVector3 extent = btVector3(abs_b[0].dot(localHalfExtents),
abs_b[1].dot(localHalfExtents),
abs_b[2].dot(localHalfExtents));
extent += btVector3(margin,margin,margin);
aabbMin = center - extent;
aabbMax = center + extent;
}
virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
void recalcLocalAabb();
virtual int getNumVertices() const = 0 ;