fuckingtech/public/assets/glsl/lygia/space/checkerTile.msl
Elias Rhouzlane bf76c6b086 fix: code
2025-04-06 17:23:52 +02:00

34 lines
No EOL
924 B
Text

#include "sqTile.msl"
/*
contributors: Patricio Gonzalez Vivo
description: 'Return a black or white a square checker patter'
use:
- <float4> checkerTile(<float4> tile)
- <float4> checkerTile(<float2> st [, <float2> scale])
examples:
- https://raw.githubusercontent.com/patriciogonzalezvivo/lygia_examples/main/draw_tiles.frag
license:
- Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0
- Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license
*/
#ifndef FNC_CHECKERTILE
#define FNC_CHECKERTILE
float checkerTile(float4 t) {
float2 c = mod(t.zw,2.);
return abs(c.x-c.y);
}
float checkerTile(float2 v) {
return checkerTile(sqTile(v));
}
float checkerTile(float2 v, float s) {
return checkerTile(v * s);
}
float checkerTile(float2 v, float2 s) {
return checkerTile(v * s);
}
#endif