-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathArgParser.h
More file actions
127 lines (108 loc) · 2.36 KB
/
ArgParser.h
File metadata and controls
127 lines (108 loc) · 2.36 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#ifndef ARG_PARSER_H
#define ARG_PARSER_H
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
class ArgParser {
public:
ArgParser() { DefaultValues(); }
ArgParser(int argc, char *argv[]) {
DefaultValues();
for (int i = 1; i < argc; i++) {
// rendering output
if (!strcmp(argv[i],"-input")) {
//cout << "Input\n";
i++; assert (i < argc);
input_file = argv[i];
} else if (!strcmp(argv[i],"-output")) {
//cout << "Output\n";
i++; assert (i < argc);
output_file = argv[i];
} else if (!strcmp(argv[i],"-normals")) {
//cout << "Normal\n";
i++; assert (i < argc);
normals_file = argv[i];
} else if (!strcmp(argv[i],"-size")) {
//cout << "Size\n";
i++; assert (i < argc);
width = atoi(argv[i]);
i++; assert (i < argc);
height = atoi(argv[i]);
}
// rendering options
else if (!strcmp(argv[i],"-depth")) {
//cout << "Depth\n";
i++; assert (i < argc);
depth_min = (float)atof(argv[i]);
i++; assert (i < argc);
depth_max = (float)atof(argv[i]);
i++; assert (i < argc);
depth_file = argv[i];
} else if (!strcmp(argv[i],"-bounces")) {
//cout << "Bounces\n";
i++; assert (i < argc);
bounces = atoi(argv[i]);
} else if (!strcmp(argv[i],"-shadows")) {
//cout << "Shadows\n";
shadows = 1;
}
//Depth of Field
else if (strcmp(argv[i], "-dof") == 0) {
depth_of_field = 1;
}
// supersampling
else if (strcmp(argv[i],"-jitter")==0) {
//cout << "Jitter\n";
jitter = 1;
}else if(strcmp(argv[i],"-filter")==0){
//cout << "Filter\n";
filter =1;
}
else {
printf ("Unknown command line argument %d: '%s'\n",i,argv[i]);
assert(0);
}
}
}
void DefaultValues() {
// rendering output
input_file = NULL;
output_file = NULL;
depth_file = NULL;
normals_file = NULL;
width = 100;
height = 100;
stats = 0;
// rendering options
depth_min = 0;
depth_max = 1;
bounces = 4;
shadows = 0;
depth_of_field = 0;
// sampling
jitter = 0;
filter = 0;
}
// ==============
// REPRESENTATION
// all public! (no accessors)
// rendering output
char *input_file;
char *output_file;
char *depth_file;
char *normals_file;
int width;
int height;
int stats;
// rendering options
float depth_min;
float depth_max;
int bounces;
int shadows;
int depth_of_field;
// supersampling
int jitter;
int filter;
};
#endif // ARG_PARSER_H