Skip to content

Commit 3274645

Browse files
doosuugithub-actions[bot]
authored andcommitted
Adapt shader for inverted line gradient
GitOrigin-RevId: 5670a40e5f1892a2c2883478b0dc48d50e33d15c
1 parent 500a0b1 commit 3274645

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/shaders/line.fragment.glsl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,6 @@ void main() {
9797
#ifdef RENDER_LINE_GRADIENT
9898
// For gradient lines, v_uv.xy are the coord specify where the texture will be simpled.
9999
out_color = texture(u_gradient_image, v_uv.xy);
100-
#ifdef MULTIPLY_LINE_GRADIENT_COLOR
101-
out_color *= color;
102-
#endif
103100
#else
104101
out_color = color;
105102
#endif
@@ -119,7 +116,12 @@ void main() {
119116
highp float start_transition = max(0.0, min(1.0, (line_progress - trim_start) / max(u_trim_fade_range[0], 1.0e-9)));
120117
highp float end_transition = max(0.0, min(1.0, (trim_end - line_progress) / max(u_trim_fade_range[1], 1.0e-9)));
121118
highp float transition_factor = min(start_transition, end_transition);
119+
#ifdef LINE_GRADIENT_AS_TRIM_COLOR
120+
out_color = mix(color, out_color, transition_factor);
121+
#else
122122
out_color = mix(out_color, u_trim_color, transition_factor);
123+
#endif
124+
123125
trim_alpha = 1.0 - transition_factor;
124126
}
125127
#endif

0 commit comments

Comments
 (0)