Oculus Rift Sensor Data Comparison Change

- Modified OculusVRSensorData::compare() to only work with the raw
sensor data when specifically requested.  No need to process those
values if the user hasn't asked for them.
This commit is contained in:
DavidWyand-GG 2013-10-21 11:28:41 -04:00
parent 85730dfb59
commit 71cf58b8c5
3 changed files with 16 additions and 13 deletions

View file

@ -95,7 +95,7 @@ void OculusVRSensorData::simulateData(const F32& maxAxisRadius)
mDataSet = true;
}
U32 OculusVRSensorData::compare(OculusVRSensorData* other)
U32 OculusVRSensorData::compare(OculusVRSensorData* other, bool doRawCompare)
{
S32 result = DIFF_NONE;
@ -116,17 +116,20 @@ U32 OculusVRSensorData::compare(OculusVRSensorData* other)
}
// Check raw values
if(mAcceleration.x != other->mAcceleration.x || mAcceleration.y != other->mAcceleration.y || mAcceleration.z != other->mAcceleration.z || !mDataSet)
if(doRawCompare)
{
result |= DIFF_ACCEL;
}
if(mAngVelocity.x != other->mAngVelocity.x || mAngVelocity.y != other->mAngVelocity.y || mAngVelocity.z != other->mAngVelocity.z || !mDataSet)
{
result |= DIFF_ANGVEL;
}
if(mMagnetometer.x != other->mMagnetometer.x || mMagnetometer.y != other->mMagnetometer.y || mMagnetometer.z != other->mMagnetometer.z || !mDataSet)
{
result |= DIFF_MAG;
if(mAcceleration.x != other->mAcceleration.x || mAcceleration.y != other->mAcceleration.y || mAcceleration.z != other->mAcceleration.z || !mDataSet)
{
result |= DIFF_ACCEL;
}
if(mAngVelocity.x != other->mAngVelocity.x || mAngVelocity.y != other->mAngVelocity.y || mAngVelocity.z != other->mAngVelocity.z || !mDataSet)
{
result |= DIFF_ANGVEL;
}
if(mMagnetometer.x != other->mMagnetometer.x || mMagnetometer.y != other->mMagnetometer.y || mMagnetometer.z != other->mMagnetometer.z || !mDataSet)
{
result |= DIFF_MAG;
}
}
return result;

View file

@ -71,7 +71,7 @@ struct OculusVRSensorData
void simulateData(const F32& maxAxisRadius);
/// Compare this data and given and return differences
U32 compare(OculusVRSensorData* other);
U32 compare(OculusVRSensorData* other, bool doRawCompare);
};
#endif // _OCULUSVRSENSORDATA_H_

View file

@ -200,7 +200,7 @@ bool OculusVRSensorDevice::process(U32 deviceType, bool generateRotAsAngAxis, bo
{
currentBuffer->simulateData(maxAxisRadius);
}
diff = mPrevData->compare(currentBuffer);
diff = mPrevData->compare(currentBuffer, generateRawSensor);
// Update the previous data pointer. We do this here in case someone calls our
// console functions during one of the input events below.