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;
#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)

View File

@@ -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();
}

View File

@@ -42,21 +42,65 @@
#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
#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 <Xtl.h>
#else
#else //_XBOX
#include <windows.h>
#endif
#endif //_XBOX
#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
#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>
#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(&currentTime);
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(&currentTime);
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;