texturec: Write sRGB images unless linear is requested

This commit is contained in:
Robin Allen
2020-03-03 22:16:16 +00:00
parent 7d226675ea
commit 60dea9bd74

View File

@@ -931,7 +931,7 @@ void help(const char* _error = NULL, bool _showHelp = true)
" -q <quality> Encoding quality (default, fastest, highest).\n"
" -m, --mips Generate mip-maps.\n"
" --mipskip <N> Skip <N> 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 <max size> Maximum width/height (image will be scaled down and\n"
" aspect ratio will be preserved.\n"
" aspect ratio will be preserved)\n"
" --radiance <model> Radiance cubemap filter. (Lighting model: Phong, PhongBrdf, Blinn, BlinnBrdf, GGX)\n"
" --as <extension> 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) )
{