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