Commit b7df8c99 authored by Jacob DeWitt's avatar Jacob DeWitt Committed by Commit Bot

Set emulatedPosition for WebXR on Android

Per the WebXR spec, the viewer pose should have emulatedPosition = true
when the headset only has 3DoF tracking - either by its default
capabilities or due to temporary tracking loss. Fortunately, the GVR
API exposes a "has 6DoF tracking" property that we can check.

Bug: 1011105
Change-Id: I2a80322c76c708d686b1fa89a57bb7374bed0999
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1845992
Commit-Queue: Jacob DeWitt <jacde@chromium.org>
Reviewed-by: default avatarAlexander Cooper <alcooper@chromium.org>
Cr-Commit-Position: refs/heads/master@{#703851}
parent 48bd0a07
......@@ -151,6 +151,22 @@ mojom::VRPosePtr GvrDelegate::GetVRPosePtrWithNeckModel(
pose->angular_velocity =
GetAngularVelocityFromPoses(*head_mat_ptr, head_mat_2, epsilon_seconds);
// The position is emulated unless the current tracking status is 6DoF and is
// not still initializing or invalid.
pose->emulated_position = true;
gvr::Properties props = gvr_api->GetCurrentProperties();
gvr::Value head_tracking_status;
if (props.Get(GVR_PROPERTY_TRACKING_STATUS, &head_tracking_status)) {
bool has_6dof =
!!(head_tracking_status.fl & GVR_TRACKING_STATUS_FLAG_HAS_6DOF);
bool initialized =
!(head_tracking_status.fl & GVR_TRACKING_STATUS_FLAG_INITIALIZING);
bool valid = !(head_tracking_status.fl & GVR_TRACKING_STATUS_FLAG_INVALID);
if (has_6dof && initialized && valid) {
pose->emulated_position = false;
}
}
return pose;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment