1
0
Files
pixelthud/shaders/checkerboard_rotate.frag
2026-02-04 19:29:12 +01:00

18 lines
499 B
GLSL

// Related examples and context: https://observablehq.com/@mbostock/shader
#define M_PI 3.1415926535897932384626433832795
const float size = 10.0;
mat2 rotate2d(float a) {
return mat2(cos(a), -sin(a), sin(a), cos(a));
}
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
float angle = iTime;
vec2 p = (fragCoord.xy - iResolution.xy / 2.0) * rotate2d(angle);
float k = float(mod(p.x, size * 2.0) < size == mod(p.y, size * 2.0) < size);
fragColor = vec4(vec3(k), 1.0);
}