feat(theme): parchment/dark-bay/vignette shader surfaces as drop-in scenes

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-10 20:34:52 -05:00
parent 9091707535
commit 73fcf2d096
17 changed files with 102 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
shader_type canvas_item;
uniform vec4 stripe_a : source_color;
uniform vec4 stripe_b : source_color;
uniform float band_px = 16.0; // 16px bands per README
uniform float vignette = 0.55; // edge darkening strength
void fragment() {
// 135deg diagonal stripe: sum of pixel coords, banded.
vec2 px = FRAGCOORD.xy;
float diag = px.x + px.y;
float band = mod(floor(diag / band_px), 2.0);
vec4 base = mix(stripe_a, stripe_b, band);
// radial vignette centred slightly high (README: 50% 38%).
float d = distance(UV, vec2(0.5, 0.38));
base.rgb *= 1.0 - clamp(d * vignette, 0.0, 1.0);
COLOR = base;
}

View File

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

View File

@@ -0,0 +1,6 @@
shader_type canvas_item;
uniform vec4 top : source_color;
uniform vec4 bottom : source_color;
void fragment() {
COLOR = mix(top, bottom, UV.y);
}

View File

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

View File

@@ -0,0 +1,6 @@
shader_type canvas_item;
uniform float strength = 0.62;
void fragment() {
float d = distance(UV, vec2(0.5));
COLOR = vec4(0.0, 0.0, 0.0, clamp(d * strength, 0.0, 1.0));
}

View File

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

View File

@@ -0,0 +1,5 @@
[gd_scene load_steps=2 format=3]
[ext_resource type="Script" path="res://scripts/theme/surfaces/dark_bay.gd" id="1"]
[node name="DarkBay" type="Panel"]
anchors_preset = 15
script = ExtResource("1")

View File

@@ -0,0 +1,5 @@
[gd_scene load_steps=2 format=3]
[ext_resource type="Script" path="res://scripts/theme/surfaces/parchment_panel.gd" id="1"]
[node name="ParchmentPanel" type="Panel"]
anchors_preset = 15
script = ExtResource("1")

View File

@@ -0,0 +1,5 @@
[gd_scene load_steps=2 format=3]
[ext_resource type="Script" path="res://scripts/theme/surfaces/vignette_overlay.gd" id="1"]
[node name="VignetteOverlay" type="ColorRect"]
anchors_preset = 15
script = ExtResource("1")

View File

@@ -0,0 +1,12 @@
class_name DarkBay
extends Panel
## Drop-in dark stripe+vignette bay backdrop. §2: presentation.
const Palette = preload("res://scripts/theme/palette.gd")
func _ready() -> void:
var m := ShaderMaterial.new()
m.shader = load("res://assets/theme/shaders/dark_bay.gdshader")
m.set_shader_parameter("stripe_a", Palette.BAY_STRIPE_A)
m.set_shader_parameter("stripe_b", Palette.BAY_STRIPE_B)
material = m

View File

@@ -0,0 +1 @@
uid://24c8pl0yx8wu

View File

@@ -0,0 +1,12 @@
class_name ParchmentPanel
extends Panel
## Drop-in parchment backdrop (mockups "Dark Bay + Parchment" motif). §2: presentation.
const Palette = preload("res://scripts/theme/palette.gd")
func _ready() -> void:
var m := ShaderMaterial.new()
m.shader = load("res://assets/theme/shaders/parchment.gdshader")
m.set_shader_parameter("top", Palette.SHEET_TOP)
m.set_shader_parameter("bottom", Palette.SHEET_BOTTOM)
material = m

View File

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

View File

@@ -0,0 +1,11 @@
class_name VignetteOverlay
extends ColorRect
## Drop-in edge-dim overlay for pause/dialogue dim. §2: presentation.
func _ready() -> void:
color = Color(0, 0, 0, 0) # base transparent; shader draws the dim
mouse_filter = Control.MOUSE_FILTER_IGNORE
var m := ShaderMaterial.new()
m.shader = load("res://assets/theme/shaders/vignette.gdshader")
material = m

View File

@@ -0,0 +1 @@
uid://7bc7agrl6oi0

View File

@@ -0,0 +1,17 @@
extends "res://addons/gut/test.gd"
const SCENES := [
"res://scenes/theme/surfaces/ParchmentPanel.tscn",
"res://scenes/theme/surfaces/DarkBay.tscn",
"res://scenes/theme/surfaces/VignetteOverlay.tscn",
]
func test_surfaces_instance_with_shader_material():
for path in SCENES:
var packed = load(path)
assert_true(packed is PackedScene, "not a scene: %s" % path)
var node = packed.instantiate()
add_child_autofree(node) # triggers _ready()
assert_true(node.material is ShaderMaterial, "%s has no ShaderMaterial" % path)
assert_true(node.material.shader is Shader, "%s shader missing" % path)

View File

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