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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 GLuint mid_ring_opacity_handle_; | 171 GLuint mid_ring_opacity_handle_; |
172 | 172 |
173 DISALLOW_COPY_AND_ASSIGN(ReticleRenderer); | 173 DISALLOW_COPY_AND_ASSIGN(ReticleRenderer); |
174 }; | 174 }; |
175 | 175 |
176 class LaserRenderer : public BaseQuadRenderer { | 176 class LaserRenderer : public BaseQuadRenderer { |
177 public: | 177 public: |
178 LaserRenderer(); | 178 LaserRenderer(); |
179 ~LaserRenderer() override; | 179 ~LaserRenderer() override; |
180 | 180 |
181 void Draw(const vr::Mat4f& view_proj_matrix); | 181 void Draw(float opacity, const vr::Mat4f& view_proj_matrix); |
182 | 182 |
183 private: | 183 private: |
184 GLuint model_view_proj_matrix_handle_; | 184 GLuint model_view_proj_matrix_handle_; |
185 GLuint texture_unit_handle_; | 185 GLuint texture_unit_handle_; |
186 GLuint texture_data_handle_; | 186 GLuint texture_data_handle_; |
187 GLuint color_handle_; | 187 GLuint color_handle_; |
188 GLuint fade_point_handle_; | 188 GLuint fade_point_handle_; |
189 GLuint fade_end_handle_; | 189 GLuint fade_end_handle_; |
| 190 GLuint opacity_handle_; |
190 | 191 |
191 DISALLOW_COPY_AND_ASSIGN(LaserRenderer); | 192 DISALLOW_COPY_AND_ASSIGN(LaserRenderer); |
192 }; | 193 }; |
193 | 194 |
194 class ControllerRenderer : public BaseRenderer { | 195 class ControllerRenderer : public BaseRenderer { |
195 public: | 196 public: |
196 ControllerRenderer(); | 197 ControllerRenderer(); |
197 ~ControllerRenderer() override; | 198 ~ControllerRenderer() override; |
198 | 199 |
199 void SetUp(std::unique_ptr<VrControllerModel> model); | 200 void SetUp(std::unique_ptr<VrControllerModel> model); |
200 void Draw(VrControllerModel::State state, const vr::Mat4f& view_proj_matrix); | 201 void Draw(VrControllerModel::State state, |
| 202 float opacity, |
| 203 const vr::Mat4f& view_proj_matrix); |
201 bool IsSetUp() const { return setup_; } | 204 bool IsSetUp() const { return setup_; } |
202 | 205 |
203 private: | 206 private: |
204 GLuint model_view_proj_matrix_handle_; | 207 GLuint model_view_proj_matrix_handle_; |
205 GLuint tex_uniform_handle_; | 208 GLuint tex_uniform_handle_; |
| 209 GLuint opacity_handle_; |
206 GLuint indices_buffer_ = 0; | 210 GLuint indices_buffer_ = 0; |
207 GLuint vertex_buffer_ = 0; | 211 GLuint vertex_buffer_ = 0; |
208 GLint position_components_ = 0; | 212 GLint position_components_ = 0; |
209 GLenum position_type_ = GL_FLOAT; | 213 GLenum position_type_ = GL_FLOAT; |
210 GLsizei position_stride_ = 0; | 214 GLsizei position_stride_ = 0; |
211 const GLvoid* position_offset_ = nullptr; | 215 const GLvoid* position_offset_ = nullptr; |
212 GLint tex_coord_components_ = 0; | 216 GLint tex_coord_components_ = 0; |
213 GLenum tex_coord_type_ = GL_FLOAT; | 217 GLenum tex_coord_type_ = GL_FLOAT; |
214 GLsizei tex_coord_stride_ = 0; | 218 GLsizei tex_coord_stride_ = 0; |
215 const GLvoid* tex_coord_offset_ = nullptr; | 219 const GLvoid* tex_coord_offset_ = nullptr; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 std::unique_ptr<ControllerRenderer> controller_renderer_; | 297 std::unique_ptr<ControllerRenderer> controller_renderer_; |
294 std::unique_ptr<GradientQuadRenderer> gradient_quad_renderer_; | 298 std::unique_ptr<GradientQuadRenderer> gradient_quad_renderer_; |
295 std::unique_ptr<GradientGridRenderer> gradient_grid_renderer_; | 299 std::unique_ptr<GradientGridRenderer> gradient_grid_renderer_; |
296 | 300 |
297 DISALLOW_COPY_AND_ASSIGN(VrShellRenderer); | 301 DISALLOW_COPY_AND_ASSIGN(VrShellRenderer); |
298 }; | 302 }; |
299 | 303 |
300 } // namespace vr_shell | 304 } // namespace vr_shell |
301 | 305 |
302 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_RENDERER_H_ | 306 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_RENDERER_H_ |
OLD | NEW |