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

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

Issue 2770353002: WebVR: add angular velocity estimate to pose (Closed)
Patch Set: Review feedback, move constants to vr_shell.h 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
« no previous file with comments | « chrome/browser/android/vr_shell/vr_shell.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..a50bbb245ac956d94b941649c95ff65b53eadc5f 100644
--- a/chrome/browser/android/vr_shell/vr_shell_gl.cc
+++ b/chrome/browser/android/vr_shell/vr_shell_gl.cc
@@ -35,10 +35,6 @@
namespace vr_shell {
namespace {
-// TODO(mthiesse): If gvr::PlatformInfo().GetPosePredictionTime() is ever
-// exposed, use that instead (it defaults to 50ms on most platforms).
-static constexpr int64_t kPredictionTimeWithoutVsyncNanos = 50000000;
-
static constexpr float kZNear = 0.1f;
static constexpr float kZFar = 1000.0f;
@@ -807,7 +803,8 @@ void VrShellGl::DrawFrame(int16_t frame_index) {
head_pose = webvr_head_pose_[frame_index % kPoseRingBufferSize];
} else {
gvr::ClockTimePoint target_time = gvr::GvrApi::GetTimePointNow();
- target_time.monotonic_system_time_nanos += kPredictionTimeWithoutVsyncNanos;
+ target_time.monotonic_system_time_nanos +=
+ VrShell::kPredictionTimeWithoutVsyncNanos;
head_pose = gvr_api_->GetHeadSpaceFromStartSpaceRotation(target_time);
}
@@ -1264,15 +1261,23 @@ void VrShellGl::SendVSync(base::TimeDelta time,
TRACE_EVENT1("input", "VrShellGl::SendVSync", "frame", frame_index);
gvr::ClockTimePoint target_time = gvr::GvrApi::GetTimePointNow();
- target_time.monotonic_system_time_nanos += kPredictionTimeWithoutVsyncNanos;
+ target_time.monotonic_system_time_nanos +=
+ VrShell::kPredictionTimeWithoutVsyncNanos;
mthiesse 2017/04/05 18:43:18 Instead of moving this constant to the header, and
mthiesse 2017/04/05 18:57:00 Actually, don't worry about this for your CL. I'll
klausw 2017/04/05 22:38:22 Done, now there's just one place that applies the
gvr::Mat4f head_mat =
gvr_api_->GetHeadSpaceFromStartSpaceRotation(target_time);
head_mat = gvr_api_->ApplyNeckModel(head_mat, 1.0f);
+ target_time.monotonic_system_time_nanos +=
+ VrShell::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, VrShell::kAngularVelocityEpsilonNanos),
+ time, frame_index,
device::mojom::VRVSyncProvider::Status::SUCCESS);
}
« no previous file with comments | « 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