summaryrefslogtreecommitdiff
path: root/render/fx_renderer/gles2/shaders
diff options
context:
space:
mode:
Diffstat (limited to 'render/fx_renderer/gles2/shaders')
-rw-r--r--render/fx_renderer/gles2/shaders/quad_grad.frag9
-rw-r--r--render/fx_renderer/gles2/shaders/quad_grad_round.frag13
-rw-r--r--render/fx_renderer/gles2/shaders/rounded_grad_border_corner.frag9
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));