-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconsol_reader.h
39 lines (25 loc) · 1.12 KB
/
consol_reader.h
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
#pragma once
#include "cxxopts.hpp"
#include "sampler/sampler.h"
struct Parameters {
uint32_t samples_per_pixel;
Generator gen_type;
uint32_t width;
uint32_t height;
};
Parameters ReadParams(int argc, const char* argv[]) {
cxxopts::Options options("sampler <params>", "commands");
options.add_options()
("w, width", "screen width", cxxopts::value<uint32_t>()->default_value("800"))
("h, height", "screen height", cxxopts::value<uint32_t>()->default_value("800"))
("spp", "samples per pixel", cxxopts::value<uint32_t>()->default_value("256"))
("gen_type", "type of random generator", cxxopts::value<uint32_t>()->default_value("0"))
//("asset", "CornellBox-Original", cxxopts::value<uint32_t>()->default_value("0"))
;
auto result = options.parse(argc, argv);
auto screenWidth = result["width"].as<uint32_t>();
auto screenHeight = result["height"].as<uint32_t>();
auto spp = result["spp"].as<uint32_t>();
auto gen_type = static_cast<Generator>(result["gen_type"].as<uint32_t>());
return Parameters{spp, gen_type, screenWidth, screenHeight};
}