| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
| 10 #include "chrome/browser/android/vr_shell/vr_shell.h" | 10 #include "chrome/browser/android/vr_shell/vr_shell.h" |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 gvr::Mat4f head_mat = gvr_api_->ApplyNeckModel( | 154 gvr::Mat4f head_mat = gvr_api_->ApplyNeckModel( |
| 155 gvr_api_->GetHeadSpaceFromStartSpaceRotation(target_time), 1.0f); | 155 gvr_api_->GetHeadSpaceFromStartSpaceRotation(target_time), 1.0f); |
| 156 callback.Run(VrShell::VRPosePtrFromGvrPose(head_mat), time, -1, | 156 callback.Run(VrShell::VRPosePtrFromGvrPose(head_mat), time, -1, |
| 157 device::mojom::VRVSyncProvider::Status::SUCCESS); | 157 device::mojom::VRVSyncProvider::Status::SUCCESS); |
| 158 } | 158 } |
| 159 | 159 |
| 160 bool NonPresentingGvrDelegate::SupportsPresentation() { | 160 bool NonPresentingGvrDelegate::SupportsPresentation() { |
| 161 return false; | 161 return false; |
| 162 } | 162 } |
| 163 | 163 |
| 164 void NonPresentingGvrDelegate::ResetPose() { | |
| 165 // Should never call RecenterTracking when using with Daydream viewers. On | |
| 166 // those devices recentering should only be done via the controller. | |
| 167 if (gvr_api_ && gvr_api_->GetViewerType() == GVR_VIEWER_TYPE_CARDBOARD) | |
| 168 gvr_api_->RecenterTracking(); | |
| 169 } | |
| 170 | |
| 171 void NonPresentingGvrDelegate::CreateVRDisplayInfo( | 164 void NonPresentingGvrDelegate::CreateVRDisplayInfo( |
| 172 const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback, | 165 const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback, |
| 173 uint32_t device_id) { | 166 uint32_t device_id) { |
| 174 if (!gvr_api_) { | 167 if (!gvr_api_) { |
| 175 callback.Run(device::mojom::VRDisplayInfoPtr(nullptr)); | 168 callback.Run(device::mojom::VRDisplayInfoPtr(nullptr)); |
| 176 return; | 169 return; |
| 177 } | 170 } |
| 178 | 171 |
| 179 gvr::Sizei webvr_size = VrShell::GetRecommendedWebVrSize(gvr_api_.get()); | 172 gvr::Sizei webvr_size = VrShell::GetRecommendedWebVrSize(gvr_api_.get()); |
| 180 DVLOG(1) << __FUNCTION__ << ": resize recommended to " << webvr_size.width | 173 DVLOG(1) << __FUNCTION__ << ": resize recommended to " << webvr_size.width |
| 181 << "x" << webvr_size.height; | 174 << "x" << webvr_size.height; |
| 182 callback.Run( | 175 callback.Run( |
| 183 VrShell::CreateVRDisplayInfo(gvr_api_.get(), webvr_size, device_id)); | 176 VrShell::CreateVRDisplayInfo(gvr_api_.get(), webvr_size, device_id)); |
| 184 } | 177 } |
| 185 | 178 |
| 186 } // namespace vr_shell | 179 } // namespace vr_shell |
| OLD | NEW |