forked from marczych/RayTracer
-
Notifications
You must be signed in to change notification settings - Fork 1
/
BSP.h
47 lines (37 loc) · 803 Bytes
/
BSP.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
#ifndef __BSP_H__
#define __BSP_H__
#include <math.h>
#include <limits>
#include "Vector.h"
#include <vector>
#include "Ray.h"
#include "Object.h"
#include "Intersection.h"
#include "Boundaries.h"
using namespace std;
class BSP {
public:
int depth;
char axis;
Boundaries bounds;
vector<Object*> objects;
BSP* Left;
BSP* Right;
BSP(vector<Object*> objects_) : objects(objects_) { }
BSP(int depth_, char axis_, vector<Object*> objects_) :
depth(depth_), axis(axis_), objects(objects_) {
build();
}
virtual ~BSP() {
if (Left) {
delete Left;
}
if (Right) {
delete Right;
}
}
void build();
bool intersectAABB(const Ray&, Boundaries, double*);
Intersection getClosestIntersection(const Ray&);
};
#endif