mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 16:30:39 +02:00
replace tabs with spaces for indentation
This commit is contained in:
parent
2089a8c2dd
commit
568050686d
1 changed files with 41 additions and 41 deletions
|
@ -27,51 +27,51 @@ ThreadSafeDynamicsWorld::ThreadSafeDynamicsWorld(
|
||||||
: btDiscreteDynamicsWorld(dispatcher, pairCache, constraintSolver, collisionConfiguration) {
|
: btDiscreteDynamicsWorld(dispatcher, pairCache, constraintSolver, collisionConfiguration) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int ThreadSafeDynamicsWorld::stepSimulation( btScalar timeStep, int maxSubSteps, btScalar fixedTimeStep) {
|
int ThreadSafeDynamicsWorld::stepSimulation( btScalar timeStep, int maxSubSteps, btScalar fixedTimeStep) {
|
||||||
BT_PROFILE("stepSimulation");
|
BT_PROFILE("stepSimulation");
|
||||||
int subSteps = 0;
|
int subSteps = 0;
|
||||||
if (maxSubSteps) {
|
if (maxSubSteps) {
|
||||||
//fixed timestep with interpolation
|
//fixed timestep with interpolation
|
||||||
m_fixedTimeStep = fixedTimeStep;
|
m_fixedTimeStep = fixedTimeStep;
|
||||||
m_localTime += timeStep;
|
m_localTime += timeStep;
|
||||||
if (m_localTime >= fixedTimeStep)
|
if (m_localTime >= fixedTimeStep)
|
||||||
{
|
{
|
||||||
subSteps = int( m_localTime / fixedTimeStep);
|
subSteps = int( m_localTime / fixedTimeStep);
|
||||||
m_localTime -= subSteps * fixedTimeStep;
|
m_localTime -= subSteps * fixedTimeStep;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//variable timestep
|
//variable timestep
|
||||||
fixedTimeStep = timeStep;
|
fixedTimeStep = timeStep;
|
||||||
m_localTime = m_latencyMotionStateInterpolation ? 0 : timeStep;
|
m_localTime = m_latencyMotionStateInterpolation ? 0 : timeStep;
|
||||||
m_fixedTimeStep = 0;
|
m_fixedTimeStep = 0;
|
||||||
if (btFuzzyZero(timeStep))
|
if (btFuzzyZero(timeStep))
|
||||||
{
|
{
|
||||||
subSteps = 0;
|
subSteps = 0;
|
||||||
maxSubSteps = 0;
|
maxSubSteps = 0;
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
subSteps = 1;
|
subSteps = 1;
|
||||||
maxSubSteps = 1;
|
maxSubSteps = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*//process some debugging flags
|
/*//process some debugging flags
|
||||||
if (getDebugDrawer()) {
|
if (getDebugDrawer()) {
|
||||||
btIDebugDraw* debugDrawer = getDebugDrawer ();
|
btIDebugDraw* debugDrawer = getDebugDrawer ();
|
||||||
gDisableDeactivation = (debugDrawer->getDebugMode() & btIDebugDraw::DBG_NoDeactivation) != 0;
|
gDisableDeactivation = (debugDrawer->getDebugMode() & btIDebugDraw::DBG_NoDeactivation) != 0;
|
||||||
}*/
|
}*/
|
||||||
if (subSteps) {
|
if (subSteps) {
|
||||||
//clamp the number of substeps, to prevent simulation grinding spiralling down to a halt
|
//clamp the number of substeps, to prevent simulation grinding spiralling down to a halt
|
||||||
int clampedSimulationSteps = (subSteps > maxSubSteps)? maxSubSteps : subSteps;
|
int clampedSimulationSteps = (subSteps > maxSubSteps)? maxSubSteps : subSteps;
|
||||||
|
|
||||||
saveKinematicState(fixedTimeStep*clampedSimulationSteps);
|
saveKinematicState(fixedTimeStep*clampedSimulationSteps);
|
||||||
|
|
||||||
applyGravity();
|
applyGravity();
|
||||||
|
|
||||||
for (int i=0;i<clampedSimulationSteps;i++) {
|
for (int i=0;i<clampedSimulationSteps;i++) {
|
||||||
internalSingleStepSimulation(fixedTimeStep);
|
internalSingleStepSimulation(fixedTimeStep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: We do NOT call synchronizeMotionState() after each substep (to avoid multiple locks on the
|
// NOTE: We do NOT call synchronizeMotionState() after each substep (to avoid multiple locks on the
|
||||||
// object data outside of the physics engine). A consequence of this is that the transforms of the
|
// object data outside of the physics engine). A consequence of this is that the transforms of the
|
||||||
|
@ -80,7 +80,7 @@ int ThreadSafeDynamicsWorld::stepSimulation( btScalar timeStep, int maxSubSteps,
|
||||||
// NOTE: We do NOT call synchronizeMotionStates() here. Instead it is called by an external class
|
// NOTE: We do NOT call synchronizeMotionStates() here. Instead it is called by an external class
|
||||||
// that knows how to lock threads correctly.
|
// that knows how to lock threads correctly.
|
||||||
|
|
||||||
clearForces();
|
clearForces();
|
||||||
|
|
||||||
return subSteps;
|
return subSteps;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue