| 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 <chrono> | 7 #include <chrono> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1270 gvr::Mat4f head_mat = | 1270 gvr::Mat4f head_mat = |
| 1271 gvr_api_->GetHeadSpaceFromStartSpaceRotation(target_time); | 1271 gvr_api_->GetHeadSpaceFromStartSpaceRotation(target_time); |
| 1272 head_mat = gvr_api_->ApplyNeckModel(head_mat, 1.0f); | 1272 head_mat = gvr_api_->ApplyNeckModel(head_mat, 1.0f); |
| 1273 | 1273 |
| 1274 webvr_head_pose_[frame_index % kPoseRingBufferSize] = head_mat; | 1274 webvr_head_pose_[frame_index % kPoseRingBufferSize] = head_mat; |
| 1275 | 1275 |
| 1276 callback.Run(VrShell::VRPosePtrFromGvrPose(head_mat), time, frame_index, | 1276 callback.Run(VrShell::VRPosePtrFromGvrPose(head_mat), time, frame_index, |
| 1277 device::mojom::VRVSyncProvider::Status::SUCCESS); | 1277 device::mojom::VRVSyncProvider::Status::SUCCESS); |
| 1278 } | 1278 } |
| 1279 | 1279 |
| 1280 void VrShellGl::ResetPose() { | |
| 1281 // Should never call RecenterTracking when using with Daydream viewers. On | |
| 1282 // those devices recentering should only be done via the controller. | |
| 1283 if (gvr_api_ && gvr_api_->GetViewerType() == GVR_VIEWER_TYPE_CARDBOARD) | |
| 1284 gvr_api_->RecenterTracking(); | |
| 1285 } | |
| 1286 | |
| 1287 void VrShellGl::CreateVRDisplayInfo( | 1280 void VrShellGl::CreateVRDisplayInfo( |
| 1288 const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback, | 1281 const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback, |
| 1289 uint32_t device_id) { | 1282 uint32_t device_id) { |
| 1290 // This assumes that the initial webvr_surface_size_ was set to the | 1283 // This assumes that the initial webvr_surface_size_ was set to the |
| 1291 // appropriate recommended render resolution as the default size during | 1284 // appropriate recommended render resolution as the default size during |
| 1292 // InitializeGl. Revisit if the initialization order changes. | 1285 // InitializeGl. Revisit if the initialization order changes. |
| 1293 device::mojom::VRDisplayInfoPtr info = VrShell::CreateVRDisplayInfo( | 1286 device::mojom::VRDisplayInfoPtr info = VrShell::CreateVRDisplayInfo( |
| 1294 gvr_api_.get(), webvr_surface_size_, device_id); | 1287 gvr_api_.get(), webvr_surface_size_, device_id); |
| 1295 main_thread_task_runner_->PostTask( | 1288 main_thread_task_runner_->PostTask( |
| 1296 FROM_HERE, | 1289 FROM_HERE, |
| 1297 base::Bind(&RunVRDisplayInfoCallback, callback, base::Passed(&info))); | 1290 base::Bind(&RunVRDisplayInfoCallback, callback, base::Passed(&info))); |
| 1298 } | 1291 } |
| 1299 | 1292 |
| 1300 } // namespace vr_shell | 1293 } // namespace vr_shell |
| OLD | NEW |