-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
42 lines (33 loc) · 1.36 KB
/
main.cpp
File metadata and controls
42 lines (33 loc) · 1.36 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
// Start with RayTracing in One Weekend.
#include "imageIO.h"
#include "Camera.h"
#include "Geometry.h"
#include "Transformation.h"
int main() {
clock_t globalTimeStart = clock();
Camera camera(1080, 1080);
camera.position = Vec3(0, 5, 25.);
camera.focal = 2.0;
camera.antialiasing = 3;
camera.maxDepth = 5;
//camera.aperture = 0.2;
camera.defocusScale = 0.9;
camera.faceAt = Vec3(0.0, 5, 0.0);
camera.NO_BG = true;
//camera.motionBlur = true;
camera.antialiasing = 20; camera.maxDepth = 20;
using TF = Transformation;
Geometry geos = Geometry() +
Square(Lambertian(WHITE), 10.1) +
Square(Lambertian(WHITE), 10.1) * (TF(TF::RX, 90) * TF(TF::T, 0, 5, -5)) +
Square(Lambertian(WHITE), 20) * TF(TF::RX, 180) * TF(TF::T, 0, 10, 0) +
Square(Lambertian(GREEN), 10.1) * TF(TF::RZ, -90) * TF(TF::T, -5, 5, 0) +
Square(Lambertian(RED), 10.1) * TF(TF::RZ, 90) * TF(TF::T, 5, 5, 0) +
Square(DiffuseLight(Color(9.0)), 3) * TF(TF::RX, 180) * TF(TF::T, 0, 9.999, 0) +
Cuboid(Lambertian(WHITE), 3.5) * TF(TF::RY, -15) * TF(TF::T, 2, 0, 1.5) +
Cuboid(Lambertian(WHITE), 3.2, 7) * TF(TF::RY, 15) * TF(TF::T, -2, 0, -1);
auto pixels = camera.randerLoop(geos.prims);
outputPic("image", PIC_FORMAT::QOI, pixels);
timeInfo(globalTimeStart);
return 0;
}