-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
62 lines (42 loc) · 1.64 KB
/
main.cpp
File metadata and controls
62 lines (42 loc) · 1.64 KB
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
#include <iostream>
#include <chrono>
#include "Engine/renderengine.h"
using namespace std::chrono;
int main(int argc, char const *argv[])
{
/* code */
// Eclectus Testing 1.0
auto start = high_resolution_clock::now();
short int WIDTH = 320;
short int HEIGHT = 200;
Vector Camera(0, 0, -1);
Color col = Color::from_hex("#0000ff");
Material* material1 = new Material(col);
Sphere obj1(Vector(-0.75, -0.1, 2.25),0.6,material1);
Color col3 = Color::from_hex("#803880");
Material* material3 = new Material(col3);
Sphere obj3(Vector(0.75, -0.1, 1) ,0.6,material3);
// Ground
Color wh = Color::from_hex("#ffffff");
Color bk = Color::from_hex("#000000");
Material* mat = new CheckerMaterial(wh,bk);
Color Gcol = Color::from_hex("#00ff00");
Material material2(Gcol);
Sphere obj2(Vector(0,10000,100),10000,mat);
Sphere Objects[] = {obj1,obj2,obj3};
Color light_col(255,255,255);
Light point_light(Vector(1.5, -0.5, -10),light_col);
Color light_col2 = Color::from_hex("#E6E6E6");
Light point_light2(Vector(-0.5, -10.5, 0),light_col2);
Light Lights[] = {point_light,point_light2};
Scene scene(Camera,Objects,3,Lights,2,WIDTH,HEIGHT);
RenderEngine engine;
Image img = engine.render(scene);
img.write_ppm("Eclectus_test.ppm");
auto stop = high_resolution_clock::now();
auto duration = duration_cast<microseconds>(stop - start);
float d = float(duration.count())/1000000.0;
std::cout<<"\n#Time takes in microseconds: "<< duration.count();
std::cout<<"\n#Time takes in seconds: "<< d<<std::endl;
return 0;
}