more tweaks
[carveJwlIkooP6JGAAIwe30JlM.git] / world_render.h
index 31eba64401237a5cb48b9a7a79bb9fa4a3020afa..e04a6bb85455da4aaebecc7b71bc5cccf175705a 100644 (file)
@@ -48,9 +48,6 @@ VG_STATIC void world_render_init(void)
          fb->fixed_h = 1024;
          fb->resolution_div = 0;
 
-         /* TODO: We could get away with this being R16u, and just have it be 
-          *       a normed value between min and max of the bounding box Y */
-
          fb->attachments[0].display_name     = NULL;
          fb->attachments[0].purpose = k_framebuffer_attachment_type_colour;
          fb->attachments[0].internalformat   = GL_RG16F;
@@ -346,7 +343,8 @@ VG_STATIC void render_sky( world_instance *world, camera *cam )
    glDepthMask( GL_TRUE );
 }
 
-VG_STATIC void render_world_gates( world_instance *world, camera *cam )
+VG_STATIC void render_world_gates( world_instance *world, camera *cam,
+                                   int layer_depth )
 {
    float closest = INFINITY;
 
@@ -371,44 +369,47 @@ VG_STATIC void render_world_gates( world_instance *world, camera *cam )
    if( gate ){
 #if 0
       world_instance *dest_world = &world_global.worlds[ gate->world_index ];
-      render_gate( dest_world, gate, cam );
+      render_gate( dest_world, gate, cam, layer_depth );
 #else
-      render_gate( world, gate, cam );
+      render_gate( world, gate, cam, layer_depth );
 #endif
+
+      /* should really be set in fixed update since its used in the physics
+       * of most systems. too bad! */
+      world->rendering_gate = gate;
    }
 }
 
-VG_STATIC void render_world( world_instance *world, camera *cam )
+VG_STATIC void render_world( world_instance *world, camera *cam,
+                             int layer_depth )
 {
    render_sky( world, cam );
 
-   render_world_routes( world, cam );
+   render_world_routes( world, cam, layer_depth );
    render_world_standard( world, cam );
    render_world_vb( world, cam );
    render_world_alphatest( world, cam );
    render_terrain( world, cam );
 
    /* Render SFD's */
-#if 0
-   int closest = 0;
+   u32 closest = 0;
    float min_dist = INFINITY;
 
-   if( !world->route_count )
+   if( !mdl_arrcount( &world->ent_route ) )
       return;
 
-   for( int i=0; i<world->route_count; i++ )
-   {
-      float dist = v3_dist2(world->routes[i].scoreboard_transform[3], cam->pos);
+   for( u32 i=0; i<mdl_arrcount( &world->ent_route ); i++ ){
+      ent_route *route = mdl_arritm( &world->ent_route, i );
+      float dist = v3_dist2( route->board_transform[3], cam->pos );
 
-      if( dist < min_dist )
-      {
+      if( dist < min_dist ){
          min_dist = dist;
          closest = i;
       }
    }
 
-   sfd_render( cam, world->routes[closest].scoreboard_transform );
-#endif
+   ent_route *route = mdl_arritm( &world->ent_route, closest );
+   sfd_render( world, cam, route->board_transform );
 }
 
 VG_STATIC void render_world_depth( world_instance *world, camera *cam )