-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cc
31 lines (24 loc) · 847 Bytes
/
main.cc
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
#include <iostream>
#include "core/include/image.hh"
#include "core/include/scene.hh"
#include "core/include/turtle.hh"
using namespace std;
#define DEFAULT_WIDTH 512
#define DEFAULT_HEIGHT 512
#define DEFAULT_FOV 90
#define DEFAULT_OUTPUT_NAME "output"
int main(int argc, char const *argv[])
{
cout << "\n[----------------- Raytracer -----------------]\n";
cout << "./raytracer [width] [height] [fov] [outputName]\n\n";
// Parsing options
int width = argc >= 2 ? atoi(argv[1]) : DEFAULT_WIDTH;
int height = argc >= 3 ? atoi(argv[2]) : DEFAULT_HEIGHT;
int fov = argc >= 4 ? atoi(argv[3]) : DEFAULT_FOV;
string outputName = argc >= 5 ? argv[4] : DEFAULT_OUTPUT_NAME;
// Creating scene
Scene *scene = new Scene("config.json");
Image image = scene->render();
image.save(outputName);
return 0;
}