Pixel-Composer/shaders/sh_checkerboard/sh_checkerboard.fsh

22 lines
481 B
Plaintext
Raw Normal View History

2022-01-13 05:24:03 +01:00
//
// Simple passthrough fragment shader
//
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform vec2 position;
2022-01-13 05:24:03 +01:00
uniform float angle;
uniform float amount;
void main() {
vec2 c = v_vTexcoord - position;
2022-01-13 05:24:03 +01:00
float _x = .5 + c.x * cos(angle) - c.y * sin(angle);
float _y = .5 + c.x * sin(angle) + c.y * cos(angle);
float _a = 1. / amount;
if(mod(floor(_x / _a) + floor(_y / _a), 2.) > 0.5)
gl_FragColor = vec4(vec3(0.), 1.);
else
gl_FragColor = vec4(vec3(1.), 1.);
}