Fixes for FPU exceptions, thanks to Phil Knight for reporting and John McCutchan for fix/workarounds.
Added new cluster collision methods for soft bodies, thanks to Nathanael Presson. Enable/disable textures/shadows for specific demos.
This commit is contained in:
@@ -70,12 +70,15 @@ struct btDebugCastResult : public btConvexCast::CastResult
|
||||
|
||||
virtual void DebugDraw(btScalar fraction)
|
||||
{
|
||||
btVector3 worldBoundsMin(-1000,-1000,-1000);
|
||||
btVector3 worldBoundsMax(1000,1000,1000);
|
||||
|
||||
|
||||
btScalar m[16];
|
||||
btTransform hitTrans;
|
||||
btTransformUtil::integrateTransform(m_fromTrans,m_linVel,m_angVel,fraction,hitTrans);
|
||||
hitTrans.getOpenGLMatrix(m);
|
||||
m_shapeDrawer->drawOpenGL(m,m_shape,btVector3(1,0,0),btIDebugDraw::DBG_NoDebug);
|
||||
m_shapeDrawer->drawOpenGL(m,m_shape,btVector3(1,0,0),btIDebugDraw::DBG_NoDebug,worldBoundsMin,worldBoundsMax);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -78,6 +78,9 @@ m_shootBoxShape(0),
|
||||
#ifndef BT_NO_PROFILE
|
||||
m_profileIterator = CProfileManager::Get_Iterator();
|
||||
#endif //BT_NO_PROFILE
|
||||
|
||||
m_shapeDrawer.enableTexture(true);
|
||||
m_enableshadows = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -957,11 +960,15 @@ for(int i=0;i<numObjects;i++)
|
||||
wireColor += btVector3 (0.f,0.5f,0.f);
|
||||
}
|
||||
}
|
||||
|
||||
btVector3 aabbMin,aabbMax;
|
||||
m_dynamicsWorld->getBroadphase()->getBroadphaseAabb(aabbMin,aabbMax);
|
||||
|
||||
switch(pass)
|
||||
{
|
||||
case 0: m_shapeDrawer.drawOpenGL(m,colObj->getCollisionShape(),wireColor,getDebugMode());break;
|
||||
case 1: m_shapeDrawer.drawShadow(m,m_sundirection*rot,colObj->getCollisionShape());break;
|
||||
case 2: m_shapeDrawer.drawOpenGL(m,colObj->getCollisionShape(),wireColor*0.3,0);break;
|
||||
case 0: m_shapeDrawer.drawOpenGL(m,colObj->getCollisionShape(),wireColor,getDebugMode(),aabbMin,aabbMax);break;
|
||||
case 1: m_shapeDrawer.drawShadow(m,m_sundirection*rot,colObj->getCollisionShape(),aabbMin,aabbMax);break;
|
||||
case 2: m_shapeDrawer.drawOpenGL(m,colObj->getCollisionShape(),wireColor*0.3,0,aabbMin,aabbMax);break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -360,7 +360,7 @@ GL_ShapeDrawer::ShapeCache* GL_ShapeDrawer::cache(btConvexShape* shape)
|
||||
return(sc);
|
||||
}
|
||||
|
||||
void GL_ShapeDrawer::drawOpenGL(btScalar* m, const btCollisionShape* shape, const btVector3& color,int debugMode)
|
||||
void GL_ShapeDrawer::drawOpenGL(btScalar* m, const btCollisionShape* shape, const btVector3& color,int debugMode,const btVector3& worldBoundsMin,const btVector3& worldBoundsMax)
|
||||
{
|
||||
|
||||
|
||||
@@ -378,7 +378,7 @@ void GL_ShapeDrawer::drawOpenGL(btScalar* m, const btCollisionShape* shape, cons
|
||||
{0,0,scalingFactor,0},
|
||||
{0,0,0,1}};
|
||||
|
||||
drawOpenGL( (btScalar*)tmpScaling,convexShape,color,debugMode);
|
||||
drawOpenGL( (btScalar*)tmpScaling,convexShape,color,debugMode,worldBoundsMin,worldBoundsMax);
|
||||
}
|
||||
glPopMatrix();
|
||||
return;
|
||||
@@ -393,7 +393,7 @@ void GL_ShapeDrawer::drawOpenGL(btScalar* m, const btCollisionShape* shape, cons
|
||||
const btCollisionShape* colShape = compoundShape->getChildShape(i);
|
||||
btScalar childMat[16];
|
||||
childTrans.getOpenGLMatrix(childMat);
|
||||
drawOpenGL(childMat,colShape,color,debugMode);
|
||||
drawOpenGL(childMat,colShape,color,debugMode,worldBoundsMin,worldBoundsMax);
|
||||
}
|
||||
|
||||
} else
|
||||
@@ -447,9 +447,12 @@ void GL_ShapeDrawer::drawOpenGL(btScalar* m, const btCollisionShape* shape, cons
|
||||
{
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glBindTexture(GL_TEXTURE_2D,m_texturehandle);
|
||||
} else
|
||||
{
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
|
||||
|
||||
glColor3f(color.x(),color.y(), color.z());
|
||||
|
||||
bool useWireframeFallback = true;
|
||||
@@ -692,17 +695,11 @@ void GL_ShapeDrawer::drawOpenGL(btScalar* m, const btCollisionShape* shape, cons
|
||||
// if (shape->getShapeType() == TRIANGLE_MESH_SHAPE_PROXYTYPE)
|
||||
{
|
||||
btConcaveShape* concaveMesh = (btConcaveShape*) shape;
|
||||
//btVector3 aabbMax(btScalar(1e30),btScalar(1e30),btScalar(1e30));
|
||||
//btVector3 aabbMax(100,100,100);//btScalar(1e30),btScalar(1e30),btScalar(1e30));
|
||||
|
||||
//todo pass camera, for some culling
|
||||
btVector3 aabbMax(btScalar(1e30),btScalar(1e30),btScalar(1e30));
|
||||
btVector3 aabbMin(-btScalar(1e30),-btScalar(1e30),-btScalar(1e30));
|
||||
|
||||
GlDrawcallback drawCallback;
|
||||
drawCallback.m_wireframe = (debugMode & btIDebugDraw::DBG_DrawWireframe)!=0;
|
||||
|
||||
concaveMesh->processAllTriangles(&drawCallback,aabbMin,aabbMax);
|
||||
concaveMesh->processAllTriangles(&drawCallback,worldBoundsMin,worldBoundsMax);
|
||||
|
||||
}
|
||||
#endif
|
||||
@@ -749,7 +746,7 @@ if(m_textureenabled) glDisable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
//
|
||||
void GL_ShapeDrawer::drawShadow(btScalar* m,const btVector3& extrusion,const btCollisionShape* shape)
|
||||
void GL_ShapeDrawer::drawShadow(btScalar* m,const btVector3& extrusion,const btCollisionShape* shape,const btVector3& worldBoundsMin,const btVector3& worldBoundsMax)
|
||||
{
|
||||
glPushMatrix();
|
||||
btglMultMatrix(m);
|
||||
@@ -762,7 +759,7 @@ void GL_ShapeDrawer::drawShadow(btScalar* m,const btVector3& extrusion,const bt
|
||||
{0,scalingFactor,0,0},
|
||||
{0,0,scalingFactor,0},
|
||||
{0,0,0,1}};
|
||||
drawShadow((btScalar*)tmpScaling,extrusion,convexShape);
|
||||
drawShadow((btScalar*)tmpScaling,extrusion,convexShape,worldBoundsMin,worldBoundsMax);
|
||||
glPopMatrix();
|
||||
return;
|
||||
}
|
||||
@@ -775,7 +772,7 @@ void GL_ShapeDrawer::drawShadow(btScalar* m,const btVector3& extrusion,const bt
|
||||
const btCollisionShape* colShape = compoundShape->getChildShape(i);
|
||||
btScalar childMat[16];
|
||||
childTrans.getOpenGLMatrix(childMat);
|
||||
drawShadow(childMat,extrusion*childTrans.getBasis(),colShape);
|
||||
drawShadow(childMat,extrusion*childTrans.getBasis(),colShape,worldBoundsMin,worldBoundsMax);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -812,17 +809,11 @@ void GL_ShapeDrawer::drawShadow(btScalar* m,const btVector3& extrusion,const bt
|
||||
// if (shape->getShapeType() == TRIANGLE_MESH_SHAPE_PROXYTYPE)
|
||||
{
|
||||
btConcaveShape* concaveMesh = (btConcaveShape*) shape;
|
||||
//btVector3 aabbMax(btScalar(1e30),btScalar(1e30),btScalar(1e30));
|
||||
//btVector3 aabbMax(100,100,100);//btScalar(1e30),btScalar(1e30),btScalar(1e30));
|
||||
|
||||
//todo pass camera, for some culling
|
||||
btVector3 aabbMax(btScalar(1e30),btScalar(1e30),btScalar(1e30));
|
||||
btVector3 aabbMin(-btScalar(1e30),-btScalar(1e30),-btScalar(1e30));
|
||||
|
||||
GlDrawcallback drawCallback;
|
||||
drawCallback.m_wireframe = false;
|
||||
|
||||
concaveMesh->processAllTriangles(&drawCallback,aabbMin,aabbMax);
|
||||
concaveMesh->processAllTriangles(&drawCallback,worldBoundsMin,worldBoundsMax);
|
||||
|
||||
}
|
||||
glPopMatrix();
|
||||
|
||||
@@ -47,8 +47,8 @@ class GL_ShapeDrawer
|
||||
virtual ~GL_ShapeDrawer();
|
||||
|
||||
///drawOpenGL might allocate temporary memoty, stores pointer in shape userpointer
|
||||
void drawOpenGL(btScalar* m, const btCollisionShape* shape, const btVector3& color,int debugMode);
|
||||
void drawShadow(btScalar* m, const btVector3& extrusion,const btCollisionShape* shape);
|
||||
void drawOpenGL(btScalar* m, const btCollisionShape* shape, const btVector3& color,int debugMode,const btVector3& worldBoundsMin,const btVector3& worldBoundsMax);
|
||||
void drawShadow(btScalar* m, const btVector3& extrusion,const btCollisionShape* shape,const btVector3& worldBoundsMin,const btVector3& worldBoundsMax);
|
||||
|
||||
bool enableTexture(bool enable) { bool p=m_textureenabled;m_textureenabled=enable;return(p); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user