imgui stuff
[carveJwlIkooP6JGAAIwe30JlM.git] / world_volumes.h
index 450c8c2cc2a7f147bc251d1bee65a64894b2a676..da39d265644848fd93989ae3ecbac8f9b78cfec5 100644 (file)
 VG_STATIC void volume_vg_expand_bound( void *user, boxf bound, u32 item_index )
 {
    world_instance *world = user;
-   struct world_volume *volume = &world->volumes[ item_index ];
 
-   m4x3_expand_aabb_point( volume->transform, bound, (v3f){ 1.0f, 1.0f, 1.0f} );
-   m4x3_expand_aabb_point( volume->transform, bound, (v3f){ 1.0f, 1.0f,-1.0f} );
-   m4x3_expand_aabb_point( volume->transform, bound, (v3f){ 1.0f,-1.0f, 1.0f} );
-   m4x3_expand_aabb_point( volume->transform, bound, (v3f){ 1.0f,-1.0f,-1.0f} );
-   m4x3_expand_aabb_point( volume->transform, bound, (v3f){-1.0f, 1.0f, 1.0f} );
-   m4x3_expand_aabb_point( volume->transform, bound, (v3f){-1.0f, 1.0f,-1.0f} );
-   m4x3_expand_aabb_point( volume->transform, bound, (v3f){-1.0f,-1.0f, 1.0f} );
-   m4x3_expand_aabb_point( volume->transform, bound, (v3f){-1.0f,-1.0f,-1.0f} );
+   ent_volume *volume = mdl_arritm( &world->ent_volume, item_index );
+
+   m4x3_expand_aabb_point( volume->to_world, bound, (v3f){ 1.0f, 1.0f, 1.0f} );
+   m4x3_expand_aabb_point( volume->to_world, bound, (v3f){ 1.0f, 1.0f,-1.0f} );
+   m4x3_expand_aabb_point( volume->to_world, bound, (v3f){ 1.0f,-1.0f, 1.0f} );
+   m4x3_expand_aabb_point( volume->to_world, bound, (v3f){ 1.0f,-1.0f,-1.0f} );
+   m4x3_expand_aabb_point( volume->to_world, bound, (v3f){-1.0f, 1.0f, 1.0f} );
+   m4x3_expand_aabb_point( volume->to_world, bound, (v3f){-1.0f, 1.0f,-1.0f} );
+   m4x3_expand_aabb_point( volume->to_world, bound, (v3f){-1.0f,-1.0f, 1.0f} );
+   m4x3_expand_aabb_point( volume->to_world, bound, (v3f){-1.0f,-1.0f,-1.0f} );
 }
 
 VG_STATIC float volume_vg_centroid( void *user, u32 item_index, int axis )
 {
    world_instance *world = user;
-   struct world_volume *volume = &world->volumes[ item_index ];
-
-   return volume->transform[3][axis];
+   ent_volume *volume = mdl_arritm( &world->ent_volume, item_index );
+   return volume->to_world[3][axis];
 }
 
 VG_STATIC void volume_vg_swap( void *user, u32 ia, u32 ib )
 {
    world_instance *world = user;
-   struct world_volume *a = &world->volumes[ ia ],
-                       *b = &world->volumes[ ib ],
-                       temp;
+   ent_volume *a = mdl_arritm( &world->ent_volume, ia ),
+              *b = mdl_arritm( &world->ent_volume, ib ),
+              temp;
 
    temp = *a;
    *a = *b;
@@ -46,11 +46,10 @@ VG_STATIC void volume_vg_swap( void *user, u32 ia, u32 ib )
 VG_STATIC void volume_vg_debug( void *user, u32 item_index )
 {
    world_instance *world = user;
-   struct world_volume *zone = &world->volumes[ item_index ];
-
-   vg_line_boxf_transformed( zone->transform, (boxf){{-1.0f,-1.0f,-1.0f},
-                                                     { 1.0f, 1.0f, 1.0f}}, 
-                                                     0xff00ff00 );
+   ent_volume *volume = mdl_arritm( &world->ent_volume, item_index );
+   vg_line_boxf_transformed( volume->to_world, (boxf){{-1.0f,-1.0f,-1.0f},
+                                                      { 1.0f, 1.0f, 1.0f}}, 
+                                                      0xff00ff00 );
 }
 
 VG_STATIC bh_system bh_system_volumes =