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 | 9 |
10 #include "base/cancelable_callback.h" | 10 #include "base/cancelable_callback.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
15 #include "device/vr/android/gvr/gvr_delegate.h" | 15 #include "device/vr/android/gvr/gvr_delegate.h" |
16 #include "third_party/gvr-android-sdk/src/ndk/include/vr/gvr/capi/include/gvr.h" | 16 #include "third_party/gvr-android-sdk/src/ndk/include/vr/gvr/capi/include/gvr.h" |
17 #include "third_party/gvr-android-sdk/src/ndk/include/vr/gvr/capi/include/gvr_ty
pes.h" | 17 #include "third_party/gvr-android-sdk/src/ndk/include/vr/gvr/capi/include/gvr_ty
pes.h" |
18 #include "ui/gfx/native_widget_types.h" | 18 #include "ui/gfx/native_widget_types.h" |
19 | 19 |
| 20 namespace base { |
| 21 class ListValue; |
| 22 } |
| 23 |
20 namespace blink { | 24 namespace blink { |
21 class WebInputEvent; | 25 class WebInputEvent; |
22 } | 26 } |
23 | 27 |
24 namespace gl { | 28 namespace gl { |
25 class GLContext; | 29 class GLContext; |
26 class GLSurface; | 30 class GLSurface; |
27 class ScopedJavaSurface; | 31 class ScopedJavaSurface; |
28 class SurfaceTexture; | 32 class SurfaceTexture; |
29 } | 33 } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 void UIBoundsChanged(int width, int height); | 74 void UIBoundsChanged(int width, int height); |
71 void UIPhysicalBoundsChanged(int width, int height); | 75 void UIPhysicalBoundsChanged(int width, int height); |
72 base::WeakPtr<VrShellGl> GetWeakPtr(); | 76 base::WeakPtr<VrShellGl> GetWeakPtr(); |
73 | 77 |
74 void UpdateWebVRTextureBounds(const gvr::Rectf& left_bounds, | 78 void UpdateWebVRTextureBounds(const gvr::Rectf& left_bounds, |
75 const gvr::Rectf& right_bounds); | 79 const gvr::Rectf& right_bounds); |
76 gvr::GvrApi* gvr_api(); | 80 gvr::GvrApi* gvr_api(); |
77 void SetGvrPoseForWebVr(const gvr::Mat4f& pose, uint32_t pose_num); | 81 void SetGvrPoseForWebVr(const gvr::Mat4f& pose, uint32_t pose_num); |
78 gvr::Sizei GetWebVRCompositorSurfaceSize(); | 82 gvr::Sizei GetWebVRCompositorSurfaceSize(); |
79 | 83 |
80 UiScene* GetScene() { return scene_.get(); } | 84 void UpdateScene(std::unique_ptr<base::ListValue> commands); |
81 | 85 |
82 private: | 86 private: |
83 bool InitializeGl(); | 87 bool InitializeGl(); |
84 void GvrInit(gvr_context* gvr_api); | 88 void GvrInit(gvr_context* gvr_api); |
85 void InitializeRenderer(); | 89 void InitializeRenderer(); |
86 void DrawVrShell(const gvr::Mat4f& head_pose, gvr::Frame &frame); | 90 void DrawVrShell(const gvr::Mat4f& head_pose, gvr::Frame &frame); |
87 void DrawUiView(const gvr::Mat4f* head_pose, | 91 void DrawUiView(const gvr::Mat4f* head_pose, |
88 const std::vector<const ContentRectangle*>& elements, | 92 const std::vector<const ContentRectangle*>& elements, |
89 const gvr::Sizei& render_size, int viewport_offset); | 93 const gvr::Sizei& render_size, int viewport_offset); |
90 void DrawElements(const gvr::Mat4f& render_matrix, | 94 void DrawElements(const gvr::Mat4f& render_matrix, |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; | 178 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; |
175 | 179 |
176 base::WeakPtrFactory<VrShellGl> weak_ptr_factory_; | 180 base::WeakPtrFactory<VrShellGl> weak_ptr_factory_; |
177 | 181 |
178 DISALLOW_COPY_AND_ASSIGN(VrShellGl); | 182 DISALLOW_COPY_AND_ASSIGN(VrShellGl); |
179 }; | 183 }; |
180 | 184 |
181 } // namespace vr_shell | 185 } // namespace vr_shell |
182 | 186 |
183 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_GL_H_ | 187 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_GL_H_ |
OLD | NEW |