-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathScene.h
52 lines (43 loc) · 1.15 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
#pragma once
namespace Tmpl8 {
class Scene
{
public:
Scene(Surface* screen);
Camera* camera;
void render(int row);
int addPrimitive(Primitive* primitive);
void addLightSource(LightSource* lightSource);
int loadModel(const char *filename, Material* material, vec3 translationVector = vec3(0));
void translateModel(int id, vec3 vector);
int getPrimitivesCount();
void clear();
private:
Surface* screen;
TopBVH* topBHV;
std::vector<BVH*> BVHs;
bool topBVHExists;
std::vector<Primitive*> primitives;
std::vector<LightSource*> lightSources;
struct Model
{
Model::Model(int id, int startIndex, int endIndex)
{
this->id = id;
this->startIndex = startIndex;
this->endIndex = endIndex;
}
int id, startIndex, endIndex;
};
std::vector<Model*> models;
vec4 trace(Ray* ray, int depth);
vec4 illuminate(Ray* ray);
Ray* computeReflectionRay(Ray* ray);
Ray* computeRefractionRay(Ray* ray);
void intersectPrimitives(Ray* ray, bool isShadowRay = false);
void intersectLightSources(Ray* ray);
Pixel convertColorToPixel(vec4 color);
void buildTopBVH();
int buildBVH(int startIndex, int endIndex);
};
}