more compounds work, the basics work. now some stackless tree-tree traversal is needed to speedup compound versus compound.
This commit is contained in:
@@ -54,7 +54,7 @@ subject to the following restrictions:
|
||||
|
||||
float deltaTime = 1.f/60.f;
|
||||
float bulletSpeed = 40.f;
|
||||
bool createConstraint = true;
|
||||
|
||||
#ifdef WIN32
|
||||
#if _MSC_VER >= 1310
|
||||
//only use SIMD Hull code under Win32
|
||||
@@ -89,6 +89,9 @@ extern int glutScreenHeight;
|
||||
const int maxProxies = 32766;
|
||||
const int maxOverlap = 65535;
|
||||
|
||||
bool createConstraint = true;//false;
|
||||
bool useCompound = true;//false;
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
const int numObjects = 20;
|
||||
@@ -124,7 +127,7 @@ CollisionShape* shapePtr[numShapes] =
|
||||
#ifdef USE_GROUND_PLANE
|
||||
new StaticPlaneShape(SimdVector3(0,1,0),10),
|
||||
#else
|
||||
new BoxShape (SimdVector3(450,10,450)),
|
||||
new BoxShape (SimdVector3(50,10,50)),
|
||||
#endif
|
||||
|
||||
new BoxShape (SimdVector3(CUBE_HALF_EXTENTS,CUBE_HALF_EXTENTS,CUBE_HALF_EXTENTS)),
|
||||
@@ -170,7 +173,7 @@ int main(int argc,char** argv)
|
||||
#endif
|
||||
physicsEnvironmentPtr->setDeactivationTime(2.f);
|
||||
|
||||
physicsEnvironmentPtr->setGravity(0,-10,0);
|
||||
physicsEnvironmentPtr->setGravity(0,-10,0);//0,0);//-10,0);
|
||||
PHY_ShapeProps shapeProps;
|
||||
|
||||
shapeProps.m_do_anisotropic = false;
|
||||
@@ -205,13 +208,19 @@ int main(int argc,char** argv)
|
||||
shapeIndex[i] = 0;
|
||||
}
|
||||
|
||||
CompoundShape* compoundShape = new CompoundShape();
|
||||
//shapePtr[1] = compoundShape;
|
||||
if (useCompound)
|
||||
{
|
||||
CompoundShape* compoundShape = new CompoundShape();
|
||||
CollisionShape* oldShape = shapePtr[1];
|
||||
shapePtr[1] = compoundShape;
|
||||
|
||||
SimdTransform ident;
|
||||
ident.setIdentity();
|
||||
|
||||
compoundShape->AddChildShape(ident,new BoxShape (SimdVector3(CUBE_HALF_EXTENTS,CUBE_HALF_EXTENTS,CUBE_HALF_EXTENTS)));
|
||||
SimdTransform ident;
|
||||
ident.setIdentity();
|
||||
ident.setOrigin(SimdVector3(0,0,0));
|
||||
compoundShape->AddChildShape(ident,oldShape);//
|
||||
ident.setOrigin(SimdVector3(0,0,2));
|
||||
compoundShape->AddChildShape(ident,new SphereShape(0.9));//
|
||||
}
|
||||
|
||||
for (i=0;i<numObjects;i++)
|
||||
{
|
||||
@@ -509,11 +518,13 @@ void renderme()
|
||||
ident.setIdentity();
|
||||
ident.getOpenGLMatrix(vec);
|
||||
glPushMatrix();
|
||||
glLoadMatrixf(vec);
|
||||
|
||||
glLoadMatrixf(vec);
|
||||
|
||||
GL_ShapeDrawer::DrawOpenGL(m,physObjects[i]->GetRigidBody()->GetCollisionShape(),wireColor,getDebugMode());
|
||||
|
||||
glPopMatrix();
|
||||
|
||||
///this block is just experimental code to show some internal issues with replacing shapes on the fly.
|
||||
if (getDebugMode()!=0 && (i>0))
|
||||
{
|
||||
@@ -668,6 +679,9 @@ void clientDisplay(void) {
|
||||
|
||||
|
||||
physicsEnvironmentPtr->UpdateAabbs(deltaTime);
|
||||
//draw contactpoints
|
||||
physicsEnvironmentPtr->CallbackTriggers();
|
||||
|
||||
|
||||
renderme();
|
||||
|
||||
|
||||
@@ -51,7 +51,8 @@ void GLDebugDrawer::DrawContactPoint(const SimdVector3& pointOnB,const SimdVecto
|
||||
glVertex3d(from.getX(), from.getY(), from.getZ());
|
||||
glVertex3d(to.getX(), to.getY(), to.getZ());
|
||||
glEnd();
|
||||
|
||||
|
||||
|
||||
glRasterPos3f(from.x(), from.y(), from.z());
|
||||
char buf[12];
|
||||
sprintf(buf," %d",lifeTime);
|
||||
|
||||
@@ -114,7 +114,7 @@ void GL_ShapeDrawer::DrawOpenGL(float* m, const CollisionShape* shape, const Sim
|
||||
if (shape->GetShapeType() == COMPOUND_SHAPE_PROXYTYPE)
|
||||
{
|
||||
const CompoundShape* compoundShape = static_cast<const CompoundShape*>(shape);
|
||||
for (int i=0;i<compoundShape->GetNumChildShapes();i++)
|
||||
for (int i=compoundShape->GetNumChildShapes()-1;i>=0;i--)
|
||||
{
|
||||
SimdTransform childTrans = compoundShape->GetChildTransform(i);
|
||||
const CollisionShape* colShape = compoundShape->GetChildShape(i);
|
||||
@@ -123,16 +123,15 @@ void GL_ShapeDrawer::DrawOpenGL(float* m, const CollisionShape* shape, const Sim
|
||||
DrawOpenGL(childMat,colShape,color,debugMode);
|
||||
}
|
||||
|
||||
return;
|
||||
} else
|
||||
{
|
||||
//DrawCoordSystem();
|
||||
|
||||
glPushMatrix();
|
||||
//glPushMatrix();
|
||||
glEnable(GL_COLOR_MATERIAL);
|
||||
glColor3f(color.x(),color.y(), color.z());
|
||||
|
||||
glRasterPos3f(0.0, 0.0, 0.0);
|
||||
|
||||
|
||||
bool useWireframeFallback = true;
|
||||
|
||||
@@ -268,6 +267,7 @@ void GL_ShapeDrawer::DrawOpenGL(float* m, const CollisionShape* shape, const Sim
|
||||
|
||||
if (debugMode==IDebugDraw::DBG_DrawFeaturesText)
|
||||
{
|
||||
glRasterPos3f(0.0, 0.0, 0.0);
|
||||
BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),polyshape->GetExtraDebugInfo());
|
||||
|
||||
glColor3f(1.f, 1.f, 1.f);
|
||||
@@ -329,7 +329,7 @@ void GL_ShapeDrawer::DrawOpenGL(float* m, const CollisionShape* shape, const Sim
|
||||
|
||||
}
|
||||
|
||||
glDisable(GL_DEPTH_BUFFER_BIT);
|
||||
/*glDisable(GL_DEPTH_BUFFER_BIT);
|
||||
if (debugMode==IDebugDraw::DBG_DrawText)
|
||||
{
|
||||
BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),shape->GetName());
|
||||
@@ -340,7 +340,9 @@ void GL_ShapeDrawer::DrawOpenGL(float* m, const CollisionShape* shape, const Sim
|
||||
BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),shape->GetExtraDebugInfo());
|
||||
}
|
||||
glEnable(GL_DEPTH_BUFFER_BIT);
|
||||
glPopMatrix();
|
||||
*/
|
||||
|
||||
// glPopMatrix();
|
||||
}
|
||||
glPopMatrix();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user