Chromium Code Reviews| 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..61557cac8118894f5325a8b3a50664c54033eba8 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 |
|
cjgrant
2017/03/24 21:15:40
nit: Most editors can be used to auto-format comme
klausw
2017/03/24 22:13:29
I was using auto format, but Emacs for some reason
|
| +// 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); |
| } |