Add map hover/railroad graphics overrides and fix territory highlight

Extend GraphicsOverrides with a mapOverlay group (territory highlight,
border highlight amount, border highlight thickness) and a railroad
group (train track draw distance), wired through the schema,
applyGraphicsOverrides, and new sliders in the graphics settings modal.

Fix the territory hover highlight: the shader received uHighlightBrighten
but ignored it, applying a hardcoded saturation boost so the setting had
no effect. It now drives a contrast boost (push channels away from
mid-gray), with 0 disabling the effect.

The train track slider is presented as a "draw distance" (inverted
railMinZoom) so higher = tracks stay visible when more zoomed out.

Also move the Graphics settings button to the top of the settings modal.
This commit is contained in:
evanpelle
2026-06-08 14:03:01 -07:00
parent 1e3f50436c
commit 1c1728f6fa
6 changed files with 257 additions and 26 deletions
+12
View File
@@ -14,6 +14,18 @@ export const GraphicsOverridesSchema = z
classicIcons: z.boolean(),
})
.partial(),
mapOverlay: z
.object({
highlightFillBrighten: z.number(),
highlightBrighten: z.number(),
highlightThicken: z.number(),
})
.partial(),
railroad: z
.object({
railMinZoom: z.number(),
})
.partial(),
})
.partial();
+15
View File
@@ -23,6 +23,21 @@ export function applyGraphicsOverrides(
settings.structure.iconB = 0;
settings.structure.iconAlpha = 0.75;
}
if (overrides.mapOverlay?.highlightFillBrighten !== undefined) {
settings.mapOverlay.highlightFillBrighten =
overrides.mapOverlay.highlightFillBrighten;
}
if (overrides.mapOverlay?.highlightBrighten !== undefined) {
settings.mapOverlay.highlightBrighten =
overrides.mapOverlay.highlightBrighten;
}
if (overrides.mapOverlay?.highlightThicken !== undefined) {
settings.mapOverlay.highlightThicken =
overrides.mapOverlay.highlightThicken;
}
if (overrides.railroad?.railMinZoom !== undefined) {
settings.railroad.railMinZoom = overrides.railroad.railMinZoom;
}
if (overrides.name?.darkNames !== undefined) {
const dark = overrides.name.darkNames;
// Dark: black fill + player-colored outline. Force outline RGB to black
@@ -21,7 +21,7 @@ uniform float uStaleNukeVariation;
uniform float uStaleNukeAlpha;
uniform vec3 uStaleNukeColor;
uniform uint uHighlightOwner; // 0 = no highlight; otherwise smallID of hovered owner
uniform float uHighlightBrighten; // mix amount toward white for highlighted tiles
uniform float uHighlightBrighten; // hover contrast boost strength; 0 = disabled
uniform sampler2D uDefenseCoverageTex; // R8 — 1.0 = tile defended by same-owner post
uniform float uDefenseDarken; // multiplier applied to fill on defended tiles
uniform sampler2D uBorderTex; // RGBA8 — border flags; R > 0.25 = border tile
@@ -104,11 +104,11 @@ void main() {
}
}
// Hover highlight: boost saturation on the hovered player's tiles.
// luma = grayscale equivalent; mixing past 1.0 pushes color away from gray.
if (uHighlightOwner != 0u && owner == uHighlightOwner) {
float luma = dot(color.rgb, vec3(0.299, 0.587, 0.114));
color.rgb = clamp(mix(vec3(luma), color.rgb, 1.6), 0.0, 1.0);
// Hover highlight: boost contrast on the hovered player's tiles, pushing
// channels away from mid-gray. uHighlightBrighten is the strength; 0 disables.
if (uHighlightOwner != 0u && owner == uHighlightOwner && uHighlightBrighten > 0.0) {
float contrast = 1.0 + uHighlightBrighten;
color.rgb = clamp((color.rgb - 0.5) * contrast + 0.5, 0.0, 1.0);
}
// Defense bonus: darken the fill on interior tiles defended by a same-owner