MCPcopy Create free account
hub / github.com/LibreVR/Revive / GetDevicePoses

Method GetDevicePoses

ReviveXR/InputManager.cpp:216–252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

214}
215
216ovrResult InputManager::GetDevicePoses(ovrSession session, ovrTrackedDeviceType* deviceTypes, int deviceCount, double absTime, ovrPoseStatef* outDevicePoses)
217{
218 if (absTime <= 0.0)
219 absTime = ovr_GetTimeInSeconds();
220
221 XrTime displayTime = AbsTimeToXrTime(session->Instance, absTime);
222 XrSpaceLocation location = XR_TYPE(SPACE_LOCATION);
223 XrSpaceVelocity velocity = XR_TYPE(SPACE_VELOCITY);
224 location.next = &velocity;
225 for (int i = 0; i < deviceCount; i++)
226 {
227 // Get the space for device types we recognize
228 XrSpace space = XR_NULL_HANDLE;
229 ovrPoseStatef* pLastState = nullptr;
230 switch (deviceTypes[i])
231 {
232 case ovrTrackedDevice_HMD:
233 space = session->ViewSpace;
234 pLastState = &m_LastTrackingState.HeadPose;
235 break;
236 case ovrTrackedDevice_LTouch:
237 space = m_ActionSpaces[ovrHand_Left];
238 pLastState = &m_LastTrackingState.HandPoses[ovrHand_Left];
239 break;
240 case ovrTrackedDevice_RTouch:
241 space = m_ActionSpaces[ovrHand_Right];
242 pLastState = &m_LastTrackingState.HandPoses[ovrHand_Right];
243 break;
244 }
245
246 if (space && pLastState)
247 CHK_XR(xrLocateSpace(space, session->TrackingSpaces[session->TrackingOrigin], displayTime, &location));
248 SpaceRelationToPoseState(location, absTime, *pLastState, outDevicePoses[i]);
249 }
250
251 return ovrSuccess;
252}
253
254/* Action child-class */
255

Callers 1

ovr_GetDevicePosesFunction · 0.45

Calls 2

AbsTimeToXrTimeFunction · 0.85
ovr_GetTimeInSecondsFunction · 0.70

Tested by

no test coverage detected