void OculusVRSensorDevice::setPositionTracking(bool state) { if(!mIsValid) return; if (state == !mPositionTrackingDisabled) return; if(state && !(mSupportedTrackingCaps & ovrTrackingCap_Position)) return; mPositionTrackingDisabled = !state; updateTrackingCaps(); }
void OculusVRSensorDevice::setYawCorrection(bool state) { if(!mIsValid) return; if (state == !mYawCorrectionDisabled) return; // Don't allow if not capable if(state && !(mSupportedTrackingCaps & ovrTrackingCap_MagYawCorrection)) return; mYawCorrectionDisabled = !state; updateTrackingCaps(); }
void OculusVRSensorDevice::set(ovrHmd sensor, S32 actionCodeIndex) { mIsValid = false; mDevice = sensor; mSupportedTrackingCaps = ovr_GetTrackingCaps(sensor); mCurrentTrackingCaps = ovrTrackingCap_Orientation | ovrTrackingCap_MagYawCorrection | ovrTrackingCap_Position; mCurrentTrackingCaps = mSupportedTrackingCaps & mCurrentTrackingCaps; mYawCorrectionDisabled = !(mCurrentTrackingCaps & ovrTrackingCap_MagYawCorrection); mPositionTrackingDisabled = !(mCurrentTrackingCaps & ovrTrackingCap_Position); ovrHmdDesc desc = ovr_GetHmdDesc(sensor); // DeviceInfo mProductName = desc.ProductName; mManufacturer = desc.Manufacturer; mVersion = desc.Type; // SensorInfo mVendorId = desc.VendorId; mProductId = desc.ProductId; mSerialNumber = desc.SerialNumber; mActionCodeIndex = actionCodeIndex; if(mActionCodeIndex >= OculusVRConstants::MaxSensors) { // Cannot declare more sensors than we are able to handle mIsValid = false; } else { mIsValid = true; } updateTrackingCaps(); }