-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path10_ZoomRotateCross.frag
46 lines (34 loc) · 1.08 KB
/
10_ZoomRotateCross.frag
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifdef GL_ES
precision highp float;
#endif
uniform vec2 u_resolution;
uniform vec2 u_mouse;
uniform float u_time;
void main(){
vec2 st = gl_FragCoord.xy/u_resolution;
vec3 color = vec3(1.0,.0,.0);
vec2 thicc = vec2(0.02);
float zoom_const = sin(u_time);
//float rad_angle = sin(u_time);
mat2 zoom_m = mat2(
vec2(zoom_const,0.0),
vec2(0.0,zoom_const)
);
mat2 rot_m = mat2(
vec2(cos(u_time),sin(u_time)),
vec2(-sin(u_time),cos(u_time))
);
st -= vec2(0.5);
st = zoom_m*(rot_m*st);
st += vec2(0.5);
vec2 rect1 = step(vec2(0.1,0.40),st);
vec2 rect2 = step(vec2(0.1,0.40),vec2(1.-st.x,1.-st.y));
vec2 rect3 = step(vec2(0.40,0.1),st);
vec2 rect4 = step(vec2(0.40,0.1),vec2(1.-st.x,1.-st.y));
color += vec3(rect1.x * rect1.y * rect2.x * rect2.y);
color += vec3(rect3.x * rect3.y * rect4.x * rect4.y);
if(color.r <= 0.0 && color.g <= 0.0 && color.b <= 0.0){
color = vec3(1.);
}
gl_FragColor = vec4(color,1.0);
}