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_RENDERER_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_RENDERER_H_ |
6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_RENDERER_H_ | 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_RENDERER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <queue> | 9 #include <queue> |
10 #include <vector> | 10 #include <vector> |
(...skipping 19 matching lines...) Expand all Loading... |
30 RETICLE_VERTEX_SHADER, | 30 RETICLE_VERTEX_SHADER, |
31 RETICLE_FRAGMENT_SHADER, | 31 RETICLE_FRAGMENT_SHADER, |
32 LASER_VERTEX_SHADER, | 32 LASER_VERTEX_SHADER, |
33 LASER_FRAGMENT_SHADER, | 33 LASER_FRAGMENT_SHADER, |
34 GRADIENT_QUAD_VERTEX_SHADER, | 34 GRADIENT_QUAD_VERTEX_SHADER, |
35 GRADIENT_QUAD_FRAGMENT_SHADER, | 35 GRADIENT_QUAD_FRAGMENT_SHADER, |
36 GRADIENT_GRID_VERTEX_SHADER, | 36 GRADIENT_GRID_VERTEX_SHADER, |
37 GRADIENT_GRID_FRAGMENT_SHADER, | 37 GRADIENT_GRID_FRAGMENT_SHADER, |
38 CONTROLLER_VERTEX_SHADER, | 38 CONTROLLER_VERTEX_SHADER, |
39 CONTROLLER_FRAGMENT_SHADER, | 39 CONTROLLER_FRAGMENT_SHADER, |
| 40 SKIA_QUAD_VERTEX_SHADER, |
| 41 SKIA_QUAD_FRAGMENT_SHADER, |
40 SHADER_ID_MAX | 42 SHADER_ID_MAX |
41 }; | 43 }; |
42 | 44 |
43 struct Vertex3d { | 45 struct Vertex3d { |
44 float x; | 46 float x; |
45 float y; | 47 float y; |
46 float z; | 48 float z; |
47 }; | 49 }; |
48 | 50 |
49 struct RectF { | 51 struct RectF { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 GLuint model_view_proj_matrix_handle_; | 114 GLuint model_view_proj_matrix_handle_; |
113 GLuint copy_rect_uniform_handle_; | 115 GLuint copy_rect_uniform_handle_; |
114 GLuint tex_uniform_handle_; | 116 GLuint tex_uniform_handle_; |
115 GLuint opacity_handle_; | 117 GLuint opacity_handle_; |
116 | 118 |
117 std::queue<TexturedQuad> quad_queue_; | 119 std::queue<TexturedQuad> quad_queue_; |
118 | 120 |
119 DISALLOW_COPY_AND_ASSIGN(TexturedQuadRenderer); | 121 DISALLOW_COPY_AND_ASSIGN(TexturedQuadRenderer); |
120 }; | 122 }; |
121 | 123 |
| 124 class SkiaQuadRenderer : public BaseQuadRenderer { |
| 125 public: |
| 126 SkiaQuadRenderer(); |
| 127 ~SkiaQuadRenderer() override; |
| 128 |
| 129 // Draw the content rect in the texture quad. |
| 130 void Draw(int texture_data_handle, |
| 131 const vr::Mat4f& view_proj_matrix, |
| 132 const gfx::RectF& copy_rect, |
| 133 float opacity); |
| 134 |
| 135 private: |
| 136 GLuint model_view_proj_matrix_handle_; |
| 137 GLuint copy_rect_uniform_handle_; |
| 138 GLuint tex_uniform_handle_; |
| 139 GLuint opacity_handle_; |
| 140 |
| 141 DISALLOW_COPY_AND_ASSIGN(SkiaQuadRenderer); |
| 142 }; |
| 143 |
122 // Renders a page-generated stereo VR view. | 144 // Renders a page-generated stereo VR view. |
123 class WebVrRenderer : public BaseQuadRenderer { | 145 class WebVrRenderer : public BaseQuadRenderer { |
124 public: | 146 public: |
125 WebVrRenderer(); | 147 WebVrRenderer(); |
126 ~WebVrRenderer() override; | 148 ~WebVrRenderer() override; |
127 | 149 |
128 void Draw(int texture_handle); | 150 void Draw(int texture_handle); |
129 | 151 |
130 private: | 152 private: |
131 GLuint tex_uniform_handle_; | 153 GLuint tex_uniform_handle_; |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 std::unique_ptr<ControllerRenderer> controller_renderer_; | 305 std::unique_ptr<ControllerRenderer> controller_renderer_; |
284 std::unique_ptr<GradientQuadRenderer> gradient_quad_renderer_; | 306 std::unique_ptr<GradientQuadRenderer> gradient_quad_renderer_; |
285 std::unique_ptr<GradientGridRenderer> gradient_grid_renderer_; | 307 std::unique_ptr<GradientGridRenderer> gradient_grid_renderer_; |
286 | 308 |
287 DISALLOW_COPY_AND_ASSIGN(VrShellRenderer); | 309 DISALLOW_COPY_AND_ASSIGN(VrShellRenderer); |
288 }; | 310 }; |
289 | 311 |
290 } // namespace vr_shell | 312 } // namespace vr_shell |
291 | 313 |
292 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_RENDERER_H_ | 314 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_RENDERER_H_ |
OLD | NEW |