/*->if (numargs < 2) { exit(-1); }*/ /*->FILE *file = NULL; file = fopen("L:\\Ogre3D\\ogrenew\\Tools\\GPUObscurancesOgre3D1\\bin\\debug\\tmp.txt", "w"); fprintf(file, "%s", argv); fclose(file);*/ XmlOptions opts; // opts.interactiveMode = false; opts.lodDist = 500; opts.lodFixed = 0; opts.lodPercent = 20; opts.numLods = 0; opts.usePercent = true; opts.generateEdgeLists = true; opts.generateTangents = false; opts.reorganiseBuffers = true; opts.optimiseAnimations = true; opts.quietMode = false; opts.endian = Serializer::ENDIAN_NATIVE; // ignore program name /*->char* source = "objMesh.mesh"; char* dest = "objMesh.xml";*/ char* source = "L:\\Ogre3D\\ogrenew\\Tools\\GPUObscurancesOgre3D1\\bin\\Debug\\objMesh.mesh"; char* dest = "L:\\Ogre3D\\ogrenew\\Tools\\GPUObscurancesOgre3D1\\bin\\Debug\\objMesh.xml"; FILE *file = NULL; file = fopen("L:\\Ogre3D\\ogrenew\\Tools\\GPUObscurancesOgre3D1\\bin\\Debug\\tmp.txt", "w"); fprintf(file, "\nFitxer origen: %s\nFitxer desti: %s\n", source, dest); fclose(file); // Set up options UnaryOptionList unOpt; BinaryOptionList binOpt; unOpt["-i"] = false; unOpt["-e"] = false; unOpt["-r"] = false; unOpt["-t"] = false; unOpt["-o"] = false; unOpt["-q"] = false; unOpt["-d3d"] = false; unOpt["-gl"] = true; binOpt["-l"] = ""; binOpt["-d"] = ""; binOpt["-p"] = ""; binOpt["-f"] = ""; binOpt["-E"] = ""; binOpt["-log"] = "OgreXMLConverter.log"; //->int startIndex = findCommandLineOpts(numArgs, args, unOpt, binOpt); UnaryOptionList::iterator ui; BinaryOptionList::iterator bi; ui = unOpt.find("-q"); if (ui->second) { opts.quietMode = true; } ui = unOpt.find("-i"); if (ui->second) { opts.interactiveMode = true; } else { ui = unOpt.find("-e"); if (ui->second) { opts.generateEdgeLists = false; } ui = unOpt.find("-r"); if (ui->second) { opts.reorganiseBuffers = false; } ui = unOpt.find("-t"); if (ui->second) { opts.generateTangents = true; } ui = unOpt.find("-o"); if (ui->second) { opts.optimiseAnimations = false; } bi = binOpt.find("-l"); if (!bi->second.empty()) { opts.numLods = StringConverter::parseInt(bi->second); } bi = binOpt.find("-d"); if (!bi->second.empty()) { opts.lodDist = StringConverter::parseReal(bi->second); } bi = binOpt.find("-p"); if (!bi->second.empty()) { opts.lodPercent = StringConverter::parseReal(bi->second); opts.usePercent = true; } bi = binOpt.find("-f"); if (!bi->second.empty()) { opts.lodFixed = StringConverter::parseInt(bi->second); opts.usePercent = false; } bi = binOpt.find("-log"); if (!bi->second.empty()) { opts.logFile = bi->second; } bi = binOpt.find("-E"); if (!bi->second.empty()) { if (bi->second == "big") opts.endian = Serializer::ENDIAN_BIG; else if (bi->second == "little") opts.endian = Serializer::ENDIAN_LITTLE; else opts.endian = Serializer::ENDIAN_NATIVE; } ui = unOpt.find("-d3d"); if (ui->second) { opts.d3d = true; } ui = unOpt.find("-gl"); if (ui->second) { opts.gl = true; opts.d3d = false; } } // Source / dest /*->source = argv; source = "objMesh.mesh"; dest = "objMesh.xml"; /*->dest = source; strcat(dest, ".xml");*/ /*->if (numArgs > startIndex) source = args[startIndex]; if (numArgs > startIndex+1) dest = args[startIndex+1];*/ if (!source) { cout << "Missing source file - abort. " << endl; //->help(); exit(1); } // Work out what kind of conversion this is opts.source = source; std::vector srcparts = StringUtil::split(opts.source, "."); String& ext = srcparts.back(); StringUtil::toLowerCase(ext); opts.sourceExt = ext; if (!dest) { if (opts.sourceExt == "xml") { // dest is source minus .xml opts.dest = opts.source.substr(0, opts.source.size() - 4); } else { // dest is source + .xml opts.dest = opts.source; opts.dest.append(".xml"); } } else { opts.dest = dest; } std::vector dstparts = StringUtil::split(opts.dest, "."); ext = dstparts.back(); StringUtil::toLowerCase(ext); opts.destExt = ext; if (!opts.quietMode) { cout << endl; cout << "-- OPTIONS --" << endl; cout << "source file = " << opts.source << endl; cout << "destination file = " << opts.dest << endl; cout << "log file = " << opts.logFile << endl; cout << "interactive mode = " << StringConverter::toString(opts.interactiveMode) << endl; if (opts.numLods == 0) { cout << "lod levels = none (or use existing)" << endl; } else { cout << "lod levels = " << opts.numLods << endl; cout << "lod distance = " << opts.lodDist << endl; if (opts.usePercent) { cout << "lod reduction = " << opts.lodPercent << "%" << endl; } else { cout << "lod reduction = " << opts.lodFixed << " verts" << endl; } } cout << "Generate edge lists = " << opts.generateEdgeLists << endl; cout << "Generate tangents = " << opts.generateTangents << endl; cout << "Reorganise vertex buffers = " << opts.reorganiseBuffers << endl; cout << "Optimise animations = " << opts.optimiseAnimations << endl; cout << "-- END OPTIONS --" << endl; cout << endl; } // //->parseArgs(argv, opts);