stuff
[carveJwlIkooP6JGAAIwe30JlM.git] / world.h
diff --git a/world.h b/world.h
index b76086f8c152a798bbcd65022028ba43ae918747..9d35d304be7e8c6682f73e5cdae665857cd43749 100644 (file)
--- a/world.h
+++ b/world.h
@@ -86,6 +86,9 @@ static struct gworld
    * instance_cache;
    u32 instance_cache_count,
        instance_cache_cap;
+
+   v3f render_gate_pos;
+   int active_route_board;
 }
 world;
 
@@ -548,6 +551,8 @@ static void world_update(void)
 {
    world_routes_update();
    world_routes_debug();
+   
+   
    sfd_update( &world.sfd.tester );
 
 #if 0
@@ -736,6 +741,10 @@ static void render_world_gates( m4x4f projection, m4x3f camera )
    }
 
    render_gate( &world.routes.gates[id].gate, camera );
+   v3_lerp( world.render_gate_pos, 
+            world.routes.gates[id].gate.co[0],
+            1.0f,
+            world.render_gate_pos );
 }
 
 static void render_world( m4x4f projection, m4x3f camera )
@@ -746,15 +755,23 @@ static void render_world( m4x4f projection, m4x3f camera )
    render_world_alphatest( projection, camera[3] );
    render_terrain( projection, camera[3] );
 
-   m4x3f identity_matrix;
-   m4x3_identity( identity_matrix );
-   identity_matrix[3][1] = 125.0f;
+   int closest = 0;
+   float min_dist = INFINITY;
 
-   v4f t;
-   q_axis_angle( t, (v3f){0.0f,1.0f,0.0f}, 2.3f );
-   q_m3x3( t, identity_matrix );
+   for( int i=0; i<world.routes.route_count; i++ )
+   {
+      float dist = v3_dist2( world.routes.routes[i].scoreboard_transform[3],
+                              camera[3] );
+
+      if( dist < min_dist )
+      {
+         min_dist = dist;
+         closest = i;
+      }
+   }
 
-   //sfd_render( &world.sfd.tester, projection, camera[3], identity_matrix );
+   sfd_render( &world.sfd.tester, projection, camera[3], 
+         world.routes.routes[closest].scoreboard_transform );
 }
 
 static void render_world_depth( m4x4f projection, m4x3f camera )