From 9e0b38e6e0f42aa69db3710027ad4ae6551c9e1c Mon Sep 17 00:00:00 2001 From: kervala Date: Fri, 9 Dec 2016 13:53:43 +0100 Subject: [PATCH] Changed: New tga2dds option -g to force grayscale image instead of alpha --HG-- branch : develop --- code/nel/tools/3d/tga_2_dds/tga2dds.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/code/nel/tools/3d/tga_2_dds/tga2dds.cpp b/code/nel/tools/3d/tga_2_dds/tga2dds.cpp index 6c53b7ec9..d7158c045 100644 --- a/code/nel/tools/3d/tga_2_dds/tga2dds.cpp +++ b/code/nel/tools/3d/tga_2_dds/tga2dds.cpp @@ -300,6 +300,7 @@ int main(int argc, char **argv) "\n" " default : DXTC1 if 24 bits, DXTC5 if 32 bits." ); + args.addArg("g", "grayscale", "", "Don't load grayscape images as alpha but as grayscale"); args.addArg("m", "mipmap", "", "Create MipMap"); args.addArg("r", "reduce", "FACTOR", "Reduce the bitmap size before compressing\n FACTOR is 0, 1, 2, 3, 4, 5, 6, 7 or 8"); args.addAdditionalArg("input", "PNG or TGA files to convert", false); @@ -309,6 +310,7 @@ int main(int argc, char **argv) string OptOutputFileName; uint8 OptAlgo = NOT_DEFINED; bool OptMipMap = false; + bool OptGrayscale = false; uint Reduce = 0; if (args.haveArg("o")) @@ -317,6 +319,9 @@ int main(int argc, char **argv) if (args.haveArg("m")) OptMipMap = true; + if (args.haveArg("g")) + OptGrayscale = true; + if (args.haveArg("a")) { std::string strAlgo = args.getArg("a").front(); @@ -365,12 +370,17 @@ int main(int argc, char **argv) { return 0; } + NLMISC::CIFile input; if(!input.open(inputFileName)) { cerr<<"Can't open input file " << inputFileName << endl; return 1; } + + // allow to load an image as grayscale instead of alpha + if (OptGrayscale) picTga.loadGrayscaleAsAlpha(false); + uint8 imageDepth = picTga.load(input); if(imageDepth==0) {