1 #ifndef WORLD_VOLUMES_H
2 #define WORLD_VOLUMES_H
8 * ----------------------------------------------------------------------------
11 VG_STATIC
void volume_vg_expand_bound( void *user
, boxf bound
, u32 item_index
)
13 world_instance
*world
= user
;
15 ent_volume
*volume
= mdl_arritm( &world
->ent_volume
, item_index
);
17 m4x3_expand_aabb_point( volume
->to_world
, bound
, (v3f
){ 1.0f
, 1.0f
, 1.0f
} );
18 m4x3_expand_aabb_point( volume
->to_world
, bound
, (v3f
){ 1.0f
, 1.0f
,-1.0f
} );
19 m4x3_expand_aabb_point( volume
->to_world
, bound
, (v3f
){ 1.0f
,-1.0f
, 1.0f
} );
20 m4x3_expand_aabb_point( volume
->to_world
, bound
, (v3f
){ 1.0f
,-1.0f
,-1.0f
} );
21 m4x3_expand_aabb_point( volume
->to_world
, bound
, (v3f
){-1.0f
, 1.0f
, 1.0f
} );
22 m4x3_expand_aabb_point( volume
->to_world
, bound
, (v3f
){-1.0f
, 1.0f
,-1.0f
} );
23 m4x3_expand_aabb_point( volume
->to_world
, bound
, (v3f
){-1.0f
,-1.0f
, 1.0f
} );
24 m4x3_expand_aabb_point( volume
->to_world
, bound
, (v3f
){-1.0f
,-1.0f
,-1.0f
} );
27 VG_STATIC
float volume_vg_centroid( void *user
, u32 item_index
, int axis
)
29 world_instance
*world
= user
;
30 ent_volume
*volume
= mdl_arritm( &world
->ent_volume
, item_index
);
31 return volume
->to_world
[3][axis
];
34 VG_STATIC
void volume_vg_swap( void *user
, u32 ia
, u32 ib
)
36 world_instance
*world
= user
;
37 ent_volume
*a
= mdl_arritm( &world
->ent_volume
, ia
),
38 *b
= mdl_arritm( &world
->ent_volume
, ib
),
46 VG_STATIC
void volume_vg_debug( void *user
, u32 item_index
)
48 world_instance
*world
= user
;
49 ent_volume
*volume
= mdl_arritm( &world
->ent_volume
, item_index
);
50 vg_line_boxf_transformed( volume
->to_world
, (boxf
){{-1.0f
,-1.0f
,-1.0f
},
55 VG_STATIC bh_system bh_system_volumes
=
57 .expand_bound
= volume_vg_expand_bound
,
58 .item_centroid
= volume_vg_centroid
,
60 .item_swap
= volume_vg_swap
,
61 .item_debug
= volume_vg_debug
,
65 #endif /* WORLD_VOLUMES_H */