diff options
Diffstat (limited to 'src/world.cpp')
| -rw-r--r-- | src/world.cpp | 9 |
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; |
