Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2011-05-11 14:48:17 +0000
committerStijn Buys <ingar@osirion.org>2011-05-11 14:48:17 +0000
commit1c63cbf204b1d2c667ce9f821ccb197d0ffb0ac3 (patch)
treec2d0ff7cc4a8a264657abd0ac99017a5b664ecd2 /src/core/physics.cc
parentbb0f860989f84b901f80017ae0139a3fc0446dc1 (diff)
Review of the main loop timer, converted timers from float to unsigned long,
corrected a number of timing bugs, improved client framerate stability.
Diffstat (limited to 'src/core/physics.cc')
-rw-r--r--src/core/physics.cc14
1 files changed, 3 insertions, 11 deletions
diff --git a/src/core/physics.cc b/src/core/physics.cc
index 90fb184..9ffe13c 100644
--- a/src/core/physics.cc
+++ b/src/core/physics.cc
@@ -15,7 +15,6 @@ namespace core {
btDefaultCollisionConfiguration *Physics::physics_configuration = 0;
btCollisionDispatcher *Physics::physics_dispatcher = 0;
btSequentialImpulseConstraintSolver *Physics::physics_solver = 0;
-unsigned long Physics::physics_timestamp = 0;
void Physics::init()
{
@@ -27,8 +26,6 @@ void Physics::init()
physics_dispatcher = new btCollisionDispatcher(physics_configuration);
btGImpactCollisionAlgorithm::registerAlgorithm(physics_dispatcher);
physics_solver = new btSequentialImpulseConstraintSolver;
-
- physics_timestamp = 0;
}
void Physics::done()
@@ -46,18 +43,13 @@ void Physics::done()
physics_solver = 0;
}
-void Physics::frame(const unsigned long timestamp)
+void Physics::frame(const unsigned long elapsed)
{
- if (!timestamp)
- return;
-
- const float seconds = (float) (timestamp - physics_timestamp) / 1000.0f;
+ const float seconds = (float) elapsed / 1000.0f;
for (core::Zone::Registry::iterator it = core::Zone::registry().begin(); it != core::Zone::registry().end(); it++) {
- (*it).second->physics()->stepSimulation(seconds);
+ (*it).second->physics()->stepSimulation(seconds, 8);
}
-
- physics_timestamp = timestamp;
}
} // namespace core