30 lines
883 B
Plaintext
30 lines
883 B
Plaintext
|
shader_type canvas_item;
|
||
|
|
||
|
uniform float rows = 44.0; // Really int but don't want to recast all the time
|
||
|
uniform float cols = 63.0; // ^
|
||
|
|
||
|
void fragment(){
|
||
|
vec2 frag_pos = UV * vec2(cols, rows);
|
||
|
vec2 frag_marginal = fract(frag_pos+0.05);
|
||
|
vec2 frag_marginal_2 = fract(frag_pos-0.4);
|
||
|
vec2 grid_data = texture(TEXTURE, (frag_pos+0.05)/vec2(cols+1.0, rows+1.0)).rg;
|
||
|
COLOR = vec4(0.0);
|
||
|
if (frag_marginal.x < 0.1){
|
||
|
if (grid_data.g >= 0.99){
|
||
|
if (frag_marginal_2.y <= 0.2)
|
||
|
COLOR = vec4(1.0, 0.0, 0.0, 1.0);
|
||
|
}else if (grid_data.g >= 0.49){
|
||
|
COLOR = vec4(0.0, 0.0, 1.0, 1.0);
|
||
|
}else
|
||
|
COLOR = vec4(0.5, 0.5, 0.5, 1.0);
|
||
|
}
|
||
|
if (frag_marginal.y < 0.1){
|
||
|
if (grid_data.r >= 0.99){
|
||
|
if (frag_marginal_2.x <= 0.2)
|
||
|
COLOR = vec4(1.0, 0.0, 0.0, 1.0);
|
||
|
}else if (grid_data.r >= 0.49){
|
||
|
COLOR = vec4(0.0, 0.0, 1.0, 1.0);
|
||
|
}else
|
||
|
COLOR = vec4(0.5, 0.5, 0.5, 1.0);
|
||
|
}
|
||
|
}
|