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 CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_GL_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_GL_H_ |
6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_GL_H_ | 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_GL_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <queue> | 9 #include <queue> |
10 #include <utility> | 10 #include <utility> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/cancelable_callback.h" | 13 #include "base/cancelable_callback.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
17 #include "base/single_thread_task_runner.h" | 17 #include "base/single_thread_task_runner.h" |
| 18 #include "chrome/browser/android/vr_shell/vr_controller_model.h" |
18 #include "device/vr/android/gvr/gvr_delegate.h" | 19 #include "device/vr/android/gvr/gvr_delegate.h" |
19 #include "device/vr/vr_service.mojom.h" | 20 #include "device/vr/vr_service.mojom.h" |
20 #include "mojo/public/cpp/bindings/binding.h" | 21 #include "mojo/public/cpp/bindings/binding.h" |
21 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/
gvr.h" | 22 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/
gvr.h" |
22 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/
gvr_types.h" | 23 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/
gvr_types.h" |
23 #include "ui/gfx/native_widget_types.h" | 24 #include "ui/gfx/native_widget_types.h" |
24 | 25 |
25 namespace base { | 26 namespace base { |
26 class ListValue; | 27 class ListValue; |
27 } | 28 } |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 85 |
85 void SetWebVrMode(bool enabled); | 86 void SetWebVrMode(bool enabled); |
86 void CreateOrResizeWebVRSurface(const gvr::Sizei& size); | 87 void CreateOrResizeWebVRSurface(const gvr::Sizei& size); |
87 void CreateContentSurface(); | 88 void CreateContentSurface(); |
88 void ContentBoundsChanged(int width, int height); | 89 void ContentBoundsChanged(int width, int height); |
89 void ContentPhysicalBoundsChanged(int width, int height); | 90 void ContentPhysicalBoundsChanged(int width, int height); |
90 void UIBoundsChanged(int width, int height); | 91 void UIBoundsChanged(int width, int height); |
91 void UIPhysicalBoundsChanged(int width, int height); | 92 void UIPhysicalBoundsChanged(int width, int height); |
92 base::WeakPtr<VrShellGl> GetWeakPtr(); | 93 base::WeakPtr<VrShellGl> GetWeakPtr(); |
93 | 94 |
| 95 void SetControllerModel(std::unique_ptr<VrControllerModel> model); |
| 96 |
94 void UpdateWebVRTextureBounds(int16_t frame_index, | 97 void UpdateWebVRTextureBounds(int16_t frame_index, |
95 const gvr::Rectf& left_bounds, | 98 const gvr::Rectf& left_bounds, |
96 const gvr::Rectf& right_bounds, | 99 const gvr::Rectf& right_bounds, |
97 const gvr::Sizei& source_size); | 100 const gvr::Sizei& source_size); |
98 | 101 |
99 void UpdateScene(std::unique_ptr<base::ListValue> commands); | 102 void UpdateScene(std::unique_ptr<base::ListValue> commands); |
100 | 103 |
101 void UpdateVSyncInterval(int64_t timebase_nanos, double interval_seconds); | 104 void UpdateVSyncInterval(int64_t timebase_nanos, double interval_seconds); |
102 | 105 |
103 void OnRequest(device::mojom::VRVSyncProviderRequest request); | 106 void OnRequest(device::mojom::VRVSyncProviderRequest request); |
(...skipping 15 matching lines...) Expand all Loading... |
119 const std::vector<const ContentRectangle*>& elements, | 122 const std::vector<const ContentRectangle*>& elements, |
120 const gvr::Sizei& render_size, | 123 const gvr::Sizei& render_size, |
121 int viewport_offset, | 124 int viewport_offset, |
122 bool draw_cursor); | 125 bool draw_cursor); |
123 void DrawElements(const gvr::Mat4f& view_proj_matrix, | 126 void DrawElements(const gvr::Mat4f& view_proj_matrix, |
124 const std::vector<const ContentRectangle*>& elements); | 127 const std::vector<const ContentRectangle*>& elements); |
125 std::vector<const ContentRectangle*> GetElementsInDrawOrder( | 128 std::vector<const ContentRectangle*> GetElementsInDrawOrder( |
126 const gvr::Mat4f& view_matrix, | 129 const gvr::Mat4f& view_matrix, |
127 const std::vector<const ContentRectangle*>& elements); | 130 const std::vector<const ContentRectangle*>& elements); |
128 void DrawCursor(const gvr::Mat4f& render_matrix); | 131 void DrawCursor(const gvr::Mat4f& render_matrix); |
| 132 void DrawController(const gvr::Mat4f& view_proj_matrix); |
129 bool ShouldDrawWebVr(); | 133 bool ShouldDrawWebVr(); |
130 void DrawWebVr(); | 134 void DrawWebVr(); |
131 bool WebVrPoseByteIsValid(int pose_index_byte); | 135 bool WebVrPoseByteIsValid(int pose_index_byte); |
132 | 136 |
133 void UpdateController(); | 137 void UpdateController(); |
134 void HandleControllerInput(const gvr::Vec3f& forward_vector); | 138 void HandleControllerInput(const gvr::Vec3f& forward_vector); |
135 void HandleControllerAppButtonActivity( | 139 void HandleControllerAppButtonActivity( |
136 const gvr::Vec3f& controller_direction); | 140 const gvr::Vec3f& controller_direction); |
137 void SendEventsToTarget(InputTarget input_target, int pixel_x, int pixel_y); | 141 void SendEventsToTarget(InputTarget input_target, int pixel_x, int pixel_y); |
138 void SendGesture(InputTarget input_target, | 142 void SendGesture(InputTarget input_target, |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 gvr::Vec3f controller_start_direction_; | 242 gvr::Vec3f controller_start_direction_; |
239 | 243 |
240 base::WeakPtrFactory<VrShellGl> weak_ptr_factory_; | 244 base::WeakPtrFactory<VrShellGl> weak_ptr_factory_; |
241 | 245 |
242 DISALLOW_COPY_AND_ASSIGN(VrShellGl); | 246 DISALLOW_COPY_AND_ASSIGN(VrShellGl); |
243 }; | 247 }; |
244 | 248 |
245 } // namespace vr_shell | 249 } // namespace vr_shell |
246 | 250 |
247 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_GL_H_ | 251 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_GL_H_ |
OLD | NEW |