mirror of
https://github.com/patriciogonzalezvivo/thebookofshaders
synced 2024-11-09 19:10:24 +00:00
fixing errors
This commit is contained in:
parent
a9d72083ea
commit
3d3d5fd505
@ -10,10 +10,10 @@ uniform vec2 u_mouse;
|
||||
uniform float u_time;
|
||||
|
||||
float circle(in vec2 _st, in float _radius){
|
||||
vec2 l = _st-vec2(0.5);
|
||||
vec2 dist = _st-vec2(0.5);
|
||||
return 1.-smoothstep(_radius-(_radius*0.01),
|
||||
_radius+(_radius*0.01),
|
||||
dot(l,l)*4.0);
|
||||
dot(dist,dist)*4.0);
|
||||
}
|
||||
|
||||
void main(){
|
||||
|
32
09/tmp/checker.frag
Normal file
32
09/tmp/checker.frag
Normal file
@ -0,0 +1,32 @@
|
||||
// Author @patriciogv ( patriciogonzalezvivo.com ) - 2015
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
uniform vec2 u_resolution;
|
||||
uniform vec2 u_mouse;
|
||||
uniform float u_time;
|
||||
|
||||
vec2 tile(vec2 _st, float _zoom){
|
||||
_st *= _zoom;
|
||||
return fract(_st);
|
||||
}
|
||||
|
||||
float circle(vec2 _st, float _radius){
|
||||
vec2 pos = vec2(0.5)-_st;
|
||||
_radius *= 0.75;
|
||||
return 1.-smoothstep(_radius-(_radius*0.05),_radius+(_radius*0.05),dot(pos,pos)*3.14);
|
||||
}
|
||||
|
||||
void main(){
|
||||
|
||||
vec2 st = gl_FragCoord.xy/u_resolution.xy;
|
||||
st.x *= u_resolution.x/u_resolution.y;
|
||||
|
||||
float pct = 0.0;
|
||||
vec2 st_i = floor(st*10.);
|
||||
pct += step(0.5,abs(mod(st_i.x,2.)-mod(st_i.y+1.,2.)));
|
||||
|
||||
gl_FragColor = vec4(vec3(pct),1.0);
|
||||
}
|
33
09/tmp/dots-tide.frag
Normal file
33
09/tmp/dots-tide.frag
Normal file
@ -0,0 +1,33 @@
|
||||
// Author @patriciogv ( patriciogonzalezvivo.com ) - 2015
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
uniform vec2 u_resolution;
|
||||
uniform vec2 u_mouse;
|
||||
uniform float u_time;
|
||||
|
||||
vec2 tile(vec2 _st, float _zoom){
|
||||
_st *= _zoom;
|
||||
return fract(_st);
|
||||
}
|
||||
|
||||
float circle(vec2 _st, float _radius){
|
||||
vec2 pos = vec2(0.5)-_st;
|
||||
_radius *= 0.75;
|
||||
return 1.-smoothstep(_radius-(_radius*0.05),_radius+(_radius*0.05),dot(pos,pos)*3.14);
|
||||
}
|
||||
|
||||
void main(){
|
||||
|
||||
vec2 st = gl_FragCoord.xy/u_resolution.xy;
|
||||
st.x *= u_resolution.x/u_resolution.y;
|
||||
st = tile(st,5.);
|
||||
float size = .45;
|
||||
float pct = circle(st,size);
|
||||
st = abs(st-.5);
|
||||
pct += circle(st,size);
|
||||
|
||||
gl_FragColor = vec4(vec3(pct),1.0);
|
||||
}
|
30
09/tmp/dots.frag
Normal file
30
09/tmp/dots.frag
Normal file
@ -0,0 +1,30 @@
|
||||
// Author @patriciogv ( patriciogonzalezvivo.com ) - 2015
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
uniform vec2 u_resolution;
|
||||
uniform vec2 u_mouse;
|
||||
uniform float u_time;
|
||||
|
||||
vec2 tile(vec2 _st, float _zoom){
|
||||
_st *= _zoom;
|
||||
return fract(_st);
|
||||
}
|
||||
|
||||
float circle(vec2 _st, float _radius){
|
||||
vec2 pos = vec2(0.5)-_st;
|
||||
_radius *= 0.75;
|
||||
return 1.-smoothstep(_radius-(_radius*0.05),_radius+(_radius*0.05),dot(pos,pos)*3.14);
|
||||
}
|
||||
|
||||
void main(){
|
||||
|
||||
vec2 st = gl_FragCoord.xy/u_resolution.xy;
|
||||
st.x *= u_resolution.x/u_resolution.y;
|
||||
st = tile(st,5.);
|
||||
vec3 color = vec3(circle(st, 0.2));
|
||||
|
||||
gl_FragColor = vec4(color,1.0);
|
||||
}
|
@ -32,13 +32,13 @@ vec2 rotateTilePattern(vec2 _st){
|
||||
float index = 0.0;
|
||||
index += step(1., mod(_st.x,2.0));
|
||||
index += step(1., mod(_st.y,2.0))*2.0;
|
||||
|
||||
|
||||
// |
|
||||
// 0 | 1
|
||||
// 2 | 3
|
||||
// |
|
||||
//--------------
|
||||
// |
|
||||
// 2 | 3
|
||||
// 0 | 1
|
||||
// |
|
||||
|
||||
// Make each cell between 0.0 - 1.0
|
||||
|
Loading…
Reference in New Issue
Block a user