Browse Source

texturec: Write sRGB images unless linear is requested

Robin Allen 5 năm trước cách đây
mục cha
commit
60dea9bd74
1 tập tin đã thay đổi với 10 bổ sung2 xóa
  1. 10 2
      tools/texturec/texturec.cpp

+ 10 - 2
tools/texturec/texturec.cpp

@@ -931,7 +931,7 @@ void help(const char* _error = NULL, bool _showHelp = true)
 		  "  -q <quality>             Encoding quality (default, fastest, highest).\n"
 		  "  -q <quality>             Encoding quality (default, fastest, highest).\n"
 		  "  -m, --mips               Generate mip-maps.\n"
 		  "  -m, --mips               Generate mip-maps.\n"
 		  "      --mipskip <N>        Skip <N> number of mips.\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"
 		  "      --equirect           Input texture is equirectangular projection of cubemap.\n"
 		  "      --strip              Input texture is horizontal strip of cubemap.\n"
 		  "      --strip              Input texture is horizontal strip of cubemap.\n"
 		  "      --sdf                Compute SDF texture.\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"
 		  "      --pma                Premultiply alpha into RGB channel.\n"
 		  "      --linear             Input and output texture is linear color space (gamma correction won't be applied).\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"
 		  "      --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"
 		  "      --radiance <model>   Radiance cubemap filter. (Lighting model: Phong, PhongBrdf, Blinn, BlinnBrdf, GGX)\n"
 		  "      --as <extension>     Save as.\n"
 		  "      --as <extension>     Save as.\n"
 		  "      --formats            List all supported formats.\n"
 		  "      --formats            List all supported formats.\n"
@@ -1091,6 +1091,12 @@ int main(int _argc, const char* _argv[])
 		return bx::kExitFailure;
 		return bx::kExitFailure;
 	}
 	}
 
 
+	// Normal maps are always linear
+	if (options.normalMap)
+	{
+		options.linear = true;
+	}
+
 	const char* maxSize = cmdLine.findOption("max");
 	const char* maxSize = cmdLine.findOption("max");
 	if (NULL != maxSize)
 	if (NULL != maxSize)
 	{
 	{
@@ -1215,6 +1221,8 @@ int main(int _argc, const char* _argv[])
 
 
 	if (NULL != output)
 	if (NULL != output)
 	{
 	{
+		output->m_srgb = !options.linear;
+
 		bx::FileWriter writer;
 		bx::FileWriter writer;
 		if (bx::open(&writer, outputFileName, false, &err) )
 		if (bx::open(&writer, outputFileName, false, &err) )
 		{
 		{