X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=world_routes.h;h=35f38f0f04a094394f80ab15a6d6f5563abafa42;hb=aa4c26eae2208872824e0eb5b71bc05c16d43242;hp=312429579a0fcd021d9b3cfe966d85424f9e4919;hpb=47941822dae18a018c985847b052e70214a3ccc6;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/world_routes.h b/world_routes.h index 3124295..35f38f0 100644 --- a/world_routes.h +++ b/world_routes.h @@ -5,11 +5,15 @@ #ifndef ROUTES_H #define ROUTES_H +#include #include "world.h" #include "world_gate.h" +#if 0 #include "shaders/vblend.h" -#include "shaders/route.h" +#endif + +#include "shaders/scene_route.h" #include "shaders/routeui.h" @@ -221,8 +225,6 @@ VG_STATIC struct route_ui_segment *world_routes_ui_curseg( VG_STATIC void world_routes_ui_newseg( u32 route ) { struct route_ui_bar *pui = &world.ui_bars[route]; - - pui->last_notch = 0.0; glBindVertexArray( pui->vao ); if( pui->segment_count ) @@ -532,6 +534,17 @@ VG_STATIC void world_routes_verify_run( u32 route ) world.routes[route].latest_pass = world.time; } +VG_STATIC void world_routes_clear(void) +{ + for( u32 i=0; iactive = 0; + } + world.current_run_version += 4; + world.last_use = 0.0; +} + /* * When going through a gate this is called for bookkeeping purposes */ @@ -736,12 +749,13 @@ VG_STATIC void world_routes_create_mesh( u32 route_id ) if( ray_world( sa, down, &ha ) && ray_world( sb, down, &hb )) { - mdl_vert va, vb; + scene_vert va, vb; v3_muladds( ha.pos, up, 0.06f, va.co ); v3_muladds( hb.pos, up, 0.06f, vb.co ); - v3_copy( up, va.norm ); - v3_copy( up, vb.norm ); + + scene_vert_pack_norm( &va, up ); + scene_vert_pack_norm( &vb, up ); v2_zero( va.uv ); v2_zero( vb.uv ); @@ -996,7 +1010,6 @@ VG_STATIC void world_routes_create_route( mdl_node *pnode ) pui->vertex_head = k_route_ui_max_verts - 200; pui->segment_start = 0; pui->segment_count = 0; - pui->last_notch = 0.0; pui->fade_start = 0; pui->fade_count = 0; pui->fade_timer_start = 0.0; @@ -1069,7 +1082,7 @@ VG_STATIC void world_routes_init(void) world.time = RESET_MAX_TIME*2.0; world.last_use = 0.0; - shader_route_register(); + shader_scene_route_register(); shader_routeui_register(); vg_acquire_thread_sync(); @@ -1122,20 +1135,23 @@ VG_STATIC void world_routes_update(void) } } -VG_STATIC void bind_terrain_textures(void); -VG_STATIC void render_world_routes( m4x4f projection, v3f camera ) +VG_STATIC void bind_terrain_noise(void); +VG_STATIC void render_world_routes( camera *cam ) { m4x3f identity_matrix; m4x3_identity( identity_matrix ); - shader_route_use(); - shader_route_uTexGarbage(0); - shader_link_standard_ub( _shader_route.id, 2 ); - bind_terrain_textures(); + shader_scene_route_use(); + shader_scene_route_uTexGarbage(0); + shader_link_standard_ub( _shader_scene_route.id, 2 ); + bind_terrain_noise(); - shader_route_uPv( projection ); - shader_route_uMdl( identity_matrix ); - shader_route_uCamera( camera ); + shader_scene_route_uPv( cam->mtx.pv ); + shader_scene_route_uPvmPrev( cam->mtx_prev.pv ); + shader_scene_route_uMdl( identity_matrix ); + shader_scene_route_uCamera( cam->transform[3] ); + shader_scene_route_uBoard0( TEMP_BOARD_0 ); + shader_scene_route_uBoard1( TEMP_BOARD_1 ); mesh_bind( &world.mesh_route_lines ); @@ -1147,7 +1163,7 @@ VG_STATIC void render_world_routes( m4x4f projection, v3f camera ) v3_lerp( (v3f){0.7f,0.7f,0.7f}, route->colour, route->factive, colour ); colour[3] = 1.0f; - shader_route_uColour( colour ); + shader_scene_route_uColour( colour ); mdl_draw_submesh( &route->sm ); } }