| 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/vr_shell_gl.h" | 5 #include "chrome/browser/android/vr_shell/vr_shell_gl.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
| (...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1123 main_thread_task_runner_->PostTask( | 1123 main_thread_task_runner_->PostTask( |
| 1124 FROM_HERE, base::Bind(&VrShell::ForceExitVr, weak_vr_shell_)); | 1124 FROM_HERE, base::Bind(&VrShell::ForceExitVr, weak_vr_shell_)); |
| 1125 } | 1125 } |
| 1126 | 1126 |
| 1127 void VrShellGl::UpdateScene(std::unique_ptr<base::ListValue> commands) { | 1127 void VrShellGl::UpdateScene(std::unique_ptr<base::ListValue> commands) { |
| 1128 scene_->HandleCommands(std::move(commands), TimeInMicroseconds()); | 1128 scene_->HandleCommands(std::move(commands), TimeInMicroseconds()); |
| 1129 } | 1129 } |
| 1130 | 1130 |
| 1131 void VrShellGl::SendVSync(base::TimeDelta time, | 1131 void VrShellGl::SendVSync(base::TimeDelta time, |
| 1132 const GetVSyncCallback& callback) { | 1132 const GetVSyncCallback& callback) { |
| 1133 TRACE_EVENT0("input", "VrShellGl::SendVSync"); | 1133 uint8_t frame_index = frame_index_++; |
| 1134 | 1134 |
| 1135 uint8_t frame_index = frame_index_++; | 1135 TRACE_EVENT1("input", "VrShellGl::SendVSync", "frame", frame_index); |
| 1136 | 1136 |
| 1137 gvr::ClockTimePoint target_time = gvr::GvrApi::GetTimePointNow(); | 1137 gvr::ClockTimePoint target_time = gvr::GvrApi::GetTimePointNow(); |
| 1138 target_time.monotonic_system_time_nanos += kPredictionTimeWithoutVsyncNanos; | 1138 target_time.monotonic_system_time_nanos += kPredictionTimeWithoutVsyncNanos; |
| 1139 | 1139 |
| 1140 gvr::Mat4f head_mat = | 1140 gvr::Mat4f head_mat = |
| 1141 gvr_api_->GetHeadSpaceFromStartSpaceRotation(target_time); | 1141 gvr_api_->GetHeadSpaceFromStartSpaceRotation(target_time); |
| 1142 head_mat = gvr_api_->ApplyNeckModel(head_mat, 1.0f); | 1142 head_mat = gvr_api_->ApplyNeckModel(head_mat, 1.0f); |
| 1143 | 1143 |
| 1144 webvr_head_pose_[frame_index % kPoseRingBufferSize] = head_mat; | 1144 webvr_head_pose_[frame_index % kPoseRingBufferSize] = head_mat; |
| 1145 | 1145 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1158 const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback, | 1158 const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback, |
| 1159 uint32_t device_id) { | 1159 uint32_t device_id) { |
| 1160 device::mojom::VRDisplayInfoPtr info = VrShell::CreateVRDisplayInfo( | 1160 device::mojom::VRDisplayInfoPtr info = VrShell::CreateVRDisplayInfo( |
| 1161 gvr_api_.get(), content_tex_physical_size_, device_id); | 1161 gvr_api_.get(), content_tex_physical_size_, device_id); |
| 1162 main_thread_task_runner_->PostTask( | 1162 main_thread_task_runner_->PostTask( |
| 1163 FROM_HERE, | 1163 FROM_HERE, |
| 1164 base::Bind(&RunVRDisplayInfoCallback, callback, base::Passed(&info))); | 1164 base::Bind(&RunVRDisplayInfoCallback, callback, base::Passed(&info))); |
| 1165 } | 1165 } |
| 1166 | 1166 |
| 1167 } // namespace vr_shell | 1167 } // namespace vr_shell |
| OLD | NEW |