Merge pull request #840 from erwincoumans/master

Update fontstash.cpp
This commit is contained in:
erwincoumans
2016-10-22 07:11:39 -07:00
committed by GitHub
4 changed files with 15 additions and 14 deletions

View File

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

View File

@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef COMMON_TIME_WARP_BASE_H
#define COMMON_TIME_WARP_BASE_H
#ifndef NN3D_WALKERS_TIME_WARP_BASE_H
#define NN3D_WALKERS_TIME_WARP_BASE_H
#include "btBulletDynamicsCommon.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/
*/
struct CommonTimeWarpBase: public CommonRigidBodyBase {
struct NN3DWalkersTimeWarpBase: public CommonRigidBodyBase {
CommonTimeWarpBase(struct GUIHelperInterface* helper):
NN3DWalkersTimeWarpBase(struct GUIHelperInterface* helper):
CommonRigidBodyBase(helper),
mPhysicsStepsPerSecondUpdated(false),
mFramesPerSecondUpdated(false),
@@ -250,7 +250,7 @@ struct CommonTimeWarpBase: public CommonRigidBodyBase {
mLoopTimer.reset();
}
~CommonTimeWarpBase(){
~NN3DWalkersTimeWarpBase(){
}
@@ -753,7 +753,7 @@ struct CommonTimeWarpBase: public CommonRigidBodyBase {
}
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*/
if (timeStep && m_dynamicsWorld) {
@@ -767,7 +767,7 @@ struct CommonTimeWarpBase: public CommonRigidBodyBase {
}
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) {
m_dynamicsWorld->stepSimulation(btScalar(timeStep), btScalar(subSteps),
@@ -899,5 +899,5 @@ struct CommonTimeWarpBase: public CommonRigidBodyBase {
bool mIsHeadless;
};
#endif //COMMON_TIME_WARP_BASE_H
#endif //NN3D_WALKERS_TIME_WARP_BASE_H

View File

@@ -133,7 +133,7 @@ SET(ExtendedTutorialsSources
)
SET(BulletExampleBrowser_SRCS
../CommonInterfaces/CommonTimeWarpBase.h #TODO: This is wrong here, where should it go?
../TinyRenderer/geometry.cpp
../TinyRenderer/model.cpp
../TinyRenderer/tgaimage.cpp
@@ -179,6 +179,7 @@ SET(BulletExampleBrowser_SRCS
../Tutorial/Dof6ConstraintTutorial.h
../Evolution/NN3DWalkers.cpp
../Evolution/NN3DWalkers.h
../Evolution/NN3DWalkersTimeWarpBase.h
../ExtendedTutorials/NewtonsRopeCradle.cpp
../ExtendedTutorials/NewtonsRopeCradle.h
../Collision/CollisionSdkC_Api.cpp

View File

@@ -793,7 +793,7 @@ void sth_delete(struct sth_stash* stash)
tex = stash->textures;
while(tex != NULL) {
curtex = tex;
delete tex->m_texels;
free(tex->m_texels);
tex->m_texels=0;
tex = tex->next;
stash->m_renderCallbacks->updateTexture(curtex,0,0,0);