| 214 | } |
| 215 | |
| 216 | ovrResult 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 |
no test coverage detected