| 1150 | } |
| 1151 | |
| 1152 | OVR_PUBLIC_FUNCTION(float) ovr_GetFloat(ovrSession session, const char* propertyName, float defaultVal) |
| 1153 | { |
| 1154 | REV_TRACE(ovr_GetFloat); |
| 1155 | |
| 1156 | if (strcmp(propertyName, "IPD") == 0) |
| 1157 | return vr::VRSystem()->GetFloatTrackedDeviceProperty(vr::k_unTrackedDeviceIndex_Hmd, vr::Prop_UserIpdMeters_Float); |
| 1158 | else if (strcmp(propertyName, "VsyncToNextVsync") == 0) |
| 1159 | return 1.0f / vr::VRSystem()->GetFloatTrackedDeviceProperty(vr::k_unTrackedDeviceIndex_Hmd, vr::Prop_DisplayFrequency_Float); |
| 1160 | else if (strcmp(propertyName, "CpuStartToGpuEndSeconds") == 0) |
| 1161 | { |
| 1162 | vr::Compositor_FrameTiming timing; |
| 1163 | timing.m_nSize = sizeof(timing); |
| 1164 | if (vr::VRCompositor()->GetFrameTiming(&timing)) |
| 1165 | return (timing.m_flClientFrameIntervalMs + timing.m_flTotalRenderGpuMs) / 1000.0f; |
| 1166 | } |
| 1167 | |
| 1168 | // Override defaults, we should always return a valid value for these |
| 1169 | if (strcmp(propertyName, OVR_KEY_PLAYER_HEIGHT) == 0) |
| 1170 | defaultVal = OVR_DEFAULT_PLAYER_HEIGHT; |
| 1171 | else if (strcmp(propertyName, OVR_KEY_EYE_HEIGHT) == 0) |
| 1172 | defaultVal = OVR_DEFAULT_EYE_HEIGHT; |
| 1173 | |
| 1174 | if (session) |
| 1175 | { |
| 1176 | vr::EVRSettingsError error = vr::VRSettingsError_None; |
| 1177 | float prop = vr::VRSettings()->GetFloat(session->AppKey, propertyName); |
| 1178 | if (error = vr::VRSettingsError_None) |
| 1179 | return prop; |
| 1180 | } |
| 1181 | return defaultVal; |
| 1182 | } |
| 1183 | |
| 1184 | OVR_PUBLIC_FUNCTION(ovrBool) ovr_SetFloat(ovrSession session, const char* propertyName, float value) |
| 1185 | { |
nothing calls this directly
no outgoing calls
no test coverage detected