forked from rlk/envtools
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathenvBackground.cpp
53 lines (41 loc) · 1.21 KB
/
envBackground.cpp
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
#include <iostream>
#include <getopt.h>
#include <cstdio>
#include <cstdlib>
#include "Cubemap"
static int usage(const std::string& name)
{
std::cerr << "Usage: " << name << " [-s size] [-n nbsamples] [-r numRotations] [-b blur angle ] [-f toggle fixup edge ] in.tif out.tif" << std::endl;
return 1;
}
int main(int argc, char *argv[])
{
int size = 0;
int c;
int samples = 128;
int fixup = 0;
int numRotations = 18;
float blur = 0.1;
while ((c = getopt(argc, argv, "s:n:r:b:f")) != -1)
switch (c)
{
case 's': size = atoi(optarg); break;
case 'n': samples = atoi(optarg); break;
case 'r': numRotations = atoi(optarg); break;
case 'b': blur = atof(optarg); break;
case 'f': fixup = 1; break;
default: return usage(argv[0]);
}
std::string input, output;
if ( optind < argc-1 ) {
// generate specular ibl
input = std::string( argv[optind] );
output = std::string( argv[optind+1] );
Cubemap image;
image.load(input);
image.computeBackground( output, size, samples, numRotations, blur, fixup );
} else {
return usage( argv[0] );
}
return 0;
}