~ | BVH sent to gpu

This commit is contained in:
TheRedShip
2025-01-17 16:27:39 +01:00
parent 6f80a66550
commit 6fdea11adb
14 changed files with 359 additions and 46 deletions

View File

@ -54,6 +54,20 @@ struct GPUVolume
int enabled;
};
struct GPUBvh
{
alignas(16) glm::vec3 min;
alignas(16) glm::vec3 max;
int left_index;
int right_index;
int is_leaf;
int first_primitive;
int primitive_count;
};
class Sphere;
class Camera;
@ -74,11 +88,14 @@ class Scene
const std::vector<GPUObject> &getObjectData() const;
std::vector<GPUMaterial> &getMaterialData();
GPUVolume &getVolume();
std::vector<GPUBvh> &getBVH();
Camera *getCamera(void) const;
GPUMaterial getMaterial(int material_index);
private:
std::vector<GPUBvh> _gpu_bvh;
std::vector<GPUObject> _gpu_objects;
std::vector<GPUMaterial> _gpu_materials;