OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/android/vr_shell/non_presenting_gvr_delegate.h" | 5 #include "chrome/browser/android/vr_shell/non_presenting_gvr_delegate.h" |
6 | 6 |
7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
| 8 #include "base/threading/thread_task_runner_handle.h" |
8 #include "chrome/browser/android/vr_shell/vr_shell.h" | 9 #include "chrome/browser/android/vr_shell/vr_shell.h" |
9 | 10 |
10 namespace vr_shell { | 11 namespace vr_shell { |
11 | 12 |
12 namespace { | 13 namespace { |
13 static constexpr long kPredictionTimeWithoutVsyncNanos = 50000000; | 14 static constexpr long kPredictionTimeWithoutVsyncNanos = 50000000; |
14 } // namespace | 15 } // namespace |
15 | 16 |
16 NonPresentingGvrDelegate::NonPresentingGvrDelegate(long context) | 17 NonPresentingGvrDelegate::NonPresentingGvrDelegate(long context) |
17 : task_runner_(base::ThreadTaskRunnerHandle::Get()), | 18 : task_runner_(base::ThreadTaskRunnerHandle::Get()), |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 const GetVSyncCallback& callback) { | 137 const GetVSyncCallback& callback) { |
137 gvr::ClockTimePoint target_time = gvr::GvrApi::GetTimePointNow(); | 138 gvr::ClockTimePoint target_time = gvr::GvrApi::GetTimePointNow(); |
138 target_time.monotonic_system_time_nanos += kPredictionTimeWithoutVsyncNanos; | 139 target_time.monotonic_system_time_nanos += kPredictionTimeWithoutVsyncNanos; |
139 | 140 |
140 gvr::Mat4f head_mat = gvr_api_->ApplyNeckModel( | 141 gvr::Mat4f head_mat = gvr_api_->ApplyNeckModel( |
141 gvr_api_->GetHeadSpaceFromStartSpaceRotation(target_time), 1.0f); | 142 gvr_api_->GetHeadSpaceFromStartSpaceRotation(target_time), 1.0f); |
142 callback.Run(VrShell::VRPosePtrFromGvrPose(head_mat), time, -1); | 143 callback.Run(VrShell::VRPosePtrFromGvrPose(head_mat), time, -1); |
143 } | 144 } |
144 | 145 |
145 } // namespace vr_shell | 146 } // namespace vr_shell |
OLD | NEW |