2022-01-16 05:17:35 +01:00
|
|
|
//
|
|
|
|
// Simple passthrough fragment shader
|
|
|
|
//
|
|
|
|
varying vec2 v_vTexcoord;
|
|
|
|
varying vec4 v_vColour;
|
|
|
|
|
|
|
|
uniform vec2 position;
|
|
|
|
uniform vec2 scale;
|
2022-01-19 14:48:30 +01:00
|
|
|
uniform float angle;
|
2022-01-16 05:17:35 +01:00
|
|
|
uniform float width;
|
|
|
|
|
|
|
|
void main() {
|
2022-01-19 14:48:30 +01:00
|
|
|
vec2 pos = v_vTexcoord - position, _pos;
|
|
|
|
_pos.x = pos.x * cos(angle) - pos.y * sin(angle);
|
|
|
|
_pos.y = pos.x * sin(angle) + pos.y * cos(angle);
|
2022-01-16 05:17:35 +01:00
|
|
|
|
|
|
|
vec2 dist = _pos - floor(_pos * scale) / scale;
|
|
|
|
float ww = width / 2.;
|
|
|
|
|
|
|
|
if(dist == clamp(dist, vec2(ww), vec2(1. / scale - ww)))
|
|
|
|
gl_FragColor = vec4(1.);
|
|
|
|
else
|
|
|
|
gl_FragColor = vec4(vec3(0.), 1.);
|
|
|
|
}
|