Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(682)

Unified Diff: chrome/browser/android/vr_shell/vr_shell_gl.cc

Issue 2770353002: WebVR: add angular velocity estimate to pose (Closed)
Patch Set: Enable linear accel, fix angular velocity to be in seated space Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/android/vr_shell/vr_shell_gl.cc
diff --git a/chrome/browser/android/vr_shell/vr_shell_gl.cc b/chrome/browser/android/vr_shell/vr_shell_gl.cc
index 587c233fa5b55a6d3916c2c89d31676ba5df54af..6593c0510b01ee965eeb016fad7f2b2ab2966471 100644
--- a/chrome/browser/android/vr_shell/vr_shell_gl.cc
+++ b/chrome/browser/android/vr_shell/vr_shell_gl.cc
@@ -39,6 +39,11 @@ namespace {
// exposed, use that instead (it defaults to 50ms on most platforms).
static constexpr int64_t kPredictionTimeWithoutVsyncNanos = 50000000;
+// Time offset used for calculating angular velocity from a pair of predicted
+// poses. The precise value shouldn't matter as long as it's nonzero and much
+// less than a frame.
+static constexpr int64_t kAngularVelocityEpsilonNanos = 1000000;
+
static constexpr float kZNear = 0.1f;
static constexpr float kZFar = 1000.0f;
@@ -1270,9 +1275,15 @@ void VrShellGl::SendVSync(base::TimeDelta time,
gvr_api_->GetHeadSpaceFromStartSpaceRotation(target_time);
head_mat = gvr_api_->ApplyNeckModel(head_mat, 1.0f);
+ target_time.monotonic_system_time_nanos += kAngularVelocityEpsilonNanos;
+ gvr::Mat4f head_mat_2 =
+ gvr_api_->GetHeadSpaceFromStartSpaceRotation(target_time);
+
webvr_head_pose_[frame_index % kPoseRingBufferSize] = head_mat;
- callback.Run(VrShell::VRPosePtrFromGvrPose(head_mat), time, frame_index,
+ callback.Run(VrShell::VRPosePtrFromGvrPose(head_mat, head_mat_2,
+ kAngularVelocityEpsilonNanos),
+ time, frame_index,
device::mojom::VRVSyncProvider::Status::SUCCESS);
}
« chrome/browser/android/vr_shell/vr_shell.cc ('K') | « chrome/browser/android/vr_shell/vr_shell.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698