make Game.gd not rely on autoload/global

This commit is contained in:
2025-06-24 01:14:50 +10:00
parent 20cde0a778
commit 64befd8ec7
33 changed files with 194 additions and 411 deletions

View File

@ -11,15 +11,15 @@ uniform int dither_size: hint_range(1, 8) = 1;
float dithering_pattern(ivec2 fragcoord) {
const float pattern[] = {
0.00, 0.50, 0.10, 0.65,
0.75, 0.25, 0.90, 0.35,
0.20, 0.70, 0.05, 0.50,
0.00, 0.50, 0.10, 0.65,
0.75, 0.25, 0.90, 0.35,
0.20, 0.70, 0.05, 0.50,
0.95, 0.40, 0.80, 0.30
};
int x = fragcoord.x % 4;
int y = fragcoord.y % 4;
return pattern[y * 4 + x];
}
@ -38,7 +38,7 @@ float reduce_color(float raw, float dither, int depth) {
if (raw * float(depth) - float(i) <= dither * 0.999)
{
val = div * float(i);
}
}
else
{
val = div * float(i + 1);
@ -61,7 +61,7 @@ void fragment() {
{
dithering_value = dithering_pattern(uv);
}
COLOR.r = reduce_color(raw.r, (dithering_value - 0.5) * dithering_value + 0.5, colors - 1);
COLOR.g = reduce_color(raw.g, (dithering_value - 0.5) * dithering_value + 0.5, colors - 1);
COLOR.b = reduce_color(raw.b, (dithering_value - 0.5) * dithering_value + 0.5, colors - 1);