Added btUniformScalingShape (including support for debug rendering etc)

This allows to re-use a convex shape, while each instance can re-scale it (with a uniform scalar factor)
This commit is contained in:
ejcoumans
2007-07-28 19:20:45 +00:00
parent 0df4cedc3e
commit 177b6f5ce2
6 changed files with 153 additions and 2 deletions

View File

@@ -38,6 +38,8 @@ subject to the following restrictions:
#include "BulletCollision/CollisionShapes/btCompoundShape.h"
#include "BulletCollision/CollisionShapes/btCapsuleShape.h"
#include "BulletCollision/CollisionShapes/btConvexTriangleMeshShape.h"
#include "BulletCollision/CollisionShapes/btUniformScalingShape.h"
#include "LinearMath/btIDebugDraw.h"
@@ -313,6 +315,23 @@ void GL_ShapeDrawer::drawOpenGL(btScalar* m, const btCollisionShape* shape, cons
glPushMatrix();
btglMultMatrix(m);
if (shape->getShapeType() == UNIFORM_SCALING_SHAPE_PROXYTYPE)
{
const btUniformScalingShape* scalingShape = static_cast<const btUniformScalingShape*>(shape);
const btConvexShape* convexShape = scalingShape->getChildShape();
float scalingFactor = (float)scalingShape->getUniformScalingFactor();
{
btScalar tmpScaling[4][4]={scalingFactor,0,0,0,
0,scalingFactor,0,0,
0,0,scalingFactor,0,
0,0,0,1};
drawOpenGL( (btScalar*)tmpScaling,convexShape,color,debugMode);
}
glPopMatrix();
return;
}
if (shape->getShapeType() == COMPOUND_SHAPE_PROXYTYPE)
{
const btCompoundShape* compoundShape = static_cast<const btCompoundShape*>(shape);