stuff
[carveJwlIkooP6JGAAIwe30JlM.git] / world.h
diff --git a/world.h b/world.h
index f015a63e0ae43c93a9b4cd15b762bc133d3a7b18..73a33c0275208cc9e4312c4c5b6abee059a2319d 100644 (file)
--- a/world.h
+++ b/world.h
@@ -17,6 +17,7 @@ static int ray_world( v3f pos, v3f dir, ray_hit *hit );
 
 #include "traffic.h" /*TODO: -> world_traffic.h */
 #include "world_routes.h"
+#include "world_sfd.h"
 
 #include "shaders/terrain.h"
 #include "shaders/sky.h"
@@ -40,6 +41,7 @@ static struct gworld
    u32 spawn_count;
 
    struct subworld_routes routes;
+   struct subworld_sfd sfd;
 
    /* ...
    struct subworld_spawns system_spawns;
@@ -85,6 +87,7 @@ static struct gworld
 world;
 
 static struct subworld_routes *subworld_routes(void) { return &world.routes; }
+static struct subworld_sfd *subworld_sfd(void) { return &world.sfd; }
 
 
 vg_tex2d tex_terrain_colours = { .path = "textures/gradients.qoi",
@@ -122,11 +125,14 @@ static void world_register(void)
    shader_alphatest_register();
 
    world_routes_register();
+   world_sfd_register();
 }
 
 static void world_free(void)
 {
    /* TODO.. */
+
+   world_sfd_free();
 }
 
 static void render_world_depth( m4x4f projection, m4x3f camera );
@@ -497,11 +503,16 @@ static void world_init(void)
    world.dome_lower = *mdl_node_submesh( msky, nlower, 0 );
    world.dome_upper = *mdl_node_submesh( msky, nupper, 0 );
    free(msky);
+
+
+   /* Other systems */
+   world_sfd_init();
 }
 
 static void world_update(void)
 {
    world_routes_debug();
+   sfd_update( &world.sfd.tester );
 
 #if 0
    rb_solver_reset();
@@ -685,6 +696,16 @@ static void render_world( m4x4f projection, m4x3f camera )
    render_world_vb( projection, camera[3] );
    render_world_alphatest( projection, camera[3] );
    render_terrain( projection, camera[3] );
+
+   m4x3f identity_matrix;
+   m4x3_identity( identity_matrix );
+   identity_matrix[3][1] = 125.0f;
+
+   v4f t;
+   q_axis_angle( t, (v3f){0.0f,1.0f,0.0f}, 2.3f );
+   q_m3x3( t, identity_matrix );
+
+   sfd_render( &world.sfd.tester, projection, camera[3], identity_matrix );
 }
 
 static void render_world_depth( m4x4f projection, m4x3f camera )