-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.cpp
59 lines (48 loc) · 1.48 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
53
54
55
56
57
58
59
#include <cstdio>
#include <cstdlib>
// Included files for OpenGL Rendering
#ifdef __APPLE__
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#include <GLUT/glut.h>
#else
#include <GL/glut.h>
#include <GL/gl.h>
#include <GL/glu.h>
#endif
#include "MersenneTwister.h"
#include "argparser.h"
#include "glCanvas.h"
#include "mesh.h"
#include "radiosity.h"
#include "photon_mapping.h"
#include "raytracer.h"
#include "utils.h"
// =========================================
// =========================================
MTRand GLOBAL_mtrand;
int main(int argc, char *argv[]) {
// deterministic (repeatable) randomness
// (comment out for "real" randomness)
GLOBAL_mtrand = MTRand(37);
ArgParser *args = new ArgParser(argc, argv);
glutInit(&argc, argv);
Mesh *mesh = new Mesh();
mesh->Load(args->input_file,args);
RayTracer *raytracer = new RayTracer(mesh,args);
Radiosity *radiosity = new Radiosity(mesh,args);
PhotonMapping *photon_mapping = new PhotonMapping(mesh,args);
raytracer->setRadiosity(radiosity);
raytracer->setPhotonMapping(photon_mapping);
radiosity->setRayTracer(raytracer);
radiosity->setPhotonMapping(photon_mapping);
photon_mapping->setRayTracer(raytracer);
photon_mapping->setRadiosity(radiosity);
GLCanvas glcanvas;
glcanvas.initialize(args,mesh,raytracer,radiosity,photon_mapping);
// well it never returns from the GLCanvas loop...
delete args;
return 0;
}
// =========================================
// =========================================