| 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 "device/vr/android/gvr/gvr_device.h" | 5 #include "device/vr/android/gvr/gvr_device.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 | 9 |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 | 181 |
| 182 // Save the underlying GVR pose for use by rendering. It can't use a | 182 // Save the underlying GVR pose for use by rendering. It can't use a |
| 183 // VRPosePtr since that's a different data type. | 183 // VRPosePtr since that's a different data type. |
| 184 delegate_->SetGvrPoseForWebVr(head_mat, pose_index_); | 184 delegate_->SetGvrPoseForWebVr(head_mat, pose_index_); |
| 185 | 185 |
| 186 return pose; | 186 return pose; |
| 187 } | 187 } |
| 188 | 188 |
| 189 void GvrDevice::ResetPose() { | 189 void GvrDevice::ResetPose() { |
| 190 gvr::GvrApi* gvr_api = GetGvrApi(); | 190 gvr::GvrApi* gvr_api = GetGvrApi(); |
| 191 if (gvr_api) | 191 |
| 192 gvr_api->ResetTracking(); | 192 // Should never call RecenterTracking when using with Daydream viewers. On |
| 193 // those devices recentering should only be done via the controller. |
| 194 if (gvr_api && gvr_api->GetViewerType() == GVR_VIEWER_TYPE_CARDBOARD) |
| 195 gvr_api->RecenterTracking(); |
| 193 } | 196 } |
| 194 | 197 |
| 195 bool GvrDevice::RequestPresent(bool secure_origin) { | 198 bool GvrDevice::RequestPresent(bool secure_origin) { |
| 196 secure_origin_ = secure_origin; | 199 secure_origin_ = secure_origin; |
| 197 if (delegate_) | 200 if (delegate_) |
| 198 delegate_->SetWebVRSecureOrigin(secure_origin_); | 201 delegate_->SetWebVRSecureOrigin(secure_origin_); |
| 199 return gvr_provider_->RequestPresent(); | 202 return gvr_provider_->RequestPresent(); |
| 200 } | 203 } |
| 201 | 204 |
| 202 void GvrDevice::ExitPresent() { | 205 void GvrDevice::ExitPresent() { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 232 } | 235 } |
| 233 | 236 |
| 234 gvr::GvrApi* GvrDevice::GetGvrApi() { | 237 gvr::GvrApi* GvrDevice::GetGvrApi() { |
| 235 if (!delegate_) | 238 if (!delegate_) |
| 236 return nullptr; | 239 return nullptr; |
| 237 | 240 |
| 238 return delegate_->gvr_api(); | 241 return delegate_->gvr_api(); |
| 239 } | 242 } |
| 240 | 243 |
| 241 } // namespace device | 244 } // namespace device |
| OLD | NEW |