-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
executable file
·87 lines (74 loc) · 1.77 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#include <math.h>
#include "Miro.h"
#include "Scene.h"
#include "Camera.h"
#include "Image.h"
#include "Console.h"
#include "PointLight.h"
#include "Sphere.h"
#include "TriangleMesh.h"
#include "Triangle.h"
#include "Lambert.h"
#include "Mirror.h"
#include "Glass.h"
#include "Glossy.h"
#include "MiroWindow.h"
#include "assignment1.h"
#include "assignment2.h"
#include "PFMLoader.h"
void
makeSpiralScene()
{
g_camera = new Camera;
g_scene = new Scene;
g_image = new Image;
g_image->resize(512, 512);
// set up the camera
g_camera->setBGColor(Vector3(1.0f, 1.0f, 1.0f));
g_camera->setEye(Vector3(-5, 2, 3));
g_camera->setLookAt(Vector3(0, 0, 0));
g_camera->setUp(Vector3(0, 1, 0));
g_camera->setFOV(35);
// create and place a point light source
PointLight * light = new PointLight;
light->setPosition(Vector3(-3, 3, 3));
light->setColor(Vector3(1, 1, 1));
light->setWattage(1000);
g_scene->addLight(light);
// create a spiral of spheres
Material* mat = new Lambert(Vector3(1.0f, 0.0f, 0.0f));
const int maxI = 200;
const float a = 0.15f;
for (int i = 1; i < maxI; ++i)
{
float t = i/float(maxI);
float theta = 4*PI*t;
float r = a*theta;
float x = r*cos(theta);
float y = r*sin(theta);
float z = 2*(2*PI*a - r);
Sphere * sphere = new Sphere;
sphere->setCenter(Vector3(x,y,z));
sphere->setRadius(r/10);
sphere->setMaterial(mat);
g_scene->addObject(sphere);
}
// let objects do pre-calculations if needed
g_scene->preCalc();
}
int
main(int argc, char*argv[])
{
// create a scene
//makeSpiralScene();
makeTeapotScene();
//makeBunny1Scene();
//makeBunny20Scene();
//makeSponzaScene();
//makeSpereScene();
//makeEmptyScene();
//makeSequenceSphere();
MiroWindow miro(&argc, argv);
miro.mainLoop();
return 0; // never executed
}