42static_assert(
sizeof(
BVHNode) == 48,
"BVHNode must match the std430 layout in globals.glsl");
43static_assert(offsetof(
BVHNode, aabb_max) == 16,
"BVHNode.aabb_max offset must match globals.glsl");
44static_assert(offsetof(
BVHNode, left_child) == 32,
"BVHNode.left_child offset must match globals.glsl");
56bool buildBVH(vector<GPUTriangle>& triangles, vector<BVHNode>& bvh_nodes);
const float AABB_EPS
Smap epsilon used to pad AABBs and avoid near-zero thickness.
Definition bvh.hpp:20
bool uploadBVH(const vector< BVHNode > &bvh_nodes, GLuint &ssbo)
Uploads the BVH node array to GPU SSBO. Creates the buffer on first use and fills it with bvh_nodes....
Definition bvh.cpp:120
bool buildBVH(vector< GPUTriangle > &triangles, vector< BVHNode > &bvh_nodes)
Builds the BVH using a triangle list. Recursively splits each triangle node at median along the longe...
Definition bvh.cpp:97
unsigned int GLuint
Definition imgui_impl_opengl3_loader.h:147
Loads 3D models through ASSIMP into CPU-side geometry and material data, defines the GPUVertex/GPUTri...
A single node of the BVH, structured following the std430.
Definition globals.glsl:323
float _pad0
Definition globals.glsl:325
int right_child
Definition globals.glsl:329
vec3 aabb_max
Definition globals.glsl:326
int first_tri
Definition globals.glsl:330
vec3 aabb_min
Definition globals.glsl:324
int tri_count
Definition globals.glsl:331
float _pad1
Definition globals.glsl:327
int left_child
Definition globals.glsl:328