diff options
author | ame <[email protected]> | 2024-10-10 02:02:43 -0500 |
---|---|---|
committer | ame <[email protected]> | 2024-10-10 02:02:43 -0500 |
commit | 37aba1bce27c2f322312dd01acac54a026fc89ce (patch) | |
tree | 579134aa6c9cf2e71f10bc74cc72fd0d2de5a7f7 /render/fx_renderer/gles2/shaders | |
parent | 6094bf78c30f9b636844825e208a601019bec589 (diff) |
fix non blended index
Diffstat (limited to 'render/fx_renderer/gles2/shaders')
3 files changed, 23 insertions, 8 deletions
diff --git a/render/fx_renderer/gles2/shaders/quad_grad.frag b/render/fx_renderer/gles2/shaders/quad_grad.frag index d259942..a73975b 100644 --- a/render/fx_renderer/gles2/shaders/quad_grad.frag +++ b/render/fx_renderer/gles2/shaders/quad_grad.frag @@ -39,12 +39,17 @@ vec4 gradient(){ step = uv.x; } + if(!blend){ + float smooth = 1.0/float(count); + int ind = int(step/smooth); + + return colors[ind]; + } + float smooth = 1.0/float(count - 1); int ind = int(step/smooth); float at = float(ind)*smooth; - if(!blend) return colors[ind]; - vec4 color = colors[ind]; if(ind > 0) color = mix(colors[ind - 1], color, smoothstep(at - smooth, at, step)); if(ind <= count - 1) color = mix(color, colors[ind + 1], smoothstep(at, at + smooth, step)); diff --git a/render/fx_renderer/gles2/shaders/quad_grad_round.frag b/render/fx_renderer/gles2/shaders/quad_grad_round.frag index 58cdb53..66a54a6 100644 --- a/render/fx_renderer/gles2/shaders/quad_grad_round.frag +++ b/render/fx_renderer/gles2/shaders/quad_grad_round.frag @@ -28,7 +28,7 @@ uniform int count; vec4 gradient(){ float step; - vec2 normal = (gl_FragCoord.xy - grad_box)/grad_size; + vec2 normal = (gl_FragCoord.xy - grad_box)/size; vec2 uv = normal - origin; float rad = radians(degree); @@ -48,13 +48,18 @@ vec4 gradient(){ step = uv.x; } + if(!blend){ + float smooth = 1.0/float(count); + int ind = int(step/smooth); + + return colors[ind]; + } + float smooth = 1.0/float(count - 1); int ind = int(step/smooth); float at = float(ind)*smooth; - if(!blend) return colors[ind]; - - vec4 color = colors[ind]; + vec4 color = colors[ind]; if(ind > 0) color = mix(colors[ind - 1], color, smoothstep(at - smooth, at, step)); if(ind <= count - 1) color = mix(color, colors[ind + 1], smoothstep(at, at + smooth, step)); diff --git a/render/fx_renderer/gles2/shaders/rounded_grad_border_corner.frag b/render/fx_renderer/gles2/shaders/rounded_grad_border_corner.frag index ef36f06..85a6f79 100644 --- a/render/fx_renderer/gles2/shaders/rounded_grad_border_corner.frag +++ b/render/fx_renderer/gles2/shaders/rounded_grad_border_corner.frag @@ -44,12 +44,17 @@ vec4 gradient(){ step = uv.x; } + if(!blend){ + float smooth = 1.0/float(count); + int ind = int(step/smooth); + + return colors[ind]; + } + float smooth = 1.0/float(count - 1); int ind = int(step/smooth); float at = float(ind)*smooth; - if(!blend) return colors[ind]; - vec4 color = colors[ind]; if(ind > 0) color = mix(colors[ind - 1], color, smoothstep(at - smooth, at, step)); if(ind <= count - 1) color = mix(color, colors[ind + 1], smoothstep(at, at + smooth, step)); |