summaryrefslogtreecommitdiffstats
path: root/src/world.cpp
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-11-04 01:07:38 +0100
committersalmonik <salmonik@tuta.io>2026-11-04 01:07:38 +0100
commitd5f08c8a100a24775daf8219bd4d9c277bfdd070 (patch)
tree648fa20dfc9a72614a09c1cd7d96e46673c78a21 /src/world.cpp
parentSkybox image: apply HDR colour compensation where materials exist (diff)
downloadhl2h-d5f08c8a100a24775daf8219bd4d9c277bfdd070.tar.gz
hl2h-d5f08c8a100a24775daf8219bd4d9c277bfdd070.zip
Skybox image: swap red/blue in the uploaded texture
The procedural texture reaches the sky sampler with the red and blue channels exchanged (blue sky rendered orange/yellow), while the game's own textures are correct. Swap R/B in the decoded buffer so the sampled colours match the PNG.
Diffstat (limited to '')
-rw-r--r--src/world.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/world.cpp b/src/world.cpp
index 092df77..38d302f 100644
--- a/src/world.cpp
+++ b/src/world.cpp
@@ -610,6 +610,15 @@ bool load_png_rgba(const char *path, std::vector<unsigned char> &pixels,
610 } 610 }
611 } 611 }
612 612
613 // The material system's procedural upload reaches the sampler with red and
614 // blue exchanged (the sky shader sees the blue background as orange). Swap
615 // them here so the sampled colours match the PNG.
616 for (size_t i = 0; i + 3 < pixels.size(); i += 4) {
617 unsigned char t = pixels[i];
618 pixels[i] = pixels[i + 2];
619 pixels[i + 2] = t;
620 }
621
613 out_w = (int)w; 622 out_w = (int)w;
614 out_h = (int)h; 623 out_h = (int)h;
615 return true; 624 return true;