-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.cpp
45 lines (36 loc) · 1.23 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
#include <iostream>
#include <string>
#include <vector>
#include "Scene.h"
#include "Matrix4.h"
#include "Vector/Helpers.h"
using namespace std;
Scene *scene;
int main(int argc, char *argv[])
{
if (argc != 2)
{
cout << "Please run the rasterizer as:" << endl
<< "\t./rasterizer <input_file_name>" << endl;
return 1;
}
else
{
const char *xmlPath = argv[1];
scene = new Scene(xmlPath);
for (int i = 0; i < scene->cameras.size(); i++)
{
// initialize image with basic values
scene->initializeImage(scene->cameras[i]);
// do forward rendering pipeline operations
scene->forwardRenderingPipeline(scene->cameras[i]);
// generate PPM file
scene->writeImageToPPMFile(scene->cameras[i]);
// Converts PPM image in given path to PNG file, by calling ImageMagick's 'convert' command.
// Notice that os_type is not given as 1 (Ubuntu) or 2 (Windows), below call doesn't do conversion.
// Change os_type to 1 or 2, after being sure that you have ImageMagick installed.
scene->convertPPMToPNG(scene->cameras[i]->outputFileName, 99);
}
return 0;
}
}