| 21 | } |
| 22 | |
| 23 | struct Tutorial : public SceneLoadingTutorialApplication |
| 24 | { |
| 25 | Tutorial() |
| 26 | : SceneLoadingTutorialApplication(NAME,FEATURES) |
| 27 | { |
| 28 | registerOption("spp", [] (Ref<ParseStream> cin, const FileName& path) { |
| 29 | g_spp = cin->getInt(); |
| 30 | }, "--spp <int>: sets number of samples per pixel"); |
| 31 | |
| 32 | registerOption("max-path-length", [] (Ref<ParseStream> cin, const FileName& path) { |
| 33 | g_max_path_length = cin->getInt(); |
| 34 | }, "--max-path-length <int>: sets maximal path length (1=primary+shadow)"); |
| 35 | |
| 36 | registerOption("accumulate", [] (Ref<ParseStream> cin, const FileName& path) { |
| 37 | g_accumulate = cin->getInt(); |
| 38 | }, "--accumulate <bool>: accumulate samples (on by default)"); |
| 39 | } |
| 40 | |
| 41 | void postParseCommandLine() override |
| 42 | { |
| 43 | /* load default scene if none specified */ |
| 44 | if (scene_empty_post_parse()) { |
| 45 | FileName file = FileName::executableFolder() + FileName("models/cornell_box.ecs"); |
| 46 | parseCommandLine(new ParseStream(new LineCommentFilter(file, "#")), file.path()); |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | #if defined(USE_GLFW) |
| 51 | void drawGUI() override |
| 52 | { |
| 53 | ImGui::Checkbox("accumulate",&g_accumulate); |
| 54 | ImGui::Text("max path length"); |
| 55 | ImGui::DragInt("##max_path_length",&g_max_path_length,1.0f,1,16); |
| 56 | ImGui::Text("samples per pixel"); |
| 57 | ImGui::DragInt("##samples per pixel",&g_spp,1.0f,1,16); |
| 58 | } |
| 59 | #endif |
| 60 | }; |
| 61 | |
| 62 | } |
| 63 | |