+static void render_scene(void){
+ /* Draw world */
+ glEnable( GL_DEPTH_TEST );
+
+ for( u32 i=0; i<vg_list_size(world_static.instances); i++ ){
+ if( world_static.instances[i].status == k_world_status_loaded ){
+ world_prerender( &world_static.instances[i] );
+ }
+ }
+
+ if( skaterift.activity == k_skaterift_respawning ){
+ world_instance *world = world_current_instance();
+ glDrawBuffers( 1, (GLenum[]){ GL_COLOR_ATTACHMENT0 } );
+
+ v3f bg;
+ v3_muls( world->ub_lighting.g_daysky_colour,
+ world->ub_lighting.g_day_phase -
+ world->ub_lighting.g_sunset_phase*0.1f, bg );
+
+ v3_muladds( bg, world->ub_lighting.g_sunset_colour,
+ (1.0f-0.5f)*world->ub_lighting.g_sunset_phase, bg );
+
+ v3_muladds( bg, world->ub_lighting.g_nightsky_colour,
+ (1.0f-world->ub_lighting.g_day_phase), bg );
+
+ glClearColor( bg[0], bg[1], bg[2], 0.0f );
+ glClear( GL_COLOR_BUFFER_BIT );
+ glDrawBuffers( 2, (GLenum[]){ GL_COLOR_ATTACHMENT0,
+ GL_COLOR_ATTACHMENT1 } );
+
+ m4x3f identity;
+ m4x3_identity( identity );
+ render_world_override( world, world, identity, &skaterift.cam,
+ respawn_chooser.spawn,
+ (v4f){world->tar_min, world->tar_max, 1.0f, 0.0f});
+ render_world_routes( world, world, identity, &skaterift.cam, 0, 1 );
+ return;
+ }
+
+ world_instance *view_world = get_view_world();
+ render_world( view_world, &skaterift.cam, 0, 0, 1, 1 );
+
+ /*
+ * render transition
+ */
+ if( global_miniworld.transition == 0 )
+ return;
+
+ world_instance *holdout_world = NULL;
+ f32 t = 0.0f;
+
+ if( global_miniworld.transition == 1 ){
+ holdout_world = &world_static.instances[ k_world_purpose_hub ];
+ t = global_miniworld.t;
+ }
+ else{
+ holdout_world = &world_static.instances[ k_world_purpose_client ];
+ t = 1.0f-global_miniworld.t;
+ }
+
+ if( holdout_world->status != k_world_status_loaded )
+ return;
+
+ t = vg_smoothstepf( t );
+
+ glEnable( GL_STENCIL_TEST );
+ glDisable( GL_DEPTH_TEST );
+ glStencilOp( GL_KEEP, GL_KEEP, GL_REPLACE );
+ glStencilFunc( GL_ALWAYS, 1, 0xFF );
+ glStencilMask( 0xFF );
+
+ shader_blit_transition_use();
+ shader_blit_transition_uInverseRatio( (v2f){1.0f,1.0f} );
+ shader_blit_transition_uT( -(sqrtf(2)+0.5f) * t );
+
+ render_fsquad();
+ render_world( holdout_world, &global_miniworld.cam, 1, 0, 1, 1 );