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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 GLuint mid_ring_opacity_handle_; | 145 GLuint mid_ring_opacity_handle_; |
146 | 146 |
147 DISALLOW_COPY_AND_ASSIGN(ReticleRenderer); | 147 DISALLOW_COPY_AND_ASSIGN(ReticleRenderer); |
148 }; | 148 }; |
149 | 149 |
150 class LaserRenderer : public BaseQuadRenderer { | 150 class LaserRenderer : public BaseQuadRenderer { |
151 public: | 151 public: |
152 LaserRenderer(); | 152 LaserRenderer(); |
153 ~LaserRenderer() override; | 153 ~LaserRenderer() override; |
154 | 154 |
155 void Draw(const gvr::Mat4f& view_proj_matrix); | 155 void Draw(float opacity, const gvr::Mat4f& view_proj_matrix); |
156 | 156 |
157 private: | 157 private: |
158 GLuint model_view_proj_matrix_handle_; | 158 GLuint model_view_proj_matrix_handle_; |
159 GLuint texture_unit_handle_; | 159 GLuint texture_unit_handle_; |
160 GLuint texture_data_handle_; | 160 GLuint texture_data_handle_; |
161 GLuint color_handle_; | 161 GLuint color_handle_; |
162 GLuint fade_point_handle_; | 162 GLuint fade_point_handle_; |
163 GLuint fade_end_handle_; | 163 GLuint fade_end_handle_; |
| 164 GLuint opacity_handle_; |
164 | 165 |
165 DISALLOW_COPY_AND_ASSIGN(LaserRenderer); | 166 DISALLOW_COPY_AND_ASSIGN(LaserRenderer); |
166 }; | 167 }; |
167 | 168 |
168 class ControllerRenderer : public BaseRenderer { | 169 class ControllerRenderer : public BaseRenderer { |
169 public: | 170 public: |
170 ControllerRenderer(); | 171 ControllerRenderer(); |
171 ~ControllerRenderer() override; | 172 ~ControllerRenderer() override; |
172 | 173 |
173 void SetUp(std::unique_ptr<VrControllerModel> model); | 174 void SetUp(std::unique_ptr<VrControllerModel> model); |
174 void Draw(VrControllerModel::State state, const gvr::Mat4f& view_proj_matrix); | 175 void Draw(VrControllerModel::State state, |
| 176 float opacity, |
| 177 const gvr::Mat4f& view_proj_matrix); |
175 bool IsSetUp() const { return setup_; } | 178 bool IsSetUp() const { return setup_; } |
176 | 179 |
177 private: | 180 private: |
178 GLuint model_view_proj_matrix_handle_; | 181 GLuint model_view_proj_matrix_handle_; |
179 GLuint tex_uniform_handle_; | 182 GLuint tex_uniform_handle_; |
| 183 GLuint opacity_handle_; |
180 GLuint indices_buffer_ = 0; | 184 GLuint indices_buffer_ = 0; |
181 GLuint vertex_buffer_ = 0; | 185 GLuint vertex_buffer_ = 0; |
182 GLint position_components_ = 0; | 186 GLint position_components_ = 0; |
183 GLenum position_type_ = GL_FLOAT; | 187 GLenum position_type_ = GL_FLOAT; |
184 GLsizei position_stride_ = 0; | 188 GLsizei position_stride_ = 0; |
185 const GLvoid* position_offset_ = nullptr; | 189 const GLvoid* position_offset_ = nullptr; |
186 GLint tex_coord_components_ = 0; | 190 GLint tex_coord_components_ = 0; |
187 GLenum tex_coord_type_ = GL_FLOAT; | 191 GLenum tex_coord_type_ = GL_FLOAT; |
188 GLsizei tex_coord_stride_ = 0; | 192 GLsizei tex_coord_stride_ = 0; |
189 const GLvoid* tex_coord_offset_ = nullptr; | 193 const GLvoid* tex_coord_offset_ = nullptr; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 std::unique_ptr<ControllerRenderer> controller_renderer_; | 281 std::unique_ptr<ControllerRenderer> controller_renderer_; |
278 std::unique_ptr<GradientQuadRenderer> gradient_quad_renderer_; | 282 std::unique_ptr<GradientQuadRenderer> gradient_quad_renderer_; |
279 std::unique_ptr<GradientGridRenderer> gradient_grid_renderer_; | 283 std::unique_ptr<GradientGridRenderer> gradient_grid_renderer_; |
280 | 284 |
281 DISALLOW_COPY_AND_ASSIGN(VrShellRenderer); | 285 DISALLOW_COPY_AND_ASSIGN(VrShellRenderer); |
282 }; | 286 }; |
283 | 287 |
284 } // namespace vr_shell | 288 } // namespace vr_shell |
285 | 289 |
286 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_RENDERER_H_ | 290 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_RENDERER_H_ |
OLD | NEW |