Skip to content

Commit 0df6c96

Browse files
committed
raytracer command line file input
1 parent cf9e6ed commit 0df6c96

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

examples_tests/22.RaytracedAO/main.cpp

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,14 @@
1818
using namespace nbl;
1919
using namespace core;
2020

21-
int main()
21+
int main(int argc, char** argv)
2222
{
23+
std::string filePath = "";
24+
// Usage: ./raytracedao Mitsuba_XML_file_or_ZIP
25+
if( argc >= 2 ) {
26+
filePath = argv[1];
27+
}
28+
2329
// create device with full flexibility over creation parameters
2430
// you can add more parameters if desired, check nbl::SIrrlichtCreationParameters
2531
nbl::SIrrlichtCreationParameters params;
@@ -49,15 +55,20 @@ int main()
4955
am->addAssetLoader(std::move(serializedLoader));
5056
am->addAssetLoader(std::move(mitsubaLoader));
5157

52-
//std::string filePath = "../../media/mitsuba/daily_pt.xml";
53-
std::string filePath = "../../media/mitsuba/staircase2.zip";
5458
//#define MITSUBA_LOADER_TESTS
5559
#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+
}
6067
#endif
68+
69+
if(filePath.empty())
70+
filePath = "../../media/mitsuba/staircase2.zip";
71+
6172
if (core::hasFileExtension(io::path(filePath.c_str()), "zip", "ZIP"))
6273
{
6374
io::IFileArchive* arch = nullptr;

0 commit comments

Comments
 (0)