1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
// Copyright 2009-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
#include "../common/tutorial/tutorial.h"
#include "../common/tutorial/benchmark_render.h"
namespace embree
{
extern "C" {
int g_spp = 1;
int g_max_path_length = 8;
bool g_accumulate = 1;
}
struct Tutorial : public SceneLoadingTutorialApplication
{
Tutorial()
: SceneLoadingTutorialApplication("pathtracer",FEATURE_RTCORE)
{
registerOption("spp", [] (Ref<ParseStream> cin, const FileName& path) {
g_spp = cin->getInt();
}, "--spp <int>: sets number of samples per pixel");
registerOption("max-path-length", [] (Ref<ParseStream> cin, const FileName& path) {
g_max_path_length = cin->getInt();
}, "--max-path-length <int>: sets maximal path length (1=primary+shadow)");
registerOption("accumulate", [] (Ref<ParseStream> cin, const FileName& path) {
g_accumulate = cin->getInt();
}, "--accumulate <bool>: accumulate samples (on by default)");
}
void postParseCommandLine() override
{
/* load default scene if none specified */
if (scene_empty_post_parse()) {
FileName file = FileName::executableFolder() + FileName("models/cornell_box.ecs");
parseCommandLine(new ParseStream(new LineCommentFilter(file, "#")), file.path());
}
}
#if defined(USE_GLFW)
void drawGUI() override
{
ImGui::Checkbox("accumulate",&g_accumulate);
ImGui::Text("max path length");
ImGui::DragInt("",&g_max_path_length,1.0f,1,16);
ImGui::Text("samples per pixel");
ImGui::DragInt("",&g_spp,1.0f,1,16);
}
#endif
};
}
int main(int argc, char** argv) {
if (embree::TutorialBenchmark::benchmark(argc, argv)) {
return embree::TutorialBenchmark(embree::renderBenchFunc<embree::Tutorial>).main(argc, argv);
}
return embree::Tutorial().main(argc,argv);
}
|