-
Notifications
You must be signed in to change notification settings - Fork 1
/
Scene.h
70 lines (54 loc) · 1.43 KB
/
Scene.h
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
//
// Created by debowin on 10/8/17.
//
#ifndef FRAYTRACER_SCENE_H
#define FRAYTRACER_SCENE_H
#include <string>
#include <vector>
#include "Camera.h"
#include "Sphere.h"
#include "Basics.h"
#include "Material.h"
#include "Pixel.h"
#include "HitInfo.h"
using namespace std;
class Scene {
union PixelData{
Pixel *pixels;
uint8_t *raw;
};
PixelData data;
Camera camera;
string output_image;
Colour background;
vector<Surface*> surfaces;
vector<Light> directionalLights;
vector<Light> pointLights;
vector<SpotLight> spotLights;
Light ambientLight;
int maxDepth;
int maxVertices;
int maxNormals;
vector<Vector3D> vertices;
vector<Vector3D> normals;
int samplingRate;
enum SamplingMethod{
BASIC=0,
UNIFORM=1,
RANDOM=2,
JITTERED=3
} samplingMethod;
public:
int readSceneFile(string fileName);
void initializeFilm(Component r, Component g, Component b, Component a);
void writeImageResult();
void rayTrace();
HitInfo* hit(Ray viewingRay, float tMin, float fMax, bool isShadowRay);
Colour getColour(Ray viewingRay, int depth);
Colour basicSampling(int i, int j);
Colour regularSampling(int i, int j);
Colour randomSampling(int i, int j);
Colour jitteredSampling(int i, int j);
bool getRefractedRay(Vector3D d, Vector3D n, float ior, Vector3D *refracted);
};
#endif //FRAYTRACER_SCENE_H