X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=world_routes.c;h=5f6d283a50dc0183621be8ef968c1fba4d56b13b;hb=330eda0436ed73d6c68214fef8922904abe19422;hp=9dc678ebd918065786d0e960db03a2cdb9b8a2ec;hpb=2c91a71533b4ce86b9e7fd708420ae05c74d8f52;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/world_routes.c b/world_routes.c index 9dc678e..5f6d283 100644 --- a/world_routes.c +++ b/world_routes.c @@ -612,8 +612,7 @@ static void world_routes_update( world_instance *world ){ for( u32 i=0; ient_route); i++ ){ ent_route *route = mdl_arritm( &world->ent_route, i ); - int target = (route->active_checkpoint == 0xffff? 0: 1) || - skaterift.activity == k_skaterift_respawning; + int target = route->active_checkpoint == 0xffff? 0: 1; route->factive = vg_lerpf( route->factive, target, 0.6f*vg.time_frame_delta ); } @@ -852,11 +851,12 @@ static void world_routes_fracture( world_instance *world, ent_gate *gate, } } -static void render_gate_markers( int run_id, ent_gate *gate ){ +static void render_gate_markers( m4x3f world_mmdl, int run_id, ent_gate *gate ){ for( u32 j=0; j<4; j++ ){ if( gate->routes[j] == run_id ){ m4x3f mmdl; ent_gate_get_mdl_mtx( gate, mmdl ); + m4x3_mul( world_mmdl, mmdl, mmdl ); shader_model_gate_uMdl( mmdl ); mdl_draw_submesh( &world_gates.sm_marker[j] ); break; @@ -864,25 +864,47 @@ static void render_gate_markers( int run_id, ent_gate *gate ){ } } -static void render_world_routes( world_instance *world, camera *cam, - int layer_depth ){ - m4x3f identity_matrix; - m4x3_identity( identity_matrix ); +static void render_world_routes( world_instance *world, + world_instance *host_world, + m4x3f mmdl, camera *cam, + int viewing_from_gate, int viewing_from_hub ){ shader_scene_route_use(); shader_scene_route_uTexGarbage(0); - world_link_lighting_ub( world, _shader_scene_route.id ); - world_bind_position_texture( world, _shader_scene_route.id, + world_link_lighting_ub( host_world, _shader_scene_route.id ); + world_bind_position_texture( host_world, _shader_scene_route.id, _uniform_scene_route_g_world_depth, 2 ); - world_bind_light_array( world, _shader_scene_route.id, + world_bind_light_array( host_world, _shader_scene_route.id, _uniform_scene_route_uLightsArray, 3 ); - world_bind_light_index( world, _shader_scene_route.id, + world_bind_light_index( host_world, _shader_scene_route.id, _uniform_scene_route_uLightsIndex, 4 ); bind_terrain_noise(); shader_scene_route_uPv( cam->mtx.pv ); - shader_scene_route_uPvmPrev( cam->mtx_prev.pv ); - shader_scene_route_uMdl( identity_matrix ); + + if( viewing_from_hub ){ + m4x4f m4mdl, pvm; + m4x3_expand( mmdl, m4mdl ); + m4x4_mul( cam->mtx_prev.pv, m4mdl, pvm ); + shader_scene_route_uMdl( mmdl ); + shader_scene_route_uPvmPrev( pvm ); + + m3x3f mnormal; + m3x3_inv( mmdl, mnormal ); + m3x3_transpose( mnormal, mnormal ); + v3_normalize( mnormal[0] ); + v3_normalize( mnormal[1] ); + v3_normalize( mnormal[2] ); + shader_scene_route_uNormalMtx( mnormal ); + } + else{ + shader_scene_route_uMdl( mmdl ); + shader_scene_route_uPvmPrev( cam->mtx_prev.pv ); + m3x3f ident; + m3x3_identity( ident ); + shader_scene_route_uNormalMtx( ident ); + } + shader_scene_route_uCamera( cam->transform[3] ); mesh_bind( &world->mesh_route_lines ); @@ -890,9 +912,11 @@ static void render_world_routes( world_instance *world, camera *cam, for( u32 i=0; ient_route); i++ ){ ent_route *route = mdl_arritm( &world->ent_route, i ); + f32 t = viewing_from_hub? 1.0f: route->factive; + v4f colour; - v3_lerp( (v3f){0.7f,0.7f,0.7f}, route->colour, route->factive, colour ); - colour[3] = route->factive*0.2f; + v3_lerp( (v3f){0.7f,0.7f,0.7f}, route->colour, t, colour ); + colour[3] = t*0.2f; shader_scene_route_uColour( colour ); mdl_draw_submesh( &route->sm ); @@ -900,7 +924,7 @@ static void render_world_routes( world_instance *world, camera *cam, /* timers * ---------------------------------------------------- */ - if( layer_depth == 0 ){ + if( !viewing_from_gate && !viewing_from_hub ){ font3d_bind( &gui.font, k_font_shader_default, 0, world, cam ); for( u32 i=0; ient_route); i++ ){ ent_route *route = mdl_arritm( &world->ent_route, i ); @@ -971,7 +995,7 @@ static void render_world_routes( world_instance *world, camera *cam, for( u32 j=0; jent_gate); j ++ ){ ent_gate *gate = mdl_arritm( &world->ent_gate, j ); if( !(gate->flags & k_ent_gate_nonlocal_DELETED) ) - render_gate_markers( i, gate ); + render_gate_markers( mmdl, i, gate ); } } } @@ -987,13 +1011,13 @@ static void render_world_routes( world_instance *world, camera *cam, shader_model_gate_uColour( colour ); - u32 next = route->active_checkpoint+1+layer_depth; + u32 next = route->active_checkpoint+1+viewing_from_gate; next = next % route->checkpoints_count; next += route->checkpoints_start; ent_checkpoint *cp = mdl_arritm( &world->ent_checkpoint, next ); ent_gate *gate = mdl_arritm( &world->ent_gate, cp->gate_index ); - render_gate_markers( i, gate ); + render_gate_markers( mmdl, i, gate ); } } }