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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 device::mojom::VRVSyncProvider::Status::SUCCESS); | 150 device::mojom::VRVSyncProvider::Status::SUCCESS); |
151 return; | 151 return; |
152 } | 152 } |
153 | 153 |
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 void NonPresentingGvrDelegate::ResetPose() { | |
161 // Should never call RecenterTracking when using with Daydream viewers. On | |
162 // those devices recentering should only be done via the controller. | |
163 if (gvr_api_ && gvr_api_->GetViewerType() == GVR_VIEWER_TYPE_CARDBOARD) | |
164 gvr_api_->RecenterTracking(); | |
165 } | |
166 | |
167 void NonPresentingGvrDelegate::CreateVRDisplayInfo( | 160 void NonPresentingGvrDelegate::CreateVRDisplayInfo( |
168 const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback, | 161 const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback, |
169 uint32_t device_id) { | 162 uint32_t device_id) { |
170 if (!gvr_api_) { | 163 if (!gvr_api_) { |
171 callback.Run(device::mojom::VRDisplayInfoPtr(nullptr)); | 164 callback.Run(device::mojom::VRDisplayInfoPtr(nullptr)); |
172 return; | 165 return; |
173 } | 166 } |
174 | 167 |
175 gvr::Sizei webvr_size = VrShell::GetRecommendedWebVrSize(gvr_api_.get()); | 168 gvr::Sizei webvr_size = VrShell::GetRecommendedWebVrSize(gvr_api_.get()); |
176 DVLOG(1) << __FUNCTION__ << ": resize recommended to " << webvr_size.width | 169 DVLOG(1) << __FUNCTION__ << ": resize recommended to " << webvr_size.width |
177 << "x" << webvr_size.height; | 170 << "x" << webvr_size.height; |
178 callback.Run( | 171 callback.Run( |
179 VrShell::CreateVRDisplayInfo(gvr_api_.get(), webvr_size, device_id)); | 172 VrShell::CreateVRDisplayInfo(gvr_api_.get(), webvr_size, device_id)); |
180 } | 173 } |
181 | 174 |
182 } // namespace vr_shell | 175 } // namespace vr_shell |
OLD | NEW |