i hope your hapy
[carveJwlIkooP6JGAAIwe30JlM.git] / world_volumes.h
index 450c8c2cc2a7f147bc251d1bee65a64894b2a676..f333626087586a752d4aeeeb10e3aa9f3c2ce64e 100644 (file)
@@ -3,6 +3,7 @@
 
 #include "world.h"
 
+#if 0
 /*
  * BVH implementation
  * ----------------------------------------------------------------------------
@@ -11,7 +12,9 @@
 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 ];
+
+   ent_volume *volume_array = world_ent_array( world, k_ent_volume ),
+              *volume       = volume_array + 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} );
@@ -26,7 +29,9 @@ VG_STATIC void volume_vg_expand_bound( void *user, boxf bound, u32 item_index )
 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 ];
+
+   ent_volume *volume_array = world_ent_array( world, k_ent_volume ),
+              *volume       = volume_array + item_index;
 
    return volume->transform[3][axis];
 }
@@ -34,9 +39,10 @@ VG_STATIC float volume_vg_centroid( void *user, u32 item_index, int 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 *volume_array = world_ent_array( world, k_ent_volume ),
+              *a            = volume_array + ia,
+              *b            = volume_array + ib,
+              temp;
 
    temp = *a;
    *a = *b;
@@ -46,11 +52,12 @@ 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 ];
+   ent_volume *volume_array = world_ent_array( world, k_ent_volume ),
+              *volume       = volume_array + item_index;
 
-   vg_line_boxf_transformed( zone->transform, (boxf){{-1.0f,-1.0f,-1.0f},
-                                                     { 1.0f, 1.0f, 1.0f}}, 
-                                                     0xff00ff00 );
+   vg_line_boxf_transformed( volume->transform, (boxf){{-1.0f,-1.0f,-1.0f},
+                                                       { 1.0f, 1.0f, 1.0f}}, 
+                                                       0xff00ff00 );
 }
 
 VG_STATIC bh_system bh_system_volumes = 
@@ -62,5 +69,6 @@ VG_STATIC bh_system bh_system_volumes =
    .item_debug = volume_vg_debug,
    .cast_ray = NULL
 };
+#endif
 
 #endif /* WORLD_VOLUMES_H */