move CommonTimeWarpBase.h to Evolution/NN3DWalkersTimeWarpBase, it is not a common interface.

This commit is contained in:
erwincoumans
2016-10-22 13:50:08 -07:00
parent dbcb509246
commit 79d9e6b15e
2 changed files with 12 additions and 12 deletions

View File

@@ -29,7 +29,7 @@ struct btCollisionAlgorithmCreateFunc;
class btDefaultCollisionConfiguration; class btDefaultCollisionConfiguration;
class NNWalker; class NNWalker;
#include "../CommonInterfaces/CommonTimeWarpBase.h" #include "NN3DWalkersTimeWarpBase.h"
#include "../CommonInterfaces/CommonParameterInterface.h" #include "../CommonInterfaces/CommonParameterInterface.h"
#include "../Utils/b3ReferenceFrameHelper.hpp" #include "../Utils/b3ReferenceFrameHelper.hpp"
@@ -99,7 +99,7 @@ static btScalar gParallelEvaluations = 10.0f;
void* GROUND_ID = (void*)1; void* GROUND_ID = (void*)1;
class NN3DWalkersExample : public CommonTimeWarpBase class NN3DWalkersExample : public NN3DWalkersTimeWarpBase
{ {
btScalar m_Time; btScalar m_Time;
btScalar m_SpeedupTimestamp; btScalar m_SpeedupTimestamp;
@@ -115,7 +115,7 @@ class NN3DWalkersExample : public CommonTimeWarpBase
public: public:
NN3DWalkersExample(struct GUIHelperInterface* helper) NN3DWalkersExample(struct GUIHelperInterface* helper)
:CommonTimeWarpBase(helper), :NN3DWalkersTimeWarpBase(helper),
m_Time(0), m_Time(0),
m_SpeedupTimestamp(0), m_SpeedupTimestamp(0),
m_motorStrength(0.5f), m_motorStrength(0.5f),
@@ -771,7 +771,7 @@ bool NN3DWalkersExample::keyboardCallback(int key, int state)
break; break;
} }
return CommonTimeWarpBase::keyboardCallback(key,state); return NN3DWalkersTimeWarpBase::keyboardCallback(key,state);
} }
void NN3DWalkersExample::exitPhysics() void NN3DWalkersExample::exitPhysics()

View File

@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.
*/ */
#ifndef COMMON_TIME_WARP_BASE_H #ifndef NN3D_WALKERS_TIME_WARP_BASE_H
#define COMMON_TIME_WARP_BASE_H #define NN3D_WALKERS_TIME_WARP_BASE_H
#include "btBulletDynamicsCommon.h" #include "btBulletDynamicsCommon.h"
#include "LinearMath/btVector3.h" #include "LinearMath/btVector3.h"
@@ -207,9 +207,9 @@ inline void setApplicationTick(float frequency){ // set internal application tic
/** /**
* @link: Gaffer on Games - Fix your timestep: http://gafferongames.com/game-physics/fix-your-timestep/ * @link: Gaffer on Games - Fix your timestep: http://gafferongames.com/game-physics/fix-your-timestep/
*/ */
struct CommonTimeWarpBase: public CommonRigidBodyBase { struct NN3DWalkersTimeWarpBase: public CommonRigidBodyBase {
CommonTimeWarpBase(struct GUIHelperInterface* helper): NN3DWalkersTimeWarpBase(struct GUIHelperInterface* helper):
CommonRigidBodyBase(helper), CommonRigidBodyBase(helper),
mPhysicsStepsPerSecondUpdated(false), mPhysicsStepsPerSecondUpdated(false),
mFramesPerSecondUpdated(false), mFramesPerSecondUpdated(false),
@@ -250,7 +250,7 @@ struct CommonTimeWarpBase: public CommonRigidBodyBase {
mLoopTimer.reset(); mLoopTimer.reset();
} }
~CommonTimeWarpBase(){ ~NN3DWalkersTimeWarpBase(){
} }
@@ -753,7 +753,7 @@ struct CommonTimeWarpBase: public CommonRigidBodyBase {
} }
void performTrueSteps(btScalar timeStep){ // physics stepping without interpolated substeps void performTrueSteps(btScalar timeStep){ // physics stepping without interpolated substeps
int subSteps = round(timeStep / fixedPhysicsStepSizeSec); /**!< Calculate the number of full normal time steps we can take */ int subSteps = floor((timeStep / fixedPhysicsStepSizeSec)+0.5); /**!< Calculate the number of full normal time steps we can take */
for (int i = 0; i < subSteps; i++) { /**!< Perform the number of substeps to reach the timestep*/ for (int i = 0; i < subSteps; i++) { /**!< Perform the number of substeps to reach the timestep*/
if (timeStep && m_dynamicsWorld) { if (timeStep && m_dynamicsWorld) {
@@ -767,7 +767,7 @@ struct CommonTimeWarpBase: public CommonRigidBodyBase {
} }
void performInterpolatedSteps(btScalar timeStep){ // physics stepping with interpolated substeps void performInterpolatedSteps(btScalar timeStep){ // physics stepping with interpolated substeps
int subSteps = 1 + round(timeStep / fixedPhysicsStepSizeSec); /**!< Calculate the number of full normal time steps we can take, plus 1 for safety of not losing time */ int subSteps = 1 + floor((timeStep / fixedPhysicsStepSizeSec)+0.5); /**!< Calculate the number of full normal time steps we can take, plus 1 for safety of not losing time */
if (timeStep && m_dynamicsWorld) { if (timeStep && m_dynamicsWorld) {
m_dynamicsWorld->stepSimulation(btScalar(timeStep), btScalar(subSteps), m_dynamicsWorld->stepSimulation(btScalar(timeStep), btScalar(subSteps),
@@ -899,5 +899,5 @@ struct CommonTimeWarpBase: public CommonRigidBodyBase {
bool mIsHeadless; bool mIsHeadless;
}; };
#endif //COMMON_TIME_WARP_BASE_H #endif //NN3D_WALKERS_TIME_WARP_BASE_H