fix btQuickprof introducing #define WIN32_LEAN_AND_MEAN, see also Issue 113

This commit is contained in:
erwin.coumans
2010-08-23 22:21:29 +00:00
parent 0ea249ec33
commit 436c71d440
3 changed files with 73 additions and 15 deletions

View File

@@ -1134,7 +1134,10 @@ HRESULT CALLBACK OnD3D11ResizedSwapChain( ID3D11Device* pd3dDevice, IDXGISwapCha
} }
#ifndef BT_NO_PROFILE
btClock m_clock; btClock m_clock;
#endif //BT_NO_PROFILE
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
// Render the scene using the D3D11 device // Render the scene using the D3D11 device
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
@@ -1146,8 +1149,12 @@ void CALLBACK OnD3D11FrameRender( ID3D11Device* pd3dDevice, ID3D11DeviceContext*
//float ms = getDeltaTimeMicroseconds(); //float ms = getDeltaTimeMicroseconds();
#ifndef BT_NO_PROFILE
btScalar dt = (btScalar)m_clock.getTimeMicroseconds(); btScalar dt = (btScalar)m_clock.getTimeMicroseconds();
m_clock.reset(); m_clock.reset();
#else
btScalar dt = 1000000.f/60.f;
#endif //BT_NO_PROFILE
///step the simulation ///step the simulation
if (m_dynamicsWorld && !paused) if (m_dynamicsWorld && !paused)

View File

@@ -400,14 +400,19 @@ void initBullet(void)
#ifndef BT_NO_PROFILE
btClock m_clock; btClock m_clock;
#endif //BT_NO_PROFILE
void doFlags() void doFlags()
{ {
//float ms = getDeltaTimeMicroseconds(); //float ms = getDeltaTimeMicroseconds();
#ifndef BT_NO_PROFILE
btScalar dt = (btScalar)m_clock.getTimeMicroseconds(); btScalar dt = (btScalar)m_clock.getTimeMicroseconds();
m_clock.reset(); m_clock.reset();
#else
btScalar dt = 1000000.f/60.f;
#endif
///step the simulation ///step the simulation
if( m_dynamicsWorld ) if( m_dynamicsWorld )
@@ -418,7 +423,9 @@ void doFlags()
if (frameCount==100) if (frameCount==100)
{ {
m_dynamicsWorld->stepSimulation(1./60.,0); m_dynamicsWorld->stepSimulation(1./60.,0);
#ifndef BT_NO_PROFILE
CProfileManager::dumpAll(); CProfileManager::dumpAll();
#endif //BT_NO_PROFILE
} }
updatePhysicsWorld(); updatePhysicsWorld();
} }

View File

@@ -42,21 +42,65 @@
#if defined(WIN32) || defined(_WIN32) #if defined(WIN32) || defined(_WIN32)
#define USE_WINDOWS_TIMERS #define BT_USE_WINDOWS_TIMERS
#ifdef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN_WAS_ENABLED
#else
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#endif
#ifdef NOWINRES
#define NOWINRES_WAS_ENABLED
#else
#define NOWINRES #define NOWINRES
#endif//NOWINRES
#ifdef NOMCX
#define NOMCX_WAS_ENABLED
#else
#define NOMCX #define NOMCX
#endif //NOMCX
#ifdef NOIME
#define NOIME_WAS_ENABLED
#else
#define NOIME #define NOIME
#endif //NOIME
#ifdef _XBOX #ifdef _XBOX
#include <Xtl.h> #include <Xtl.h>
#else #else //_XBOX
#include <windows.h> #include <windows.h>
#endif #endif //_XBOX
#include <time.h> #include <time.h>
#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 #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 <sys/time.h> #include <sys/time.h>
#endif #endif //_WIN32
#define mymin(a,b) (a > b ? a : b) #define mymin(a,b) (a > b ? a : b)
@@ -66,7 +110,7 @@ class btClock
public: public:
btClock() btClock()
{ {
#ifdef USE_WINDOWS_TIMERS #ifdef BT_USE_WINDOWS_TIMERS
QueryPerformanceFrequency(&mClockFrequency); QueryPerformanceFrequency(&mClockFrequency);
#endif #endif
reset(); reset();
@@ -79,7 +123,7 @@ public:
/// Resets the initial reference time. /// Resets the initial reference time.
void reset() void reset()
{ {
#ifdef USE_WINDOWS_TIMERS #ifdef BT_USE_WINDOWS_TIMERS
QueryPerformanceCounter(&mStartTime); QueryPerformanceCounter(&mStartTime);
mStartTick = GetTickCount(); mStartTick = GetTickCount();
mPrevElapsedTime = 0; mPrevElapsedTime = 0;
@@ -102,7 +146,7 @@ public:
/// the btClock was created. /// the btClock was created.
unsigned long int getTimeMilliseconds() unsigned long int getTimeMilliseconds()
{ {
#ifdef USE_WINDOWS_TIMERS #ifdef BT_USE_WINDOWS_TIMERS
LARGE_INTEGER currentTime; LARGE_INTEGER currentTime;
QueryPerformanceCounter(&currentTime); QueryPerformanceCounter(&currentTime);
LONGLONG elapsedTime = currentTime.QuadPart - LONGLONG elapsedTime = currentTime.QuadPart -
@@ -160,7 +204,7 @@ public:
/// the Clock was created. /// the Clock was created.
unsigned long int getTimeMicroseconds() unsigned long int getTimeMicroseconds()
{ {
#ifdef USE_WINDOWS_TIMERS #ifdef BT_USE_WINDOWS_TIMERS
LARGE_INTEGER currentTime; LARGE_INTEGER currentTime;
QueryPerformanceCounter(&currentTime); QueryPerformanceCounter(&currentTime);
LONGLONG elapsedTime = currentTime.QuadPart - LONGLONG elapsedTime = currentTime.QuadPart -
@@ -215,7 +259,7 @@ public:
} }
private: private:
#ifdef USE_WINDOWS_TIMERS #ifdef BT_USE_WINDOWS_TIMERS
LARGE_INTEGER mClockFrequency; LARGE_INTEGER mClockFrequency;
DWORD mStartTick; DWORD mStartTick;
LONGLONG mPrevElapsedTime; LONGLONG mPrevElapsedTime;