28 lines
685 B
C
28 lines
685 B
C
#ifndef TLAS_H
|
|
#define TLAS_H
|
|
|
|
#include "Geometry/AABB.h"
|
|
#include "Algorithm/BVH.h"
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
|
|
// A simple BVH over instance AABBs.
|
|
// Node layout is identical to bvh_node_t, but primitive indices map to instances.
|
|
|
|
typedef struct
|
|
{
|
|
uint32_t node_count;
|
|
uint32_t node_capacity;
|
|
uint32_t primitive_count;
|
|
|
|
bvh_node_t* nodes;
|
|
uint32_t* primitive_indices;
|
|
|
|
const aabb_t* instance_bounds; // array of primitive_count bounds
|
|
} tlas_tree_t;
|
|
|
|
bool tlas_tree_build(tlas_tree_t* tlas, const uint32_t* instance_indices, uint32_t instance_count, const aabb_t* all_instance_bounds);
|
|
void tlas_tree_free(tlas_tree_t* tlas);
|
|
|
|
#endif // TLAS_H
|