-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
52 lines (42 loc) · 1.36 KB
/
main.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
/******************************************************************************
* @file main.cpp
* @author Andrés Gavín Murillo, 716358
* @author Abel Naya Forcano, 544125
* @date Enero 2020
* @coms Informática Gráfica - Trabajo 5: Photon mapping
******************************************************************************/
#include <iostream>
#include "Render.hpp"
using namespace std;
void printUsage(const string &name) {
cout << "Usage: " << name << " <ppp> <width> <height> <file name> <scene>" << endl
<< "* <file name> needs to be one of" << endl
<< " - .ppm" << endl
<< " - .bmp" << endl
<< "OPTIONAL* <scene> can be a triangular .ply file or a predefined scene." << endl;
printScenes();
}
int main(int argc, char *argv[]) {
#ifdef USING_DEBUG
// debug code
cout << "!!!!! USING SLOW DEBUG CODE !!!!!" << endl;
#endif
// check enough arguments
if (argc < 5 || argc > 6) {
printUsage(argv[0]);
return 0;
}
// rays
int ppp = stoi(argv[1]);
// Image
int width = stoi(argv[2]);
int height = stoi(argv[3]);
// Scene
string sceneName = "default";
if (argc == 6) {
sceneName = argv[5];
}
Scene scene = createScene(sceneName, (float) width / (float) height);
render(width, height, ppp, scene, argv[4]);
return 0;
}