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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user