WVR_GetSyncPose¶
- WVR_EXPORT void WVR_GetSyncPose(WVR_PoseOriginModel originModel, WVR_DevicePosePair_t * pairArray, uint32_t pairArrayCount)
Returns poses to usage for rendering scene.
This function gets the poses from runtime for the usage of rendering scene at the specific moment based on the pose origin model. The one-time configuring the tracking universe assumes one kind of origin pose models unless the model setting is not changed. The description of tracking universe can refer to the argument originModel of WVR_GetPoseState.
The poses and device type are aggregated together as struct WVR_DevicePosePair_t. The struct pointers of all tracked devices compose a specific size array to keep track of the locomotions of the devices. The specific array size can be substituted with three levels of device count. WVR_DEVICE_COUNT_LEVEL_0 is only assumed to get HMD device. WVR_DEVICE_COUNT_LEVEL_1 is assumed that the HMD and two controllers are tracked. WVR_DEVICE_COUNT_LEVEL_2 should track the number of devices up to 16, including HMD, 2 controllers, and other miscellaneous tracking devices.
WVR_GetSyncPose function polls pose once within Vsync cycle time periodically to make scene display more smooth. For this reason, this interface will blocking(non-busy waiting) and return poses based on last Vsync elapsed time.
To reduce the judder, the moment of getting poses should approximate the moment update the new scene on display. WVR_GetSyncPose also make short time prediction of poses according to different render methods such as ATW and direct mode.
- Parameters
- originModel -
enum WVR_PoseOriginModel, specify the tracking universe of origin pose model.
- pairArray -
struct pointer WVR_DevicePosePair_t (refer to WVR_DevicePosePair), aggregation array to keep pose information and tracked device type.
- pairArrayCount -
uint32_t, specify the size of WVR_DevicePosePair_t array. The three levels of device count are optional.
- originModel -
How to use¶
Here is an example for the function:
#include <wvr/wvr_device.h>
// Must initialize VR runtime once before tracking API.
WVR_InitError eError = WVR_InitError_None;
eError = WVR_Init(WVR_AppType_VRContent);
if (eError != WVR_InitError_None) {
LOGE("Unable to init VR runtime: %s", WVR_GetInitErrorString(eError));
}
WVR_DevicePosePair_t mVRDevicePairs[WVR_DEVICE_COUNT_LEVEL_1];
WVR_GetSyncPose(WVR_PoseOriginModel_OriginOnHead, mVRDevicePairs, WVR_DEVICE_COUNT_LEVEL_1);
Invoking WVR_GetSyncPose or WVR_GetPoseState multiple times with different predicted time is allowed in programming before calling WVR_SubmitFrame, and in this case, passing the final rendered pose as the third parameter of WVR_SubmitFrame is necessary. Please note that never call these two pose-fetching APIs more than once before calling WVR_SubmitFrame without the pose passed as a parameter.
struce WVR_DevicePosePair_t defined follow below:
- struct WVR_DevicePosePair¶
Aggregate the device type identity and device tracking pose.
Public Members
- WVR_DeviceType type¶
Type of VR device.
- WVR_PoseState_t pose¶
Pose information of Tracked VR device (refer to WVR_PoseState).