slight gameplay changes and new ui

This commit is contained in:
2025-07-21 05:56:11 +10:00
parent d2dc74d533
commit a452bbb406
53 changed files with 538 additions and 245 deletions

View File

@@ -6,18 +6,17 @@ render_mode blend_mix,
specular_disabled,
vertex_lighting;
uniform bool affine_mapping = false;
global uniform bool affine_mapping = false;
global uniform ivec2 jitter_resolution = ivec2(320, 240);
uniform sampler2D albedo : source_color, filter_nearest;
uniform float alpha_scissor : hint_range(0, 1) = 0.5;
uniform float jitter: hint_range(0, 1) = 0.25;
uniform ivec2 resolution = ivec2(320, 240);
vec4 snap_to_position(vec4 base_position)
{
vec4 snapped_position = base_position;
snapped_position.xyz = base_position.xyz / base_position.w;
vec2 snap_resulotion = floor(vec2(resolution) * (1.0 - jitter));
vec2 snap_resulotion = floor(vec2(jitter_resolution));
snapped_position.x = floor(snap_resulotion.x * snapped_position.x) / snap_resulotion.x;
snapped_position.y = floor(snap_resulotion.y * snapped_position.y) / snap_resulotion.y;

View File

@@ -0,0 +1,39 @@
shader_type canvas_item;
uniform sampler2D SCREEN_TEXTURE: hint_screen_texture, filter_linear_mipmap;
uniform int color_depth : hint_range(1, 8) = 5;
uniform bool dithering = true;
uniform int resolution_scale = 4;
int dithering_pattern(ivec2 fragcoord) {
const int pattern[] = {
-4, +0, -3, +1,
+2, -2, +3, -1,
-3, +1, -4, +0,
+3, -1, +2, -2
};
int x = fragcoord.x % 4;
int y = fragcoord.y % 4;
return pattern[y * 4 + x];
}
void fragment() {
ivec2 uv = ivec2(FRAGCOORD.xy / float(resolution_scale));
vec3 color = texelFetch(SCREEN_TEXTURE, uv * resolution_scale, 0).rgb;
// Convert from [0.0, 1.0] range to [0, 255] range
ivec3 c = ivec3(round(color * 255.0));
// Apply the dithering pattern
if (dithering) {
c += ivec3(dithering_pattern(uv));
}
// Truncate from 8 bits to color_depth bits
c >>= (8 - color_depth);
// Convert back to [0.0, 1.0] range
COLOR = vec4(vec3(c) / float(1 << color_depth), 1.0);
}

View File

@@ -0,0 +1 @@
uid://dvvn4x6geogiv