From fc3d80ec731285872c33d50b09507141dce91032 Mon Sep 17 00:00:00 2001 From: evanpelle Date: Thu, 28 May 2026 14:47:40 -0700 Subject: [PATCH] Add Classic Icons toggle to Graphics Settings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds a "Classic icons" toggle in the structure-icons section of the Graphics Settings modal. Off (default) keeps today's renderer look; on switches to a classic style — lighter player-colored shape behind a dark icon glyph, with 0.75 alpha for a subtle translucent feel. Exposes the underlying tuning as new render-settings knobs (`structure.fillDarken`, `borderDarken`, `iconAlpha`, `iconR/G/B`) and threads them through the structure shader as uniforms, replacing the previously hardcoded `darken(_, 0.65)` / `darken(_, 0.35)` calls and the hardcoded white `vec3(1.0)` icon color. The `classicIcons` boolean in the override schema is the single user-facing knob; the generator derives the five underlying field values from it. Extends the ClientGameRunner live-apply path to copy the `structure` slice too, and adds tests covering the schema and preset derivation. --- resources/lang/en.json | 3 + src/client/ClientGameRunner.ts | 1 + .../hud/layers/GraphicsSettingsModal.ts | 45 ++++++++++++++ src/client/render/gl/GraphicsOverrides.ts | 5 ++ src/client/render/gl/RenderSettings.ts | 20 +++++++ src/client/render/gl/passes/StructurePass.ts | 12 ++++ src/client/render/gl/render-settings.json | 8 ++- .../gl/shaders/structure/structure.frag.glsl | 18 +++--- tests/GraphicsOverrides.test.ts | 60 +++++++++++++++++++ 9 files changed, 164 insertions(+), 8 deletions(-) diff --git a/resources/lang/en.json b/resources/lang/en.json index afc4e8bf0..81a52ebae 100644 --- a/resources/lang/en.json +++ b/resources/lang/en.json @@ -927,6 +927,9 @@ "colored_names_desc": "Show player names in their player color or in black", "colored": "Colored", "black": "Black", + "section_structure_icons": "Structure Icons", + "classic_icons_label": "Classic icons", + "classic_icons_desc": "Lighter outline with near-black interior", "reset_label": "Reset to defaults", "reset_desc": "Clear all graphics overrides" }, diff --git a/src/client/ClientGameRunner.ts b/src/client/ClientGameRunner.ts index e54ea553b..17f70b31f 100644 --- a/src/client/ClientGameRunner.ts +++ b/src/client/ClientGameRunner.ts @@ -491,6 +491,7 @@ async function createClientGame( ); const live = view.getSettings(); Object.assign(live.name, generated.name); + Object.assign(live.structure, generated.structure); }; applyGraphicsOverrides(); globalThis.addEventListener( diff --git a/src/client/hud/layers/GraphicsSettingsModal.ts b/src/client/hud/layers/GraphicsSettingsModal.ts index 7219e0dde..cf4cb1e55 100644 --- a/src/client/hud/layers/GraphicsSettingsModal.ts +++ b/src/client/hud/layers/GraphicsSettingsModal.ts @@ -127,6 +127,25 @@ export class GraphicsSettingsModal extends LitElement implements Controller { this.requestUpdate(); } + private patchStructure(patch: Partial) { + const current = this.userSettings.graphicsOverrides(); + this.userSettings.setGraphicsOverrides({ + ...current, + structure: { ...current.structure, ...patch }, + }); + this.requestUpdate(); + } + + private currentClassicIcons(): boolean { + return ( + this.userSettings.graphicsOverrides().structure?.classicIcons ?? false + ); + } + + private onToggleClassicIcons() { + this.patchStructure({ classicIcons: !this.currentClassicIcons() }); + } + private onNameScaleChange(event: Event) { const value = parseFloat((event.target as HTMLInputElement).value); this.patchName({ nameScaleFactor: value }); @@ -159,6 +178,7 @@ export class GraphicsSettingsModal extends LitElement implements Controller { const nameScale = this.currentNameScale(); const nameCull = this.currentNameCull(); const namesColored = !this.currentDarkNames(); + const classicIcons = this.currentClassicIcons(); return html`
+
+ ${translateText("graphics_setting.section_structure_icons")} +
+ + +