| 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> |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 struct MailboxHolder; | 42 struct MailboxHolder; |
| 43 } | 43 } |
| 44 | 44 |
| 45 namespace vr_shell { | 45 namespace vr_shell { |
| 46 | 46 |
| 47 class MailboxToSurfaceBridge; | 47 class MailboxToSurfaceBridge; |
| 48 class UiScene; | 48 class UiScene; |
| 49 class VrController; | 49 class VrController; |
| 50 class VrShell; | 50 class VrShell; |
| 51 class VrShellRenderer; | 51 class VrShellRenderer; |
| 52 struct ContentRectangle; | 52 struct UiElement; |
| 53 | 53 |
| 54 struct WebVrBounds { | 54 struct WebVrBounds { |
| 55 WebVrBounds(const gfx::RectF& left, | 55 WebVrBounds(const gfx::RectF& left, |
| 56 const gfx::RectF& right, | 56 const gfx::RectF& right, |
| 57 const gfx::Size& size) | 57 const gfx::Size& size) |
| 58 : left_bounds(left), right_bounds(right), source_size(size) {} | 58 : left_bounds(left), right_bounds(right), source_size(size) {} |
| 59 gfx::RectF left_bounds; | 59 gfx::RectF left_bounds; |
| 60 gfx::RectF right_bounds; | 60 gfx::RectF right_bounds; |
| 61 gfx::Size source_size; | 61 gfx::Size source_size; |
| 62 }; | 62 }; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 void SetSubmitClient( | 113 void SetSubmitClient( |
| 114 device::mojom::VRSubmitFrameClientPtrInfo submit_client_info); | 114 device::mojom::VRSubmitFrameClientPtrInfo submit_client_info); |
| 115 | 115 |
| 116 private: | 116 private: |
| 117 void GvrInit(gvr_context* gvr_api); | 117 void GvrInit(gvr_context* gvr_api); |
| 118 void InitializeRenderer(); | 118 void InitializeRenderer(); |
| 119 void DrawFrame(int16_t frame_index); | 119 void DrawFrame(int16_t frame_index); |
| 120 void DrawWorldElements(const vr::Mat4f& head_pose); | 120 void DrawWorldElements(const vr::Mat4f& head_pose); |
| 121 void DrawHeadLockedElements(); | 121 void DrawHeadLockedElements(); |
| 122 void DrawUiView(const vr::Mat4f& head_pose, | 122 void DrawUiView(const vr::Mat4f& head_pose, |
| 123 const std::vector<const ContentRectangle*>& elements, | 123 const std::vector<const UiElement*>& elements, |
| 124 const gfx::Size& render_size, | 124 const gfx::Size& render_size, |
| 125 int viewport_offset, | 125 int viewport_offset, |
| 126 bool draw_cursor); | 126 bool draw_cursor); |
| 127 void DrawElements(const vr::Mat4f& view_proj_matrix, | 127 void DrawElements(const vr::Mat4f& view_proj_matrix, |
| 128 const std::vector<const ContentRectangle*>& elements); | 128 const std::vector<const UiElement*>& elements); |
| 129 std::vector<const ContentRectangle*> GetElementsInDrawOrder( | 129 std::vector<const UiElement*> GetElementsInDrawOrder( |
| 130 const vr::Mat4f& view_matrix, | 130 const vr::Mat4f& view_matrix, |
| 131 const std::vector<const ContentRectangle*>& elements); | 131 const std::vector<const UiElement*>& elements); |
| 132 void DrawCursor(const vr::Mat4f& render_matrix); | 132 void DrawCursor(const vr::Mat4f& render_matrix); |
| 133 void DrawController(const vr::Mat4f& view_proj_matrix); | 133 void DrawController(const vr::Mat4f& view_proj_matrix); |
| 134 bool ShouldDrawWebVr(); | 134 bool ShouldDrawWebVr(); |
| 135 void DrawWebVr(); | 135 void DrawWebVr(); |
| 136 bool WebVrPoseByteIsValid(int pose_index_byte); | 136 bool WebVrPoseByteIsValid(int pose_index_byte); |
| 137 | 137 |
| 138 void UpdateController(); | 138 void UpdateController(); |
| 139 void HandleControllerInput(const gfx::Vector3dF& forward_vector); | 139 void HandleControllerInput(const gfx::Vector3dF& forward_vector); |
| 140 void HandleControllerAppButtonActivity( | 140 void HandleControllerAppButtonActivity( |
| 141 const gfx::Vector3dF& controller_direction); | 141 const gfx::Vector3dF& controller_direction); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 // Intended render_size_primary_ for use by VrShell, so that it | 195 // Intended render_size_primary_ for use by VrShell, so that it |
| 196 // can be restored after exiting WebVR mode. | 196 // can be restored after exiting WebVR mode. |
| 197 gfx::Size render_size_vrshell_; | 197 gfx::Size render_size_vrshell_; |
| 198 | 198 |
| 199 std::unique_ptr<VrShellRenderer> vr_shell_renderer_; | 199 std::unique_ptr<VrShellRenderer> vr_shell_renderer_; |
| 200 | 200 |
| 201 bool touch_pending_ = false; | 201 bool touch_pending_ = false; |
| 202 vr::Quatf controller_quat_; | 202 vr::Quatf controller_quat_; |
| 203 | 203 |
| 204 gfx::Point3F target_point_; | 204 gfx::Point3F target_point_; |
| 205 const ContentRectangle* target_element_ = nullptr; | 205 const UiElement* target_element_ = nullptr; |
| 206 InputTarget current_input_target_ = InputTarget::NONE; | 206 InputTarget current_input_target_ = InputTarget::NONE; |
| 207 InputTarget current_scroll_target = InputTarget::NONE; | 207 InputTarget current_scroll_target = InputTarget::NONE; |
| 208 int ui_tex_css_width_ = 0; | 208 int ui_tex_css_width_ = 0; |
| 209 int ui_tex_css_height_ = 0; | 209 int ui_tex_css_height_ = 0; |
| 210 int content_tex_css_width_ = 0; | 210 int content_tex_css_width_ = 0; |
| 211 int content_tex_css_height_ = 0; | 211 int content_tex_css_height_ = 0; |
| 212 gfx::Size content_tex_physical_size_ = {0, 0}; | 212 gfx::Size content_tex_physical_size_ = {0, 0}; |
| 213 gfx::Size webvr_surface_size_ = {0, 0}; | 213 gfx::Size webvr_surface_size_ = {0, 0}; |
| 214 gfx::Size ui_tex_physical_size_ = {0, 0}; | 214 gfx::Size ui_tex_physical_size_ = {0, 0}; |
| 215 | 215 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 243 gfx::Vector3dF controller_start_direction_; | 243 gfx::Vector3dF controller_start_direction_; |
| 244 | 244 |
| 245 base::WeakPtrFactory<VrShellGl> weak_ptr_factory_; | 245 base::WeakPtrFactory<VrShellGl> weak_ptr_factory_; |
| 246 | 246 |
| 247 DISALLOW_COPY_AND_ASSIGN(VrShellGl); | 247 DISALLOW_COPY_AND_ASSIGN(VrShellGl); |
| 248 }; | 248 }; |
| 249 | 249 |
| 250 } // namespace vr_shell | 250 } // namespace vr_shell |
| 251 | 251 |
| 252 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_GL_H_ | 252 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_GL_H_ |
| OLD | NEW |