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 #ifndef DEVICE_VR_ANDROID_GVR_DELEGATE_H | 5 #ifndef DEVICE_VR_ANDROID_GVR_DELEGATE_H |
6 #define DEVICE_VR_ANDROID_GVR_DELEGATE_H | 6 #define DEVICE_VR_ANDROID_GVR_DELEGATE_H |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "device/vr/vr_export.h" | 10 #include "device/vr/vr_export.h" |
11 #include "device/vr/vr_service.mojom.h" | 11 #include "device/vr/vr_service.mojom.h" |
| 12 #include "device/vr/vr_types.h" |
12 #include "gpu/command_buffer/common/mailbox_holder.h" | 13 #include "gpu/command_buffer/common/mailbox_holder.h" |
13 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/
gvr_types.h" | 14 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/
gvr_types.h" |
14 | 15 |
| 16 namespace gvr { |
| 17 class GvrApi; |
| 18 } |
| 19 |
15 namespace device { | 20 namespace device { |
16 | 21 |
17 class DEVICE_VR_EXPORT GvrDelegate { | 22 class DEVICE_VR_EXPORT GvrDelegate { |
18 public: | 23 public: |
19 static mojom::VRPosePtr VRPosePtrFromGvrPose(gvr::Mat4f head_mat); | 24 static mojom::VRPosePtr VRPosePtrFromGvrPose(const vr::Mat4f& head_mat); |
20 static gvr::Mat4f GetGvrPoseWithNeckModel(gvr::GvrApi* gvr_api); | 25 static void GetGvrPoseWithNeckModel(gvr::GvrApi* gvr_api, vr::Mat4f* out); |
21 static mojom::VRPosePtr GetVRPosePtrWithNeckModel(gvr::GvrApi* gvr_api, | 26 static mojom::VRPosePtr GetVRPosePtrWithNeckModel(gvr::GvrApi* gvr_api, |
22 gvr::Mat4f* head_mat_out); | 27 vr::Mat4f* head_mat_out); |
23 static gvr::Sizei GetRecommendedWebVrSize(gvr::GvrApi* gvr_api); | 28 static gfx::Size GetRecommendedWebVrSize(gvr::GvrApi* gvr_api); |
24 static mojom::VRDisplayInfoPtr CreateVRDisplayInfo( | 29 static mojom::VRDisplayInfoPtr CreateVRDisplayInfo(gvr::GvrApi* gvr_api, |
25 gvr::GvrApi* gvr_api, | 30 gfx::Size recommended_size, |
26 gvr::Sizei recommended_size, | 31 uint32_t device_id); |
27 uint32_t device_id); | |
28 | 32 |
29 virtual void SetWebVRSecureOrigin(bool secure_origin) = 0; | 33 virtual void SetWebVRSecureOrigin(bool secure_origin) = 0; |
30 virtual void SubmitWebVRFrame(int16_t frame_index, | 34 virtual void SubmitWebVRFrame(int16_t frame_index, |
31 const gpu::MailboxHolder& mailbox) = 0; | 35 const gpu::MailboxHolder& mailbox) = 0; |
32 virtual void UpdateWebVRTextureBounds(int16_t frame_index, | 36 virtual void UpdateWebVRTextureBounds(int16_t frame_index, |
33 const gvr::Rectf& left_bounds, | 37 const gfx::RectF& left_bounds, |
34 const gvr::Rectf& right_bounds, | 38 const gfx::RectF& right_bounds, |
35 const gvr::Sizei& source_size) = 0; | 39 const gfx::Size& source_size) = 0; |
36 virtual void OnVRVsyncProviderRequest( | 40 virtual void OnVRVsyncProviderRequest( |
37 mojom::VRVSyncProviderRequest request) = 0; | 41 mojom::VRVSyncProviderRequest request) = 0; |
38 virtual void UpdateVSyncInterval(int64_t timebase_nanos, | 42 virtual void UpdateVSyncInterval(int64_t timebase_nanos, |
39 double interval_seconds) = 0; | 43 double interval_seconds) = 0; |
40 virtual void CreateVRDisplayInfo( | 44 virtual void CreateVRDisplayInfo( |
41 const base::Callback<void(mojom::VRDisplayInfoPtr)>& callback, | 45 const base::Callback<void(mojom::VRDisplayInfoPtr)>& callback, |
42 uint32_t device_id) = 0; | 46 uint32_t device_id) = 0; |
43 | 47 |
44 protected: | 48 protected: |
45 virtual ~GvrDelegate() {} | 49 virtual ~GvrDelegate() {} |
46 }; | 50 }; |
47 | 51 |
48 // GvrDelegate, which allows WebVR presentation. | 52 // GvrDelegate, which allows WebVR presentation. |
49 class DEVICE_VR_EXPORT PresentingGvrDelegate : public GvrDelegate { | 53 class DEVICE_VR_EXPORT PresentingGvrDelegate : public GvrDelegate { |
50 public: | 54 public: |
51 virtual void SetSubmitClient( | 55 virtual void SetSubmitClient( |
52 device::mojom::VRSubmitFrameClientPtr submit_client) = 0; | 56 device::mojom::VRSubmitFrameClientPtr submit_client) = 0; |
53 }; | 57 }; |
54 | 58 |
55 } // namespace device | 59 } // namespace device |
56 | 60 |
57 #endif // DEVICE_VR_ANDROID_GVR_DELEGATE_H | 61 #endif // DEVICE_VR_ANDROID_GVR_DELEGATE_H |
OLD | NEW |