Merge pull request #683 from erwincoumans/master

VR support in PhysicsServerExample, physics runs in its own thread.
This commit is contained in:
erwincoumans
2016-07-09 15:24:40 -07:00
committed by GitHub
48 changed files with 1274 additions and 298 deletions

View File

@@ -166,7 +166,7 @@ unsigned long int b3Clock::getTimeMilliseconds()
/// Returns the time in us since the last call to reset or since
/// the Clock was created.
unsigned long int b3Clock::getTimeMicroseconds()
unsigned long long int b3Clock::getTimeMicroseconds()
{
#ifdef B3_USE_WINDOWS_TIMERS
LARGE_INTEGER currentTime;
@@ -175,14 +175,14 @@ unsigned long int b3Clock::getTimeMicroseconds()
m_data->mStartTime.QuadPart;
// Compute the number of millisecond ticks elapsed.
unsigned long msecTicks = (unsigned long)(1000 * elapsedTime /
unsigned long long msecTicks = (unsigned long long)(1000 * elapsedTime /
m_data->mClockFrequency.QuadPart);
// Check for unexpected leaps in the Win32 performance counter.
// (This is caused by unexpected data across the PCI to ISA
// bridge, aka south bridge. See Microsoft KB274323.)
unsigned long elapsedTicks = GetTickCount() - m_data->mStartTick;
signed long msecOff = (signed long)(msecTicks - elapsedTicks);
unsigned long long elapsedTicks = GetTickCount() - m_data->mStartTick;
signed long long msecOff = (signed long)(msecTicks - elapsedTicks);
if (msecOff < -100 || msecOff > 100)
{
// Adjust the starting time forwards.
@@ -197,7 +197,7 @@ unsigned long int b3Clock::getTimeMicroseconds()
m_data->mPrevElapsedTime = elapsedTime;
// Convert to microseconds.
unsigned long usecTicks = (unsigned long)(1000000 * elapsedTime /
unsigned long long usecTicks = (unsigned long)(1000000 * elapsedTime /
m_data->mClockFrequency.QuadPart);
return usecTicks;
@@ -222,3 +222,8 @@ unsigned long int b3Clock::getTimeMicroseconds()
#endif
}
double b3Clock::getTimeInSeconds()
{
return double(getTimeMicroseconds()/1.e6);
}

View File

@@ -22,7 +22,12 @@ public:
/// Returns the time in us since the last call to reset or since
/// the Clock was created.
unsigned long int getTimeMicroseconds();
unsigned long long int getTimeMicroseconds();
/// Returns the time in seconds since the last call to reset or since
/// the Clock was created.
double getTimeInSeconds();
private:
struct b3ClockData* m_data;
};