@@ -2038,6 +2038,24 @@ cdef class LibOVRPoseState(object):
20382038 newPose = oldPose.timeIntegrate(0.25)
20392039 pos, ori = newPose.posOri # extract components
20402040
2041+ Time integration can be used to predict the pose of an object at HMD
2042+ V-Sync if velocity and acceleration is known. Usually for predicting HMD
2043+ position, we would pass the predicted time to `getDevicePoses` or
2044+ `getTrackingState` directly and have `LibOVR` compute the pose offset.
2045+ For this example, we will use do so with the following::
2046+
2047+ tsec = timeInSeconds()
2048+ ptime = getPredictedDisplayTime(frame_index)
2049+
2050+ _, headPoseState = getDevicePoses(
2051+ [TRACKED_DEVICE_TYPE_HMD],
2052+ absTime=tsec, # not the predicted time!
2053+ latencyMarker=True)
2054+
2055+ dt = ptime - tsec # time difference from now and v-sync
2056+ headPoseAtVsync = headPose.timeIntegrate(dt)
2057+ calcEyePoses(headPoseAtVsync)
2058+
20412059 """
20422060 cdef libovr_math.Posef res = \
20432061 (< libovr_math.Posef> self .c_data[0 ].ThePose).TimeIntegrate(
@@ -4537,7 +4555,8 @@ def getDevicePoses(object deviceTypes, double absTime, bint latencyMarker=True):
45374555 latencyMarker: bool, optional
45384556 Insert a marker for motion-to-photon latency calculation. Set this to
45394557 False if :func:`getTrackingState` was previously called and a latency
4540- marker was set there.
4558+ marker was set there. The latency marker is set to the absolute time
4559+ this function was called.
45414560
45424561 Returns
45434562 -------
@@ -4566,16 +4585,14 @@ def getDevicePoses(object deviceTypes, double absTime, bint latencyMarker=True):
45664585 """
45674586 # give a success code and empty pose list if an empty list was specified
45684587 if not deviceTypes:
4588+ if latencyMarker:
4589+ _eyeLayer.SensorSampleTime = capi.ovr_GetTimeInSeconds()
45694590 return capi.ovrSuccess, []
45704591
45714592 global _ptrSession
45724593 global _eyeLayer
45734594 # global _devicePoses
45744595
4575- # for computing app photon-to-motion latency
4576- if latencyMarker:
4577- _eyeLayer.SensorSampleTime = absTime
4578-
45794596 # allocate arrays to store pose types and poses
45804597 cdef int count = < int > len (deviceTypes)
45814598 cdef capi.ovrTrackedDeviceType* devices = \
@@ -4602,6 +4619,10 @@ def getDevicePoses(object deviceTypes, double absTime, bint latencyMarker=True):
46024619 absTime,
46034620 devicePoses)
46044621
4622+ # for computing app photon-to-motion latency
4623+ if latencyMarker:
4624+ _eyeLayer.SensorSampleTime = capi.ovr_GetTimeInSeconds()
4625+
46054626 # build list of device poses
46064627 cdef list outPoses = list ()
46074628 cdef LibOVRPoseState thisPose
0 commit comments