| 122 | OVR_PUBLIC_FUNCTION(ovrResult) ovr_IdentifyClient(const char* identity) { return ovrSuccess; /* Debugging feature */ } |
| 123 | |
| 124 | OVR_PUBLIC_FUNCTION(ovrHmdDesc) ovr_GetHmdDesc(ovrSession session) |
| 125 | { |
| 126 | REV_TRACE(ovr_GetHmdDesc); |
| 127 | |
| 128 | ovrHmdDesc desc = { ovrHmd_None }; |
| 129 | |
| 130 | if (!g_Instance) |
| 131 | return desc; |
| 132 | |
| 133 | XrSystemId System; |
| 134 | XrSystemGetInfo systemInfo = XR_TYPE(SYSTEM_GET_INFO); |
| 135 | systemInfo.formFactor = XR_FORM_FACTOR_HEAD_MOUNTED_DISPLAY; |
| 136 | if (session || XR_SUCCEEDED(xrGetSystem(g_Instance, &systemInfo, &System))) |
| 137 | desc.Type = Runtime::Get().MinorVersion < 38 ? ovrHmd_CV1 : ovrHmd_RiftS; |
| 138 | |
| 139 | if (!session) |
| 140 | return desc; |
| 141 | |
| 142 | XrInstanceProperties props = XR_TYPE(INSTANCE_PROPERTIES); |
| 143 | xrGetInstanceProperties(session->Instance, &props); |
| 144 | |
| 145 | strcpy_s(desc.ProductName, 64, "Oculus Rift S"); |
| 146 | strcpy_s(desc.Manufacturer, 64, props.runtimeName); |
| 147 | |
| 148 | if (session->SystemProperties.trackingProperties.orientationTracking) |
| 149 | desc.AvailableTrackingCaps |= ovrTrackingCap_Orientation; |
| 150 | if (session->SystemProperties.trackingProperties.positionTracking) |
| 151 | desc.AvailableTrackingCaps |= ovrTrackingCap_Orientation; |
| 152 | desc.DefaultTrackingCaps = desc.AvailableTrackingCaps; |
| 153 | |
| 154 | for (int i = 0; i < ovrEye_Count; i++) |
| 155 | { |
| 156 | // Compensate for the 3-DOF eye pose on pre-1.17 |
| 157 | if (Runtime::Get().MinorVersion < 17) |
| 158 | { |
| 159 | desc.DefaultEyeFov[i] = OVR::FovPort::Uncant(XR::FovPort(session->ViewPoses[i].fov), XR::Quatf(session->ViewPoses[i].pose.orientation)); |
| 160 | desc.MaxEyeFov[i] = desc.DefaultEyeFov[i]; |
| 161 | } |
| 162 | else |
| 163 | { |
| 164 | desc.DefaultEyeFov[i] = XR::FovPort(session->ViewFov[i].recommendedFov); |
| 165 | desc.MaxEyeFov[i] = XR::FovPort(session->ViewFov[i].maxMutableFov); |
| 166 | } |
| 167 | desc.Resolution.w += (int)session->ViewConfigs[i].recommendedImageRectWidth; |
| 168 | desc.Resolution.h = std::max(desc.Resolution.h, (int)session->ViewConfigs[i].recommendedImageRectHeight); |
| 169 | } |
| 170 | |
| 171 | XrIndexedFrameState* frame = session->CurrentFrame; |
| 172 | desc.DisplayRefreshRate = frame->predictedDisplayPeriod > 0 ? 1e9f / frame->predictedDisplayPeriod : 90.0f; |
| 173 | return desc; |
| 174 | } |
| 175 | |
| 176 | OVR_PUBLIC_FUNCTION(unsigned int) ovr_GetTrackerCount(ovrSession session) |
| 177 | { |