summaryrefslogtreecommitdiffstats
path: root/CONTEXT.md
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-11-03 23:58:59 +0100
committersalmonik <salmonik@tuta.io>2026-11-03 23:58:59 +0100
commit9c4455af43da34127864b09ad2a3d3e996c9dce1 (patch)
treeeb3754763db7c00fe664b900f9a560057bcb9955 /CONTEXT.md
parentWorld: add skybox changer (diff)
downloadhl2h-9c4455af43da34127864b09ad2a3d3e996c9dce1.tar.gz
hl2h-9c4455af43da34127864b09ad2a3d3e996c9dce1.zip
World: replace skybox changer with a PNG skybox image
sv_skyname did not take effect at runtime in this build, so the Skybox card now replaces the skybox materials' textures with <config dir>/skybox.png. The PNG is decoded through libpng16's simplified API (dlopen'ed, so no new link dependency) and uploaded with IMaterialSystem::CreateTextureFromBits as an RGBA8888 texture. IMaterialVar::SetTextureValue assigns it to $basetexture and the HDR variants for every material in the SkyBox textures group (all six faces get the same image). Original textures are recorded per material/var (texture pointer plus string fallback) and restored when the feature is off. Records survive level changes so a reused sky material is still restorable; the override is re-applied to a new map automatically. The card shows the image path and has a Reload image button; a missing/unreadable PNG raises an error toast.
Diffstat (limited to 'CONTEXT.md')
-rw-r--r--CONTEXT.md33
1 files changed, 19 insertions, 14 deletions
diff --git a/CONTEXT.md b/CONTEXT.md
index f2b091a..a490403 100644
--- a/CONTEXT.md
+++ b/CONTEXT.md
@@ -358,20 +358,25 @@ vocabulary / decisions.
358- End is clamped above Start. Re-applied on level change via 358- End is clamped above Start. Re-applied on level change via
359 `fog_invalidate()`. Saved as `[fog] active/bind/r/g/b/start/end/skybox/disable`. 359 `fog_invalidate()`. Saved as `[fog] active/bind/r/g/b/start/end/skybox/disable`.
360 360
361### Skybox changer 361### Skybox image
362 362
363- `sv_skyname <name>` through `ClientCmd`, the same mechanism the stock 363- Replaces the map skybox with `<config dir>/skybox.png` (same directory as
364 `skybox_swapper` entity uses. Choice list is the HL2 skybox set from the 364 the INI). Not `sv_skyname`: that did not take effect at runtime in this
365 game's VPK (no episode-only skies, so a selected sky always exists). 365 build, so the skybox card now works on materials instead.
366- Before the first override of a map, the map's own sky is captured by 366- PNG is decoded with libpng16's simplified API (`dlopen`ed, no link
367 scanning loaded materials in the `SkyBox textures` group and parsing 367 dependency); the RGBA pixels become an `ITexture` via
368 `skybox/<name>(_hdr|_ldr)?(rt|bk|lf|ft|up|dn)`. Disabling the feature (or 368 `IMaterialSystem::CreateTextureFromBits` (RGBA8888, one mip).
369 choosing "Map default") restores that name; a level change also restores it 369- The texture is assigned with `IMaterialVar::SetTextureValue` to
370 naturally, so `skybox_invalidate()` just drops the captured state. 370 `$basetexture`, plus `$hdrbasetexture` / `$hdrcompressedtexture` when those
371- Changing the sky invalidates the world tint so the freshly loaded sky 371 vars exist, on every material in the `SkyBox textures` group or named
372 materials get the sky colour. 372 `skybox/*`. The same image is mapped onto all six faces.
373- Saved as `[skybox] active/bind/choice`. The GUI uses a `CK_CHOICE` 373- Original textures are recorded per material/var (texture pointer plus the
374 control (value box with `<`/`>` hit zones). 374 string as a fallback) and restored when the feature is disabled. Records
375 survive level changes so a reused sky material can still be restored; the
376 override is re-applied to the new map automatically.
377- The card shows the image path and has a Reload image button. A missing or
378 unreadable PNG raises an error toast; the image is only re-read on Reload.
379- Saved as `[skybox] active/bind`.
375 380
376## Logging 381## Logging
377 382