mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-25 02:32:31 +00:00
Update & refactor dark mode (#4114)
## Description: - The renderer no longer knows what "dark mode" is. `RenderSettings.dayNight.mode` (`"light" | "dark"`) is gone — passes read neutral values (`lighting.ambient: number`, `lighting.enabled: boolean`). - `render-settings.json` holds the light-mode baseline. Dark mode is just another override layer, applied the same way as graphics settings (`darkNames`, `classicIcons`, etc.). - New `src/client/render/gl/RenderOverrides.ts` exposes two in-place mutators with matching shapes: - `applyGraphicsOverrides(settings, overrides)` — replaces the old `generateRenderSettings` - `applyDarkModeOverride(settings, isDark)` - `ClientGameRunner` regenerates the live settings each time the user setting changes via `deepAssign(live, createRenderSettings())` + the override chain. No per-slice copy list, no intermediate object — adding a new override that touches a new section just works. - Renamed `dayNight` → `lighting`; collapsed `nightAmbient`/`dayAmbient` into single `ambient`; renamed `enableLightCompositing` → `enabled`. - Bumped dark-mode ambient from 0.15 → 0.35 so terrain stays readable. <img width="1250" height="846" alt="Screenshot 2026-06-02 at 11 47 28 AM" src="https://github.com/user-attachments/assets/b41e8ffb-6011-4ba0-9e1f-c2a21ff90794" /> ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory ## Please put your Discord username so you can be contacted if a bug or regression is found: evan
This commit is contained in:
@@ -2,7 +2,6 @@ import type { RenderSettings } from "../RenderSettings";
|
||||
import type { DebugNode } from "./Folder";
|
||||
import { folder } from "./Folder";
|
||||
import { color } from "./props/Color";
|
||||
import { select } from "./props/Select";
|
||||
import { slider } from "./props/Slider";
|
||||
import { toggle } from "./props/Toggle";
|
||||
|
||||
@@ -90,30 +89,29 @@ export function buildTree(s: RenderSettings, d: RenderSettings): DebugNode[] {
|
||||
slider(s.falloutBloom, "particleFreshScale", d.falloutBloom, 0, 1, 0.01),
|
||||
]),
|
||||
|
||||
folder("Day / Night", [
|
||||
select(s.dayNight, "mode", d.dayNight, ["light", "dark"], "Mode"),
|
||||
slider(s.dayNight, "nightAmbient", d.dayNight, 0, 1, 0.01),
|
||||
slider(s.dayNight, "dayAmbient", d.dayNight, 0, 1, 0.01),
|
||||
slider(s.dayNight, "falloffPower", d.dayNight, 0.5, 5, 0.1),
|
||||
slider(s.dayNight, "falloutLightIntensity", d.dayNight, 0, 20, 0.1),
|
||||
slider(s.dayNight, "falloutLightThreshold", d.dayNight, 0, 0.5, 0.001),
|
||||
slider(s.dayNight, "blurZoomDivisor", d.dayNight, 1, 20, 0.5),
|
||||
slider(s.dayNight, "lightRadiusMultiplier", d.dayNight, 0.1, 5, 0.1),
|
||||
folder("Lighting", [
|
||||
toggle(s.lighting, "enabled", d.lighting),
|
||||
slider(s.lighting, "ambient", d.lighting, 0, 1, 0.01),
|
||||
slider(s.lighting, "falloffPower", d.lighting, 0.5, 5, 0.1),
|
||||
slider(s.lighting, "falloutLightIntensity", d.lighting, 0, 20, 0.1),
|
||||
slider(s.lighting, "falloutLightThreshold", d.lighting, 0, 0.5, 0.001),
|
||||
slider(s.lighting, "blurZoomDivisor", d.lighting, 1, 20, 0.5),
|
||||
slider(s.lighting, "lightRadiusMultiplier", d.lighting, 0.1, 5, 0.1),
|
||||
color(
|
||||
s.dayNight,
|
||||
s.lighting,
|
||||
"falloutLightR",
|
||||
"falloutLightG",
|
||||
"falloutLightB",
|
||||
d.dayNight,
|
||||
d.lighting,
|
||||
"Fallout Light Color",
|
||||
),
|
||||
slider(s.dayNight, "emberLightIntensity", d.dayNight, 0, 20, 0.1),
|
||||
slider(s.lighting, "emberLightIntensity", d.lighting, 0, 20, 0.1),
|
||||
color(
|
||||
s.dayNight,
|
||||
s.lighting,
|
||||
"emberLightR",
|
||||
"emberLightG",
|
||||
"emberLightB",
|
||||
d.dayNight,
|
||||
d.lighting,
|
||||
"Ember Light Color",
|
||||
),
|
||||
]),
|
||||
|
||||
Reference in New Issue
Block a user