texturec: Added save as option.

This commit is contained in:
Branimir Karadžić 2017-04-22 14:20:17 -07:00
parent 5617c33c4b
commit 97ddfaa776

View File

@ -370,6 +370,7 @@ void help(const char* _error = NULL)
" --iqa Image Quality Assesment\n"
" --max <max size> Maximum width/height (image will be scaled down and\n"
" aspect ratio will be preserved.\n"
" --as <extension> Save as.\n"
"\n"
"For additional information, see https://github.com/bkaradzic/bgfx\n"
@ -400,6 +401,14 @@ int main(int _argc, const char* _argv[])
return EXIT_FAILURE;
}
const char* saveAs = cmdLine.findOption("as");
saveAs = NULL == saveAs ? bx::stristr(outputFileName, ".ktx") : saveAs;
if (NULL == saveAs)
{
help("Output file format must be specified.");
return EXIT_FAILURE;
}
Options options;
const char* edgeOpt = cmdLine.findOption("sdf");
@ -463,7 +472,7 @@ int main(int _argc, const char* _argv[])
bx::CrtFileWriter writer;
if (bx::open(&writer, outputFileName) )
{
// if (NULL != bx::stristr(outputFileName, ".ktx") )
if (NULL != bx::stristr(saveAs, "ktx") )
{
bimg::imageWriteKtx(&writer, *output, output->m_data, output->m_size);
}