28int main(
int argc,
char** argv)
30 Console::println(
string(
"optimizemodel ") + Version::getVersion());
31 Console::println(Version::getCopyright());
34 Console::println(
"Usage: optimizemodel file.tm [exclude_materials_with_specific_filename1] [exclude_materials_with_specific_filenameN]");
37 string fileName = string(argv[1]);
38 if (StringTools::endsWith(StringTools::toLowerCase(fileName),
".tm") ==
false) {
39 Console::println(
"optimizemodel only accepts .tm model files");
42 vector<string> excludeDiffuseTextureFileNamePatterns;
43 for (
auto i = 2; i < argc; i++) excludeDiffuseTextureFileNamePatterns.push_back(argv[i]);
45 Console::println(
"Loading model: " + fileName);
46 auto model = ModelReader::read(
47 FileSystem::getInstance()->getPathName(fileName),
48 FileSystem::getInstance()->getFileName(fileName)
50 auto optimizedModel = model;
51 if (ModelTools::isOptimizedModel(model) ==
true) {
52 Console::println(
"Already optimized. Skipping.");
54 Console::println(
"Optimizing model: " + fileName);
55 optimizedModel = ModelTools::optimizeModel(model, FileSystem::getInstance()->getPathName(fileName), excludeDiffuseTextureFileNamePatterns);
56 if (optimizedModel == model) {
57 Console::println(
"No optimization was required. Skipping.");
59 Console::println(
"Exporting model: " + fileName);
62 FileSystem::getInstance()->getPathName(fileName),
63 FileSystem::getInstance()->getFileName(fileName)
67 delete optimizedModel;
69 Console::println(
"An error occurred: " +
string(exception.what()));
Application base class, please make sure to allocate application on heap to have correct application ...
File system singleton class.
std::exception Exception
Exception base class.
int main(int argc, char **argv)