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:
16
client/assets/theme/shaders/dark_bay.gdshader
Normal file
16
client/assets/theme/shaders/dark_bay.gdshader
Normal 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;
|
||||
}
|
||||
1
client/assets/theme/shaders/dark_bay.gdshader.uid
Normal file
1
client/assets/theme/shaders/dark_bay.gdshader.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://jb8clyworwr1
|
||||
6
client/assets/theme/shaders/parchment.gdshader
Normal file
6
client/assets/theme/shaders/parchment.gdshader
Normal 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);
|
||||
}
|
||||
1
client/assets/theme/shaders/parchment.gdshader.uid
Normal file
1
client/assets/theme/shaders/parchment.gdshader.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://b2heb6jhvwxxl
|
||||
6
client/assets/theme/shaders/vignette.gdshader
Normal file
6
client/assets/theme/shaders/vignette.gdshader
Normal 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));
|
||||
}
|
||||
1
client/assets/theme/shaders/vignette.gdshader.uid
Normal file
1
client/assets/theme/shaders/vignette.gdshader.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://b4tami4peyxaw
|
||||
5
client/scenes/theme/surfaces/DarkBay.tscn
Normal file
5
client/scenes/theme/surfaces/DarkBay.tscn
Normal 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")
|
||||
5
client/scenes/theme/surfaces/ParchmentPanel.tscn
Normal file
5
client/scenes/theme/surfaces/ParchmentPanel.tscn
Normal 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")
|
||||
5
client/scenes/theme/surfaces/VignetteOverlay.tscn
Normal file
5
client/scenes/theme/surfaces/VignetteOverlay.tscn
Normal 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")
|
||||
12
client/scripts/theme/surfaces/dark_bay.gd
Normal file
12
client/scripts/theme/surfaces/dark_bay.gd
Normal 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
|
||||
1
client/scripts/theme/surfaces/dark_bay.gd.uid
Normal file
1
client/scripts/theme/surfaces/dark_bay.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://24c8pl0yx8wu
|
||||
12
client/scripts/theme/surfaces/parchment_panel.gd
Normal file
12
client/scripts/theme/surfaces/parchment_panel.gd
Normal 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
|
||||
1
client/scripts/theme/surfaces/parchment_panel.gd.uid
Normal file
1
client/scripts/theme/surfaces/parchment_panel.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cnv1r00ane2la
|
||||
11
client/scripts/theme/surfaces/vignette_overlay.gd
Normal file
11
client/scripts/theme/surfaces/vignette_overlay.gd
Normal 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
|
||||
1
client/scripts/theme/surfaces/vignette_overlay.gd.uid
Normal file
1
client/scripts/theme/surfaces/vignette_overlay.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://7bc7agrl6oi0
|
||||
17
client/tests/unit/test_surfaces.gd
Normal file
17
client/tests/unit/test_surfaces.gd
Normal 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)
|
||||
1
client/tests/unit/test_surfaces.gd.uid
Normal file
1
client/tests/unit/test_surfaces.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://csc3r7lqoe83d
|
||||
Reference in New Issue
Block a user