updated Jamfile, character demo, concave demo

reset for character demo (on space), and local refit of tree
This commit is contained in:
ejcoumans
2008-02-29 21:50:46 +00:00
parent e521a8c8fb
commit b7e3df5bcf
5 changed files with 559 additions and 528 deletions

View File

@@ -406,6 +406,15 @@ void CharacterDemo::displayCallback(void)
void CharacterDemo::clientResetScene() void CharacterDemo::clientResetScene()
{ {
m_dynamicsWorld->getBroadphase()->getOverlappingPairCache()->cleanProxyFromPairs(m_character->getRigidBody()->getBroadphaseHandle(),getDynamicsWorld()->getDispatcher()); m_dynamicsWorld->getBroadphase()->getOverlappingPairCache()->cleanProxyFromPairs(m_character->getRigidBody()->getBroadphaseHandle(),getDynamicsWorld()->getDispatcher());
btTransform startTransform;
startTransform.setIdentity ();
startTransform.setOrigin (btVector3(0.0, 2.0, 0.0));
m_character->getRigidBody()->getMotionState()->setWorldTransform(startTransform);
m_character->getRigidBody()->setLinearVelocity(btVector3(0,0,0));
m_character->getRigidBody()->setAngularVelocity(btVector3(0,0,0));
} }
void CharacterDemo::specialKeyboardUp(int key, int x, int y) void CharacterDemo::specialKeyboardUp(int key, int x, int y)
@@ -466,7 +475,7 @@ void CharacterDemo::specialKeyboard(int key, int x, int y)
gRight = 1; gRight = 1;
} }
break; break;
case GLUT_KEY_END: case GLUT_KEY_F1:
{ {
if (m_character && m_character->canJump()) if (m_character && m_character->canJump())
gJump = 1; gJump = 1;

View File

@@ -49,7 +49,7 @@ class ConcaveDemo : public DemoApplication
public: public:
ConcaveDemo() : m_animatedMesh(false) ConcaveDemo() : m_animatedMesh(true)
{ {
} }

View File

@@ -315,12 +315,33 @@ void ConcaveDemo::clientMoveAndDisplay()
static float offset=0.f; static float offset=0.f;
offset+=0.01f; offset+=0.01f;
setVertexPositions(waveheight,offset); // setVertexPositions(waveheight,offset);
btVector3 worldMin(-1000,-1000,-1000); int i;
btVector3 worldMax(1000,1000,1000); int j;
btVector3 aabbMin(1e30,1e30,1e30);
btVector3 aabbMax(-1e30,-1e30,-1e30);
trimeshShape->refitTree(worldMin,worldMax); for ( i=NUM_VERTS_X/2-3;i<NUM_VERTS_X/2+2;i++)
{
for (j=NUM_VERTS_X/2-3;j<NUM_VERTS_Y/2+2;j++)
{
aabbMax.setMax(gVertices[i+j*NUM_VERTS_X]);
aabbMin.setMin(gVertices[i+j*NUM_VERTS_X]);
gVertices[i+j*NUM_VERTS_X].setValue((i-NUM_VERTS_X*0.5f)*TRIANGLE_SIZE,
//0.f,
waveheight*sinf((float)i+offset)*cosf((float)j+offset),
(j-NUM_VERTS_Y*0.5f)*TRIANGLE_SIZE);
aabbMin.setMin(gVertices[i+j*NUM_VERTS_X]);
aabbMax.setMax(gVertices[i+j*NUM_VERTS_X]);
}
}
trimeshShape->partialRefitTree(aabbMin,aabbMax);
//clear all contact points involving mesh proxy. Note: this is a slow/unoptimized operation. //clear all contact points involving mesh proxy. Note: this is a slow/unoptimized operation.
m_dynamicsWorld->getBroadphase()->getOverlappingPairCache()->cleanProxyFromPairs(staticBody->getBroadphaseHandle(),getDynamicsWorld()->getDispatcher()); m_dynamicsWorld->getBroadphase()->getOverlappingPairCache()->cleanProxyFromPairs(staticBody->getBroadphaseHandle(),getDynamicsWorld()->getDispatcher());

View File

@@ -71,6 +71,7 @@ SubInclude TOP Demos BspDemo ;
SubInclude TOP Demos BasicDemo ; SubInclude TOP Demos BasicDemo ;
SubInclude TOP Demos ConvexDecompositionDemo ; SubInclude TOP Demos ConvexDecompositionDemo ;
SubInclude TOP Demos ColladaDemo ; SubInclude TOP Demos ColladaDemo ;
SubInclude TOP Demos CharacterDemo ;
SubInclude TOP Demos VehicleDemo ; SubInclude TOP Demos VehicleDemo ;
SubInclude TOP Demos CollisionDemo ; SubInclude TOP Demos CollisionDemo ;
SubInclude TOP Demos CollisionInterfaceDemo ; SubInclude TOP Demos CollisionInterfaceDemo ;

View File

@@ -12,7 +12,7 @@ if $(GLUT.AVAILABLE) = "yes"
CFlags bulletopenglsupport : [ FIncludes $(TOP)/Extras/ConvexHull ] CFlags bulletopenglsupport : [ FIncludes $(TOP)/Extras/ConvexHull ]
; ;
MsvcIncDirs $(<) : MsvcIncDirs bulletopenglsupport :
"../../Extras/ConvexHull" ; "../../Extras/ConvexHull" ;
bulletopenglsupport.CFLAGS = [ FIncludes $(TOP)/Extras/ConvexHull ] ; bulletopenglsupport.CFLAGS = [ FIncludes $(TOP)/Extras/ConvexHull ] ;