From 940e753086c6dfbead677535caadcb79172e5218 Mon Sep 17 00:00:00 2001 From: ejcoumans Date: Wed, 18 Oct 2006 04:32:00 +0000 Subject: [PATCH] made demos working for realtime --- Demos/ColladaDemo/ColladaDemo.cpp | 5 ++++- Demos/ConstraintDemo/ConstraintDemo.cpp | 6 ++++-- Demos/ConvexDecompositionDemo/ConvexDecompositionDemo.cpp | 4 +++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Demos/ColladaDemo/ColladaDemo.cpp b/Demos/ColladaDemo/ColladaDemo.cpp index 01d522913..0e7956271 100644 --- a/Demos/ColladaDemo/ColladaDemo.cpp +++ b/Demos/ColladaDemo/ColladaDemo.cpp @@ -188,7 +188,10 @@ void ColladaDemo::clientMoveAndDisplay() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - m_dynamicsWorld->stepSimulation(deltaTime); + float dt = m_clock.getTimeMilliseconds() * 0.001f; + m_clock.reset(); + + m_dynamicsWorld->stepSimulation(dt); renderme(); diff --git a/Demos/ConstraintDemo/ConstraintDemo.cpp b/Demos/ConstraintDemo/ConstraintDemo.cpp index e93c37fa3..a2ba68381 100644 --- a/Demos/ConstraintDemo/ConstraintDemo.cpp +++ b/Demos/ConstraintDemo/ConstraintDemo.cpp @@ -95,9 +95,11 @@ void ConstraintDemo::clientMoveAndDisplay() glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - float deltaTime = 1.f/60.f; + float dt = m_clock.getTimeMilliseconds() * 0.001f; + m_clock.reset(); - m_dynamicsWorld->stepSimulation(deltaTime); + + m_dynamicsWorld->stepSimulation(dt); renderme(); glFlush(); diff --git a/Demos/ConvexDecompositionDemo/ConvexDecompositionDemo.cpp b/Demos/ConvexDecompositionDemo/ConvexDecompositionDemo.cpp index 322354812..e203f1d49 100644 --- a/Demos/ConvexDecompositionDemo/ConvexDecompositionDemo.cpp +++ b/Demos/ConvexDecompositionDemo/ConvexDecompositionDemo.cpp @@ -295,8 +295,10 @@ void ConvexDecompositionDemo::clientMoveAndDisplay() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + float dt = m_clock.getTimeMilliseconds() * 0.001f; + m_clock.reset(); - m_dynamicsWorld->stepSimulation(deltaTime); + m_dynamicsWorld->stepSimulation(dt); renderme();