1 #ifndef WORLD_VOLUMES_H
2 #define WORLD_VOLUMES_H
9 * ----------------------------------------------------------------------------
12 VG_STATIC
void volume_vg_expand_bound( void *user
, boxf bound
, u32 item_index
)
14 world_instance
*world
= user
;
16 ent_volume
*volume_array
= world_ent_array( world
, k_ent_volume
),
17 *volume
= volume_array
+ item_index
;
19 m4x3_expand_aabb_point( volume
->transform
, bound
, (v3f
){ 1.0f
, 1.0f
, 1.0f
} );
20 m4x3_expand_aabb_point( volume
->transform
, bound
, (v3f
){ 1.0f
, 1.0f
,-1.0f
} );
21 m4x3_expand_aabb_point( volume
->transform
, bound
, (v3f
){ 1.0f
,-1.0f
, 1.0f
} );
22 m4x3_expand_aabb_point( volume
->transform
, bound
, (v3f
){ 1.0f
,-1.0f
,-1.0f
} );
23 m4x3_expand_aabb_point( volume
->transform
, bound
, (v3f
){-1.0f
, 1.0f
, 1.0f
} );
24 m4x3_expand_aabb_point( volume
->transform
, bound
, (v3f
){-1.0f
, 1.0f
,-1.0f
} );
25 m4x3_expand_aabb_point( volume
->transform
, bound
, (v3f
){-1.0f
,-1.0f
, 1.0f
} );
26 m4x3_expand_aabb_point( volume
->transform
, bound
, (v3f
){-1.0f
,-1.0f
,-1.0f
} );
29 VG_STATIC
float volume_vg_centroid( void *user
, u32 item_index
, int axis
)
31 world_instance
*world
= user
;
33 ent_volume
*volume_array
= world_ent_array( world
, k_ent_volume
),
34 *volume
= volume_array
+ item_index
;
36 return volume
->transform
[3][axis
];
39 VG_STATIC
void volume_vg_swap( void *user
, u32 ia
, u32 ib
)
41 world_instance
*world
= user
;
42 ent_volume
*volume_array
= world_ent_array( world
, k_ent_volume
),
43 *a
= volume_array
+ ia
,
44 *b
= volume_array
+ ib
,
52 VG_STATIC
void volume_vg_debug( void *user
, u32 item_index
)
54 world_instance
*world
= user
;
55 ent_volume
*volume_array
= world_ent_array( world
, k_ent_volume
),
56 *volume
= volume_array
+ item_index
;
58 vg_line_boxf_transformed( volume
->transform
, (boxf
){{-1.0f
,-1.0f
,-1.0f
},
63 VG_STATIC bh_system bh_system_volumes
=
65 .expand_bound
= volume_vg_expand_bound
,
66 .item_centroid
= volume_vg_centroid
,
68 .item_swap
= volume_vg_swap
,
69 .item_debug
= volume_vg_debug
,
74 #endif /* WORLD_VOLUMES_H */