| 81 | } |
| 82 | |
| 83 | int main(int argc, char *argv[]) { |
| 84 | // This is required to run AMD GPU profiler |
| 85 | //XInitThreads(); |
| 86 | |
| 87 | try { |
| 88 | // Initialize LuxCore |
| 89 | luxcore::Init(); |
| 90 | |
| 91 | bool removeUnused = false; |
| 92 | Properties cmdLineProp; |
| 93 | string configFileName; |
| 94 | for (int i = 1; i < argc; i++) { |
| 95 | if (argv[i][0] == '-') { |
| 96 | // I should check for out of range array index... |
| 97 | |
| 98 | if (argv[i][1] == 'h') { |
| 99 | LC_LOG("Usage: " << argv[0] << " [options] [configuration file]" << endl << |
| 100 | " -o [configuration file]" << endl << |
| 101 | " -f [scene file]" << endl << |
| 102 | " -w [film width]" << endl << |
| 103 | " -e [film height]" << endl << |
| 104 | " -D [property name] [property value]" << endl << |
| 105 | " -d [current directory path]" << endl << |
| 106 | " -c <remove all unused meshes, materials, textures and image maps>" << endl << |
| 107 | " -h <display this help and exit>"); |
| 108 | exit(EXIT_SUCCESS); |
| 109 | } |
| 110 | else if (argv[i][1] == 'o') { |
| 111 | if (configFileName.compare("") != 0) |
| 112 | throw runtime_error("Used multiple configuration files"); |
| 113 | |
| 114 | configFileName = string(argv[++i]); |
| 115 | } |
| 116 | |
| 117 | else if (argv[i][1] == 'e') cmdLineProp.Set(Property("film.height")(argv[++i])); |
| 118 | |
| 119 | else if (argv[i][1] == 'w') cmdLineProp.Set(Property("film.width")(argv[++i])); |
| 120 | |
| 121 | else if (argv[i][1] == 'f') cmdLineProp.Set(Property("scene.file")(argv[++i])); |
| 122 | |
| 123 | else if (argv[i][1] == 'D') { |
| 124 | cmdLineProp.Set(Property(argv[i + 1]).Add(argv[i + 2])); |
| 125 | i += 2; |
| 126 | } |
| 127 | |
| 128 | else if (argv[i][1] == 'd') boost::filesystem::current_path(boost::filesystem::path(argv[++i])); |
| 129 | |
| 130 | else if (argv[i][1] == 'c') removeUnused = true; |
| 131 | |
| 132 | else { |
| 133 | LC_LOG("Invalid option: " << argv[i]); |
| 134 | exit(EXIT_FAILURE); |
| 135 | } |
| 136 | } else { |
| 137 | const string fileName = argv[i]; |
| 138 | const string ext = GetFileNameExt(argv[i]); |
| 139 | if ((ext == ".cfg") || |
| 140 | (ext == ".lxs") || |
nothing calls this directly
no test coverage detected