From 01ad1a2317e68ac1f3d4d4ef572dc8d71f1aa7cd Mon Sep 17 00:00:00 2001 From: trotFunky Date: Mon, 30 Sep 2019 19:19:44 +0200 Subject: [PATCH] Inverted Red and Blue channels for TGA loading --- src/DataHandling/Texture.cpp | 15 ++++++++++++++- src/DataHandling/Texture.h | 2 ++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/DataHandling/Texture.cpp b/src/DataHandling/Texture.cpp index 7fc4b32..003d030 100644 --- a/src/DataHandling/Texture.cpp +++ b/src/DataHandling/Texture.cpp @@ -71,7 +71,9 @@ bool Texture::load_tga(const std::string& filename, uint8_t*& data_array) bool Texture::load_rgb_tga(const std::string& rgb_filename) { - return load_tga(rgb_filename,image_data); + bool return_value = load_tga(rgb_filename,image_data); + invert_channels(0,2); + return return_value; } bool Texture::load_rgba_tga(const std::string& rgb_filename, const std::string& mask_filename) @@ -117,3 +119,14 @@ bool Texture::load_rgba_tga(const std::string& rgb_filename, const std::string& return true; } + +void Texture::invert_channels(uint8_t first_channel, uint8_t second_channel) +{ + uint8_t increment = color_bits/8; + for (int i = 0;i