Kohi Game Engine
bvh.h File Reference
#include "defines.h"
#include "math/math_types.h"

Go to the source code of this file.

Data Structures

struct  bvh_node
 
struct  bvh
 

Macros

#define BVH_INVALID_NODE   INVALID_ID_U32
 

Typedefs

typedef u32 bvh_id
 
typedef u64 bvh_userdata
 
typedef struct bvh_node bvh_node
 
typedef struct bvh bvh
 
typedef u32(* bvh_query_callback) (bvh_userdata user, bvh_id id, void *usr)
 
typedef b8(* bvh_raycast_callback) (bvh_userdata user, bvh_id id, const ray *r, f32 min, f32 max, f32 dist, vec3 pos, void *usr, raycast_hit *out_result)
 

Functions

KAPI b8 bvh_create (u32 inital_capacity, void *owner_context, bvh *out_bvh)
 
KAPI void bvh_destroy (bvh *t)
 
KAPI b8 bvh_reserve (bvh *t, u32 leaf_capacity)
 
KAPI bvh_id bvh_insert (bvh *t, aabb tight_aabb, bvh_userdata user)
 
KAPI void bvh_remove (bvh *t, bvh_id id)
 
KAPI void bvh_update (bvh *t, bvh_id id, aabb new_tight_aabb)
 
KAPI u32 bvh_query_overlaps (const bvh *t, aabb query, bvh_query_callback callback, void *context)
 
KAPI raycast_result bvh_raycast (const bvh *t, const ray *r, bvh_raycast_callback callback, void *usr)
 
KAPI void bvh_rebalance (bvh *t, u32 iterations)
 
KAPI void bvh_debug_trace_to_leaf (const bvh *t, bvh_userdata target_user, const ray *r)
 
KAPI void bvh_debug_print (const bvh *t)
 

Macro Definition Documentation

◆ BVH_INVALID_NODE

#define BVH_INVALID_NODE   INVALID_ID_U32

Typedef Documentation

◆ bvh

typedef struct bvh bvh

◆ bvh_id

typedef u32 bvh_id

◆ bvh_node

typedef struct bvh_node bvh_node

◆ bvh_query_callback

typedef u32(* bvh_query_callback) (bvh_userdata user, bvh_id id, void *usr)

◆ bvh_raycast_callback

typedef b8(* bvh_raycast_callback) (bvh_userdata user, bvh_id id, const ray *r, f32 min, f32 max, f32 dist, vec3 pos, void *usr, raycast_hit *out_result)

◆ bvh_userdata

typedef u64 bvh_userdata

Function Documentation

◆ bvh_create()

KAPI b8 bvh_create ( u32  inital_capacity,
void *  owner_context,
bvh out_bvh 
)

◆ bvh_debug_print()

KAPI void bvh_debug_print ( const bvh t)

◆ bvh_debug_trace_to_leaf()

KAPI void bvh_debug_trace_to_leaf ( const bvh t,
bvh_userdata  target_user,
const ray r 
)

◆ bvh_destroy()

KAPI void bvh_destroy ( bvh t)

◆ bvh_insert()

KAPI bvh_id bvh_insert ( bvh t,
aabb  tight_aabb,
bvh_userdata  user 
)

◆ bvh_query_overlaps()

KAPI u32 bvh_query_overlaps ( const bvh t,
aabb  query,
bvh_query_callback  callback,
void *  context 
)

◆ bvh_raycast()

KAPI raycast_result bvh_raycast ( const bvh t,
const ray r,
bvh_raycast_callback  callback,
void *  usr 
)

◆ bvh_rebalance()

KAPI void bvh_rebalance ( bvh t,
u32  iterations 
)

◆ bvh_remove()

KAPI void bvh_remove ( bvh t,
bvh_id  id 
)

◆ bvh_reserve()

KAPI b8 bvh_reserve ( bvh t,
u32  leaf_capacity 
)

◆ bvh_update()

KAPI void bvh_update ( bvh t,
bvh_id  id,
aabb  new_tight_aabb 
)