mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-29 16:25:42 +00:00
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:
parent
85730dfb59
commit
71cf58b8c5
3 changed files with 16 additions and 13 deletions
|
|
@ -95,7 +95,7 @@ void OculusVRSensorData::simulateData(const F32& maxAxisRadius)
|
||||||
mDataSet = true;
|
mDataSet = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
U32 OculusVRSensorData::compare(OculusVRSensorData* other)
|
U32 OculusVRSensorData::compare(OculusVRSensorData* other, bool doRawCompare)
|
||||||
{
|
{
|
||||||
S32 result = DIFF_NONE;
|
S32 result = DIFF_NONE;
|
||||||
|
|
||||||
|
|
@ -116,17 +116,20 @@ U32 OculusVRSensorData::compare(OculusVRSensorData* other)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check raw values
|
// 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(mAcceleration.x != other->mAcceleration.x || mAcceleration.y != other->mAcceleration.y || mAcceleration.z != other->mAcceleration.z || !mDataSet)
|
||||||
}
|
{
|
||||||
if(mAngVelocity.x != other->mAngVelocity.x || mAngVelocity.y != other->mAngVelocity.y || mAngVelocity.z != other->mAngVelocity.z || !mDataSet)
|
result |= DIFF_ACCEL;
|
||||||
{
|
}
|
||||||
result |= DIFF_ANGVEL;
|
if(mAngVelocity.x != other->mAngVelocity.x || mAngVelocity.y != other->mAngVelocity.y || mAngVelocity.z != other->mAngVelocity.z || !mDataSet)
|
||||||
}
|
{
|
||||||
if(mMagnetometer.x != other->mMagnetometer.x || mMagnetometer.y != other->mMagnetometer.y || mMagnetometer.z != other->mMagnetometer.z || !mDataSet)
|
result |= DIFF_ANGVEL;
|
||||||
{
|
}
|
||||||
result |= DIFF_MAG;
|
if(mMagnetometer.x != other->mMagnetometer.x || mMagnetometer.y != other->mMagnetometer.y || mMagnetometer.z != other->mMagnetometer.z || !mDataSet)
|
||||||
|
{
|
||||||
|
result |= DIFF_MAG;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ struct OculusVRSensorData
|
||||||
void simulateData(const F32& maxAxisRadius);
|
void simulateData(const F32& maxAxisRadius);
|
||||||
|
|
||||||
/// Compare this data and given and return differences
|
/// Compare this data and given and return differences
|
||||||
U32 compare(OculusVRSensorData* other);
|
U32 compare(OculusVRSensorData* other, bool doRawCompare);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _OCULUSVRSENSORDATA_H_
|
#endif // _OCULUSVRSENSORDATA_H_
|
||||||
|
|
|
||||||
|
|
@ -200,7 +200,7 @@ bool OculusVRSensorDevice::process(U32 deviceType, bool generateRotAsAngAxis, bo
|
||||||
{
|
{
|
||||||
currentBuffer->simulateData(maxAxisRadius);
|
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
|
// Update the previous data pointer. We do this here in case someone calls our
|
||||||
// console functions during one of the input events below.
|
// console functions during one of the input events below.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue