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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 void SetWebVRRenderSurfaceSize(int width, int height); | 82 void SetWebVRRenderSurfaceSize(int width, int height); |
79 gvr::Sizei GetWebVRCompositorSurfaceSize(); | 83 gvr::Sizei GetWebVRCompositorSurfaceSize(); |
80 | 84 |
81 UiScene* GetScene() { return scene_.get(); } | 85 void UpdateScene(std::unique_ptr<base::ListValue> commands); |
82 | 86 |
83 private: | 87 private: |
84 bool InitializeGl(); | 88 bool InitializeGl(); |
85 void GvrInit(gvr_context* gvr_api); | 89 void GvrInit(gvr_context* gvr_api); |
86 void InitializeRenderer(); | 90 void InitializeRenderer(); |
87 void DrawVrShell(const gvr::Mat4f& head_pose, gvr::Frame &frame); | 91 void DrawVrShell(const gvr::Mat4f& head_pose, gvr::Frame &frame); |
88 void DrawUiView(const gvr::Mat4f* head_pose, | 92 void DrawUiView(const gvr::Mat4f* head_pose, |
89 const std::vector<const ContentRectangle*>& elements, | 93 const std::vector<const ContentRectangle*>& elements, |
90 const gvr::Sizei& render_size, int viewport_offset); | 94 const gvr::Sizei& render_size, int viewport_offset); |
91 void DrawElements(const gvr::Mat4f& render_matrix, | 95 void DrawElements(const gvr::Mat4f& render_matrix, |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; | 185 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; |
182 | 186 |
183 base::WeakPtrFactory<VrShellGl> weak_ptr_factory_; | 187 base::WeakPtrFactory<VrShellGl> weak_ptr_factory_; |
184 | 188 |
185 DISALLOW_COPY_AND_ASSIGN(VrShellGl); | 189 DISALLOW_COPY_AND_ASSIGN(VrShellGl); |
186 }; | 190 }; |
187 | 191 |
188 } // namespace vr_shell | 192 } // namespace vr_shell |
189 | 193 |
190 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_GL_H_ | 194 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_GL_H_ |
OLD | NEW |