|
18 | 18 | using namespace nbl;
|
19 | 19 | using namespace core;
|
20 | 20 |
|
21 |
| -int main() |
| 21 | +int main(int argc, char** argv) |
22 | 22 | {
|
| 23 | + std::string filePath = ""; |
| 24 | + // Usage: ./raytracedao Mitsuba_XML_file_or_ZIP |
| 25 | + if( argc >= 2 ) { |
| 26 | + filePath = argv[1]; |
| 27 | + } |
| 28 | + |
23 | 29 | // create device with full flexibility over creation parameters
|
24 | 30 | // you can add more parameters if desired, check nbl::SIrrlichtCreationParameters
|
25 | 31 | nbl::SIrrlichtCreationParameters params;
|
@@ -49,15 +55,20 @@ int main()
|
49 | 55 | am->addAssetLoader(std::move(serializedLoader));
|
50 | 56 | am->addAssetLoader(std::move(mitsubaLoader));
|
51 | 57 |
|
52 |
| - //std::string filePath = "../../media/mitsuba/daily_pt.xml"; |
53 |
| - std::string filePath = "../../media/mitsuba/staircase2.zip"; |
54 | 58 | //#define MITSUBA_LOADER_TESTS
|
55 | 59 | #ifndef MITSUBA_LOADER_TESTS
|
56 |
| - pfd::message("Choose file to load", "Choose mitsuba XML file to load or ZIP containing an XML. \nIf you cancel or choosen file fails to load, simple scene will be loaded.", pfd::choice::ok); |
57 |
| - pfd::open_file file("Choose XML or ZIP file", "../../media/mitsuba", { "ZIP files (.zip)", "*.zip", "XML files (.xml)", "*.xml"}); |
58 |
| - if (!file.result().empty()) |
59 |
| - filePath = file.result()[0]; |
| 60 | + if(filePath.empty()) |
| 61 | + { |
| 62 | + pfd::message("Choose file to load", "Choose mitsuba XML file to load or ZIP containing an XML. \nIf you cancel or choosen file fails to load, simple scene will be loaded.", pfd::choice::ok); |
| 63 | + pfd::open_file file("Choose XML or ZIP file", "../../media/mitsuba", { "ZIP files (.zip)", "*.zip", "XML files (.xml)", "*.xml"}); |
| 64 | + if (!file.result().empty()) |
| 65 | + filePath = file.result()[0]; |
| 66 | + } |
60 | 67 | #endif
|
| 68 | + |
| 69 | + if(filePath.empty()) |
| 70 | + filePath = "../../media/mitsuba/staircase2.zip"; |
| 71 | + |
61 | 72 | if (core::hasFileExtension(io::path(filePath.c_str()), "zip", "ZIP"))
|
62 | 73 | {
|
63 | 74 | io::IFileArchive* arch = nullptr;
|
|
0 commit comments