-
Notifications
You must be signed in to change notification settings - Fork 0
/
IntersectionGPU.h
46 lines (42 loc) · 987 Bytes
/
IntersectionGPU.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
#pragma once
#include "SimpleShape.h"
#include "macros.h"
#include "KDTree.h"
#include "Shader.h"
#include <GL/freeglut.h>
#include <GL/freeglut_ext.h>
#include <GL/glew.h>
#include <sstream>
class IntersectionGPU
{
public:
struct Ray
{
vec3f origin;
vec3f direction;
int last_tid;
Ray(){}
Ray(const vec3f& origin, const vec3f& direction)
{
this->origin = origin;
this->direction = direction;
}
};
protected:
static int maxTexSize;
static bool renderToFBO;
static int width, height;
static GLuint fboID, color_rboID, depth_rboID;
static Shader shader;
static void initFBO(int w = 0, int h = 0);
static void cleanUpFBO();
static void render();
static vector<vec4f> queryOneBatch(const vector<Ray>& rayList);
public:
static vector<SimpleShape*> shapes;
static vector<Ray> rayList;
static void loadShapesToShader();
static void loadKDTreeToShader(const KDTree& tree);
static void init();
static vector<vec4f> query(const vector<Ray>& rayList);
};