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 #include "chrome/browser/android/vr_shell/vr_shell_renderer.h" | 5 #include "chrome/browser/android/vr_shell/vr_shell_renderer.h" |
6 | 6 |
7 #include "chrome/browser/android/vr_shell/vr_gl_util.h" | 7 #include "chrome/browser/android/vr_shell/vr_gl_util.h" |
8 | 8 |
9 namespace { | 9 namespace { |
10 | 10 |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 mediump float hole_alpha = | 144 mediump float hole_alpha = |
145 clamp((r - hole_radius) / color_feather_radius, 0.0, 1.0); | 145 clamp((r - hole_radius) / color_feather_radius, 0.0, 1.0); |
146 | 146 |
147 mediump float black_radius = mid_ring_end * ring_diameter; | 147 mediump float black_radius = mid_ring_end * ring_diameter; |
148 mediump float black_feather = | 148 mediump float black_feather = |
149 1.0 / (ring_diameter * 0.5 - black_radius); | 149 1.0 / (ring_diameter * 0.5 - black_radius); |
150 mediump float black_alpha_factor = | 150 mediump float black_alpha_factor = |
151 mid_ring_opacity * (1.0 - (r - black_radius) * black_feather); | 151 mid_ring_opacity * (1.0 - (r - black_radius) * black_feather); |
152 mediump float alpha = clamp( | 152 mediump float alpha = clamp( |
153 min(hole_alpha, max(color1, black_alpha_factor)), 0.0, 1.0); | 153 min(hole_alpha, max(color1, black_alpha_factor)), 0.0, 1.0); |
154 vec3 color_rgb = color1 * color.xyz; | 154 lowp vec3 color_rgb = color1 * color.xyz; |
155 gl_FragColor = vec4(color_rgb, color.w * alpha); | 155 gl_FragColor = vec4(color_rgb, color.w * alpha); |
156 }); | 156 }); |
157 case vr_shell::ShaderID::LASER_FRAGMENT_SHADER: | 157 case vr_shell::ShaderID::LASER_FRAGMENT_SHADER: |
158 return SHADER( | 158 return SHADER( |
159 varying mediump vec2 v_TexCoordinate; | 159 varying mediump vec2 v_TexCoordinate; |
160 uniform sampler2D texture_unit; | 160 uniform sampler2D texture_unit; |
161 uniform lowp vec4 color; | 161 uniform lowp vec4 color; |
162 uniform mediump float fade_point; | 162 uniform mediump float fade_point; |
163 uniform mediump float fade_end; | 163 uniform mediump float fade_end; |
164 | 164 |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 | 448 |
449 VrShellRenderer::VrShellRenderer() | 449 VrShellRenderer::VrShellRenderer() |
450 : textured_quad_renderer_(new TexturedQuadRenderer), | 450 : textured_quad_renderer_(new TexturedQuadRenderer), |
451 webvr_renderer_(new WebVrRenderer), | 451 webvr_renderer_(new WebVrRenderer), |
452 reticle_renderer_(new ReticleRenderer), | 452 reticle_renderer_(new ReticleRenderer), |
453 laser_renderer_(new LaserRenderer) {} | 453 laser_renderer_(new LaserRenderer) {} |
454 | 454 |
455 VrShellRenderer::~VrShellRenderer() = default; | 455 VrShellRenderer::~VrShellRenderer() = default; |
456 | 456 |
457 } // namespace vr_shell | 457 } // namespace vr_shell |
OLD | NEW |