Changed: New tga2dds option -g to force grayscale image instead of alpha

--HG--
branch : develop
This commit is contained in:
kervala 2016-12-09 13:53:43 +01:00
parent 0b171001d1
commit 9e0b38e6e0

View file

@ -300,6 +300,7 @@ int main(int argc, char **argv)
"\n" "\n"
" default : DXTC1 if 24 bits, DXTC5 if 32 bits." " 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("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.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); args.addAdditionalArg("input", "PNG or TGA files to convert", false);
@ -309,6 +310,7 @@ int main(int argc, char **argv)
string OptOutputFileName; string OptOutputFileName;
uint8 OptAlgo = NOT_DEFINED; uint8 OptAlgo = NOT_DEFINED;
bool OptMipMap = false; bool OptMipMap = false;
bool OptGrayscale = false;
uint Reduce = 0; uint Reduce = 0;
if (args.haveArg("o")) if (args.haveArg("o"))
@ -317,6 +319,9 @@ int main(int argc, char **argv)
if (args.haveArg("m")) if (args.haveArg("m"))
OptMipMap = true; OptMipMap = true;
if (args.haveArg("g"))
OptGrayscale = true;
if (args.haveArg("a")) if (args.haveArg("a"))
{ {
std::string strAlgo = args.getArg("a").front(); std::string strAlgo = args.getArg("a").front();
@ -365,12 +370,17 @@ int main(int argc, char **argv)
{ {
return 0; return 0;
} }
NLMISC::CIFile input; NLMISC::CIFile input;
if(!input.open(inputFileName)) if(!input.open(inputFileName))
{ {
cerr<<"Can't open input file " << inputFileName << endl; cerr<<"Can't open input file " << inputFileName << endl;
return 1; return 1;
} }
// allow to load an image as grayscale instead of alpha
if (OptGrayscale) picTga.loadGrayscaleAsAlpha(false);
uint8 imageDepth = picTga.load(input); uint8 imageDepth = picTga.load(input);
if(imageDepth==0) if(imageDepth==0)
{ {