git-svn-id: https://reactphysics3d.googlecode.com/svn/trunk@329 92aac97c-a6ce-11dd-a772-7fcde58d38e6

This commit is contained in:
chappuis.daniel 2010-06-08 21:03:35 +00:00
parent 99de21bcaa
commit f2beab0fcf
3 changed files with 221 additions and 223 deletions

View File

@ -29,7 +29,7 @@ using namespace reactphysics3d;
// Constructor of the class Context
Context::Context() {
Cube* cube1 = new Cube(Vector3D(11.0,14.0, 4.0), Quaternion(1.0, 1.0, 0.0, 0.0), 4.0, Kilogram(3.0));
Cube* cube1 = new Cube(Vector3D(5.0,14.0, 4.0), Quaternion(1.0, 1.0, 0.0, 0.0), 4.0, Kilogram(3.0));
cube1->getRigidBody()->setLinearVelocity(Vector3D(0.0, -5.0, 0.0));
//Cube* cube2 = new Cube(Vector3D(0.0, 17, 8.0), Quaternion(0.0, 1.0, 0.0, 0.0), 3.0, Kilogram(2.0));

View File

@ -108,14 +108,14 @@ void Scene::display(const Context& context) const {
glPushMatrix();
// Draw the bounding volume
context.getObject(i).getRigidBody()->getOBB().draw();
context.getObject(i).getRigidBody()->getOBB()->draw();
// Remove the matrix on the top of the matrix stack
glPopMatrix();
}
// Draw all the contact points
for (std::vector<Constraint*>::const_iterator it = world->getConstraintListStartIterator(); it != world->getConstraintListEndIterator(); ++it) {
for (std::vector<Constraint*>::iterator it = world->getConstraintsBeginIterator(); it != world->getConstraintsEndIterator(); ++it) {
RigidBody* rigidBody1 = dynamic_cast<RigidBody*>((*it)->getBody1());
RigidBody* rigidBody2 = dynamic_cast<RigidBody*>((*it)->getBody2());
rigidBody1->setIsMotionEnabled(false);
@ -125,13 +125,11 @@ void Scene::display(const Context& context) const {
assert(contact != 0);
// Draw the contact points
for (unsigned int i=0; i<contact->getPoints().size(); ++i) {
glPushMatrix();
glTranslatef(contact->getPoints()[i].getX(), contact->getPoints()[i].getY(), contact->getPoints()[i].getZ());
glTranslatef(contact->getPoint().getX(), contact->getPoint().getY(), contact->getPoint().getZ());
contact->draw();
glPopMatrix();
}
}
// Change the buffers
SDL_GL_SwapBuffers();

View File

@ -84,7 +84,7 @@ void Simulation::start() {
pEngine->updateDisplayTime(Time(time));
// Update the physics
pEngine->update();
pEngine->updateCollision();
// Display the actual scene
scene.display(context);