-
Notifications
You must be signed in to change notification settings - Fork 0
/
scene.hpp
40 lines (32 loc) · 909 Bytes
/
scene.hpp
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
#pragma once
#include <iostream>
#include "dataTypes.hpp"
#include "intersection.hpp"
#include "mesh.hpp"
class Scene {
public:
std::vector<Mesh> meshes;
std::vector<uint> indices;
std::vector<BVHNode> tlas;
Scene() = default;
Scene(const std::vector<Mesh>& meshes);
Scene(const Scene& scene) = delete;
~Scene() = default;
void completeScene();
void generateIndices();
void generateTLAS();
uint intersect(Ray& ray, HitRecord& hitRecord, uint& count) const;
};
class GPUScene {
public:
GPUMesh* meshes;
BVHNode* tlas;
GPUScene() = delete;
GPUScene(const Scene& scene, const std::vector<GPUMesh>& gpuMeshes);
// Disallow copies for objects managing GPU memory
GPUScene(const GPUScene& scene) = delete;
~GPUScene();
__device__ uint intersect(Ray& ray, HitRecord& hitRecord, uint& count) const {
return intersectTLAS(ray, tlas, meshes, hitRecord, count);
}
};