From 60dea9bd7423c9c582b4b649f9c46b4565b2b87e Mon Sep 17 00:00:00 2001 From: Robin Allen Date: Tue, 3 Mar 2020 22:16:16 +0000 Subject: [PATCH] texturec: Write sRGB images unless linear is requested --- tools/texturec/texturec.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tools/texturec/texturec.cpp b/tools/texturec/texturec.cpp index 315f0e6..ca03362 100644 --- a/tools/texturec/texturec.cpp +++ b/tools/texturec/texturec.cpp @@ -931,7 +931,7 @@ void help(const char* _error = NULL, bool _showHelp = true) " -q Encoding quality (default, fastest, highest).\n" " -m, --mips Generate mip-maps.\n" " --mipskip Skip number of mips.\n" - " -n, --normalmap Input texture is normal map.\n" + " -n, --normalmap Input texture is normal map. (Implies --linear)\n" " --equirect Input texture is equirectangular projection of cubemap.\n" " --strip Input texture is horizontal strip of cubemap.\n" " --sdf Compute SDF texture.\n" @@ -940,7 +940,7 @@ void help(const char* _error = NULL, bool _showHelp = true) " --pma Premultiply alpha into RGB channel.\n" " --linear Input and output texture is linear color space (gamma correction won't be applied).\n" " --max Maximum width/height (image will be scaled down and\n" - " aspect ratio will be preserved.\n" + " aspect ratio will be preserved)\n" " --radiance Radiance cubemap filter. (Lighting model: Phong, PhongBrdf, Blinn, BlinnBrdf, GGX)\n" " --as Save as.\n" " --formats List all supported formats.\n" @@ -1091,6 +1091,12 @@ int main(int _argc, const char* _argv[]) return bx::kExitFailure; } + // Normal maps are always linear + if (options.normalMap) + { + options.linear = true; + } + const char* maxSize = cmdLine.findOption("max"); if (NULL != maxSize) { @@ -1215,6 +1221,8 @@ int main(int _argc, const char* _argv[]) if (NULL != output) { + output->m_srgb = !options.linear; + bx::FileWriter writer; if (bx::open(&writer, outputFileName, false, &err) ) {