fixe
[carveJwlIkooP6JGAAIwe30JlM.git] / world.h
diff --git a/world.h b/world.h
index f00e146b0f53fe0f0c7a199f5aeb93f45335d268..80bf3b6bafad33620b4738fb314440cfd581a6d3 100644 (file)
--- a/world.h
+++ b/world.h
@@ -18,6 +18,7 @@ typedef struct world_instance world_instance;
 #include "rigidbody.h"
 #include "bvh.h"
 #include "model.h"
+#include "entity.h"
 
 #include "shaders/scene_standard.h"
 #include "shaders/scene_standard_alphatest.h"
@@ -153,7 +154,10 @@ struct world_instance
                  ent_route_node,
                  ent_path_index,
                  ent_checkpoint,
-                 ent_route;
+                 ent_route,
+                 ent_water;
+
+   ent_gate *rendering_gate;
 
 #if 0
    /*
@@ -728,16 +732,14 @@ VG_STATIC int spherecast_world( world_instance *world,
    float min_t = 1.0f;
 
    int idx;
-   while( bh_next( world->geo_bh, &it, region, &idx ) )
-   {
+   while( bh_next( world->geo_bh, &it, region, &idx ) ){
       u32 *ptri = &world->scene_geo->arrindices[ idx*3 ];
       v3f tri[3];
 
       boxf box;
       box_init_inf( box );
 
-      for( int j=0; j<3; j++ )
-      {
+      for( int j=0; j<3; j++ ){
          v3_copy( world->scene_geo->arrvertices[ptri[j]].co, tri[j] );
          box_addpt( box, tri[j] );
       }
@@ -750,10 +752,8 @@ VG_STATIC int spherecast_world( world_instance *world,
       
       float t;
       v3f n1;
-      if( spherecast_triangle( tri, pa, dir, r, &t, n1 ) )
-      {
-         if( t < min_t )
-         {
+      if( spherecast_triangle( tri, pa, dir, r, &t, n1 ) ){
+         if( t < min_t ){
             min_t = t;
             hit = idx;
             v3_copy( n1, n );
@@ -769,18 +769,16 @@ VG_STATIC
 struct world_surface *world_tri_index_surface( world_instance *world, 
                                                  u32 index )
 {
-   for( int i=1; i<world->surface_count; i++ )
-   {
-      struct world_surface *mat = &world->surfaces[i];
+   for( int i=1; i<world->surface_count; i++ ){
+      struct world_surface *surf = &world->surfaces[i];
 
-      if( (index >= mat->sm_geo.vertex_start) &&
-          (index  < mat->sm_geo.vertex_start+mat->sm_geo.vertex_count ) )
+      if( (index >= surf->sm_geo.vertex_start) &&
+          (index  < surf->sm_geo.vertex_start+surf->sm_geo.vertex_count ) )
       {
-         return mat;
+         return surf;
       }
    }
 
-   /* error surface */
    return &world->surfaces[0];
 }