X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=world.h;h=73a33c0275208cc9e4312c4c5b6abee059a2319d;hb=fe76a19eea0fd2564ab931ec2f0c7cfba768d8b8;hp=45003cccbe9d87afa6b4fed9c0912bfec860d454;hpb=d57b7661518800479c00300ce57407378696eec9;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/world.h b/world.h index 45003cc..73a33c0 100644 --- 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,15 +41,13 @@ static struct gworld u32 spawn_count; struct subworld_routes routes; + struct subworld_sfd sfd; /* ... struct subworld_spawns system_spawns; struct subworld_physics system_physics; */ - teleport_gate gates[64]; - u32 gate_count; - /* Paths */ traffic_node traffic[128]; u32 traffic_count; @@ -88,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", @@ -123,11 +123,16 @@ static void world_register(void) shader_gpos_register(); shader_fscolour_register(); 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 ); @@ -222,7 +227,6 @@ static void world_load(void) mdl_header *mworld = mdl_load( "models/mp_dev.mdl" ); world.spawn_count = 0; - world.gate_count = 0; world.traffic_count = 0; world.instance_cache = NULL; @@ -235,27 +239,6 @@ static void world_load(void) if( pnode->classtype == k_classtype_none ) {} -#if 0 - else if( pnode->classtype == k_classtype_gate ) - { - struct classtype_gate *entgate = mdl_get_entdata( mworld, pnode ); - - if( entgate->target ) - { - mdl_node *pother = mdl_node_from_id( mworld, entgate->target ); - - teleport_gate *gate = &world.gates[ world.gate_count ++ ]; - - v3_copy( pnode->co, gate->co[0] ); - v3_copy( pother->co, gate->co[1] ); - v4_copy( pnode->q, gate->q[0] ); - v4_copy( pother->q, gate->q[1] ); - v2_copy( pnode->s, gate->dims ); - - gate_transform_update( gate ); - } - } -#endif else if( pnode->classtype == k_classtype_spawn ) { struct respawn_point *rp = &world.spawns[ world.spawn_count ++ ]; @@ -416,7 +399,7 @@ static void world_load(void) scene_copy_slice( &world.foliage, &world.sm_foliage_alphatest ); scene_upload( &world.foliage ); - world_routes_init( mworld ); + world_routes_loadfrom( mworld ); for( int i=0; igate, camera ); + + if( count == 2 ) + return; + } +} + static void render_world( m4x4f projection, m4x3f camera ) { render_sky( camera ); + render_world_routes( projection, camera[3] ); 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 )