From 97ddfaa776729bf72fb4aafefe412e916b19c97d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Sat, 22 Apr 2017 14:20:17 -0700 Subject: [PATCH] texturec: Added save as option. --- tools/texturec/texturec.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tools/texturec/texturec.cpp b/tools/texturec/texturec.cpp index 58725c948..77c936e01 100644 --- a/tools/texturec/texturec.cpp +++ b/tools/texturec/texturec.cpp @@ -370,6 +370,7 @@ void help(const char* _error = NULL) " --iqa Image Quality Assesment\n" " --max Maximum width/height (image will be scaled down and\n" " aspect ratio will be preserved.\n" + " --as 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); }