diff --git a/Demos/DX11ClothDemo/cloth_renderer.cpp b/Demos/DX11ClothDemo/cloth_renderer.cpp index a5c95e51c..29221bde1 100644 --- a/Demos/DX11ClothDemo/cloth_renderer.cpp +++ b/Demos/DX11ClothDemo/cloth_renderer.cpp @@ -1134,7 +1134,10 @@ HRESULT CALLBACK OnD3D11ResizedSwapChain( ID3D11Device* pd3dDevice, IDXGISwapCha } +#ifndef BT_NO_PROFILE btClock m_clock; +#endif //BT_NO_PROFILE + //-------------------------------------------------------------------------------------- // Render the scene using the D3D11 device //-------------------------------------------------------------------------------------- @@ -1146,8 +1149,12 @@ void CALLBACK OnD3D11FrameRender( ID3D11Device* pd3dDevice, ID3D11DeviceContext* //float ms = getDeltaTimeMicroseconds(); +#ifndef BT_NO_PROFILE btScalar dt = (btScalar)m_clock.getTimeMicroseconds(); m_clock.reset(); +#else + btScalar dt = 1000000.f/60.f; +#endif //BT_NO_PROFILE ///step the simulation if (m_dynamicsWorld && !paused) diff --git a/Demos/OpenCLClothDemo/cl_cloth_demo.cpp b/Demos/OpenCLClothDemo/cl_cloth_demo.cpp index b7e22c714..dacf58f70 100644 --- a/Demos/OpenCLClothDemo/cl_cloth_demo.cpp +++ b/Demos/OpenCLClothDemo/cl_cloth_demo.cpp @@ -400,14 +400,19 @@ void initBullet(void) - +#ifndef BT_NO_PROFILE btClock m_clock; +#endif //BT_NO_PROFILE void doFlags() { //float ms = getDeltaTimeMicroseconds(); +#ifndef BT_NO_PROFILE btScalar dt = (btScalar)m_clock.getTimeMicroseconds(); m_clock.reset(); +#else + btScalar dt = 1000000.f/60.f; +#endif ///step the simulation if( m_dynamicsWorld ) @@ -418,7 +423,9 @@ void doFlags() if (frameCount==100) { m_dynamicsWorld->stepSimulation(1./60.,0); +#ifndef BT_NO_PROFILE CProfileManager::dumpAll(); +#endif //BT_NO_PROFILE } updatePhysicsWorld(); } diff --git a/src/LinearMath/btQuickprof.h b/src/LinearMath/btQuickprof.h index d048f98e3..3e06c460d 100644 --- a/src/LinearMath/btQuickprof.h +++ b/src/LinearMath/btQuickprof.h @@ -42,21 +42,65 @@ #if defined(WIN32) || defined(_WIN32) -#define USE_WINDOWS_TIMERS -#define WIN32_LEAN_AND_MEAN -#define NOWINRES -#define NOMCX -#define NOIME -#ifdef _XBOX -#include +#define BT_USE_WINDOWS_TIMERS + +#ifdef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN_WAS_ENABLED #else -#include + #define WIN32_LEAN_AND_MEAN #endif +#ifdef NOWINRES + #define NOWINRES_WAS_ENABLED +#else + #define NOWINRES +#endif//NOWINRES +#ifdef NOMCX + #define NOMCX_WAS_ENABLED +#else + #define NOMCX +#endif //NOMCX +#ifdef NOIME + #define NOIME_WAS_ENABLED +#else + #define NOIME +#endif //NOIME + +#ifdef _XBOX + #include +#else //_XBOX + #include +#endif //_XBOX + #include +#ifndef WIN32_LEAN_AND_MEAN_WAS_ENABLED + #undef WIN32_LEAN_AND_MEAN +#else //WIN32_LEAN_AND_MEAN_WAS_ENABLED + #undef WIN32_LEAN_AND_MEAN_WAS_ENABLED +#endif //WIN32_LEAN_AND_MEAN_WAS_ENABLED + +#ifndef NOWINRES_WAS_ENABLED + #undef NOWINRES #else + #undef NOWINRES_WAS_ENABLED +#endif //NOWINRES_WAS_ENABLED + +#ifndef NOMCX_WAS_ENABLED + #undef NOMCX +#else + #undef NOMCX_WAS_ENABLED +#endif //NOMCX_WAS_ENABLED + +#ifndef NOIME_WAS_ENABLED + #undef NOIME +#else + #undef NOIME_WAS_ENABLED +#endif //NOIME_WAS_ENABLED + + +#else //_WIN32 #include -#endif +#endif //_WIN32 #define mymin(a,b) (a > b ? a : b) @@ -66,7 +110,7 @@ class btClock public: btClock() { -#ifdef USE_WINDOWS_TIMERS +#ifdef BT_USE_WINDOWS_TIMERS QueryPerformanceFrequency(&mClockFrequency); #endif reset(); @@ -79,7 +123,7 @@ public: /// Resets the initial reference time. void reset() { -#ifdef USE_WINDOWS_TIMERS +#ifdef BT_USE_WINDOWS_TIMERS QueryPerformanceCounter(&mStartTime); mStartTick = GetTickCount(); mPrevElapsedTime = 0; @@ -102,7 +146,7 @@ public: /// the btClock was created. unsigned long int getTimeMilliseconds() { -#ifdef USE_WINDOWS_TIMERS +#ifdef BT_USE_WINDOWS_TIMERS LARGE_INTEGER currentTime; QueryPerformanceCounter(¤tTime); LONGLONG elapsedTime = currentTime.QuadPart - @@ -160,7 +204,7 @@ public: /// the Clock was created. unsigned long int getTimeMicroseconds() { -#ifdef USE_WINDOWS_TIMERS +#ifdef BT_USE_WINDOWS_TIMERS LARGE_INTEGER currentTime; QueryPerformanceCounter(¤tTime); LONGLONG elapsedTime = currentTime.QuadPart - @@ -215,7 +259,7 @@ public: } private: -#ifdef USE_WINDOWS_TIMERS +#ifdef BT_USE_WINDOWS_TIMERS LARGE_INTEGER mClockFrequency; DWORD mStartTick; LONGLONG mPrevElapsedTime;