Added better support for btUniformScalingShape, by moving some data that is not shared from btConvexShape to btConvexInternalShape. This reduces the sizeof btUniformScalingShape to 16 bytes (from 64).

This is good when having lots of re-used shapes with different sizes.

Convex shapes will need to derive from btConvexInternalShape (which is a subclass of btConvexShape). We could have renamed btConvexShape to 'btConvexShapeInterface' (can still do that later)
This commit is contained in:
ejcoumans
2007-07-28 21:10:21 +00:00
parent 177b6f5ce2
commit 38b7f474c3
14 changed files with 294 additions and 146 deletions

View File

@@ -16,11 +16,11 @@ subject to the following restrictions:
#ifndef SPHERE_MINKOWSKI_H
#define SPHERE_MINKOWSKI_H
#include "btConvexShape.h"
#include "btConvexInternalShape.h"
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" // for the types
///btSphereShape implements an implicit (getSupportingVertex) Sphere
ATTRIBUTE_ALIGNED16(class) btSphereShape : public btConvexShape
ATTRIBUTE_ALIGNED16(class) btSphereShape : public btConvexInternalShape
{
@@ -47,13 +47,13 @@ public:
virtual void setMargin(btScalar margin)
{
btConvexShape::setMargin(margin);
btConvexInternalShape::setMargin(margin);
}
virtual btScalar getMargin() const
{
//to improve gjk behaviour, use radius+margin as the full margin, so never get into the penetration case
//this means, non-uniform scaling is not supported anymore
return m_localScaling.getX() * getRadius() + btConvexShape::getMargin();
return m_localScaling.getX() * getRadius() + btConvexInternalShape::getMargin();
}