-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.cpp
105 lines (99 loc) · 2.61 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/*
* Main.cpp
*
* Created on: 31 déc. 2017
* Author: Ghassen_jlassi&Khalil_abid
*/
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
#include <cmath>
#include <limits>
#include "Ray3f.h"
#include "Camera.h"
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
using namespace std ;
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
#include <cmath>
#include <limits>
#include <cstdlib>
#include <cstdio>
#include <ctime>
#include "Cubequad.h"
#include "sphere.h"
#include "scene.h"
/*
@brief This file contains the main functions of our project
*/
int main (int argc, char *argv[]) {
cout << "Loading ...." << endl;
/*
@brief define Camera position
*/
Vector3f campos(0,0,0);
/*
@brief define Camera direction
*/
Vector3f camdir(1,0,0);
/*
@brief define the scene
*/
Camera scene_cam(campos, camdir);
/*
@brief initialize the source
*/
Ray3f source(Vector3f(0,8,0),Vector3f(0,0,0));
/*
@brief Colors
*/
Material yellow(1.28,0.6,0, 0.3);
Material gray(0.5, 0.5, 0.5, 0.0);
Material pink(1.99, 0.21, 1.33, 0.2);
Material white(1, 1, 1, 1);
/*
@brief initialize the "sphere"
*/
Sphere scene_sphere1(yellow,Vector3f(20,1,0),2);
Sphere scene_sphere2(pink, Vector3f(5,-1,1),1);
/*
@brief initialize our 5 planes
*/
CubeQuad plane(gray, Vector3f(200,0,3000), Vector3f(0,0,500), Vector3f(0,500,0));
CubeQuad plane1(white, Vector3f(0,20,0), Vector3f(500,0,0), Vector3f(0,0,500));
CubeQuad plane2(white, Vector3f(0,-20,0), Vector3f(500,0,0), Vector3f(0,0,500));
CubeQuad plane3(white, Vector3f(0,0,20), Vector3f(500,0,0), Vector3f(0,500,0));
CubeQuad plane4(white, Vector3f(0,0,-20), Vector3f(500,0,0), Vector3f(0,500,0));
/*
@brief initialize our container of shapes
*/
vector<Shape*> scene_objects;
/*
@brief add our shapes
*/
scene_objects.push_back(dynamic_cast<Shape*>(&scene_sphere1));
scene_objects.push_back(dynamic_cast<Shape*>(&scene_sphere2));
scene_objects.push_back(dynamic_cast<Shape*>(&plane));
scene_objects.push_back(dynamic_cast<Shape*>(&plane1));
scene_objects.push_back(dynamic_cast<Shape*>(&plane2));
scene_objects.push_back(dynamic_cast<Shape*>(&plane3));
scene_objects.push_back(dynamic_cast<Shape*>(&plane4));
/*
@brief initialize the size of the image
*/
int width = 640;
int height = 480;
/*
@brief image construction
*/
Scene scene(scene_cam, scene_objects, source);
scene.render(width, height, "scene_result.png");
cout<<"Image prête"<<endl;
}