feat: Implement the "Stop N Go" arena with new assets, scenes, and associated game logic and UI.
This commit is contained in:
@@ -1,21 +1,24 @@
|
||||
shader_type spatial;
|
||||
render_mode cull_front, unshaded;
|
||||
|
||||
// Controls the width of the outline
|
||||
uniform float outline_thickness : hint_range(0.0, 0.5) = 0.03;
|
||||
|
||||
// Controls the color of the outline
|
||||
uniform vec4 outline_color : source_color = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
uniform float thickness : hint_range(0.0, 10.0) = 5.0; // Thickness in pixels
|
||||
|
||||
void vertex() {
|
||||
// The core of the inverted hull method:
|
||||
// We push the vertices outward along their normal vectors.
|
||||
// Since front faces are culled, this creates the outline border.
|
||||
VERTEX += NORMAL * outline_thickness;
|
||||
// Calculate the vertex position and normal in projection space
|
||||
vec4 clip_position = PROJECTION_MATRIX * (MODELVIEW_MATRIX * vec4(VERTEX, 1.0));
|
||||
vec3 clip_normal = mat3(PROJECTION_MATRIX) * (mat3(MODELVIEW_MATRIX) * NORMAL);
|
||||
|
||||
// Normalize the normal vector and convert to pixel space
|
||||
vec2 clip_norm = normalize(clip_normal.xy);
|
||||
vec2 pixel_size = 1.0 / VIEWPORT_SIZE;
|
||||
|
||||
// Multiply by W to keep pixel size constant across distances
|
||||
clip_position.xy += clip_norm * pixel_size * thickness * clip_position.w;
|
||||
|
||||
POSITION = clip_position;
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
// Apply the solid outline color
|
||||
ALBEDO = outline_color.rgb;
|
||||
ALPHA = outline_color.a;
|
||||
}
|
||||
Reference in New Issue
Block a user