vg.time_rate = vg_smoothstepf( skaterift.time_rate );
/* TODO: how can we compress this? */
+ ent_miniworld_preupdate();
player__pre_update();
world_entity_focus_preupdate();
skaterift_replay_pre_update();
remote_sfx_pre_update();
- ent_miniworld_preupdate();
world_update( world_current_instance(), localplayer.rb.co );
audio_ambient_sprites_update( world_current_instance(), localplayer.rb.co );
/* Draw world */
glEnable( GL_DEPTH_TEST );
- world_instance *view_world = localplayer.viewable_world;
-
- if( view_world == NULL ){
- glClearColor( 0.25f, 0.25f, 0.0f, 1.0f );
- glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT );
- return;
- }
-
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 ){
- glDrawBuffers( 1, (GLenum[]){ GL_COLOR_ATTACHMENT0 } );
- glClearColor( 0.624f, 0.659f, 0.769f, 0.0f );
- glClearColor( 0.824f, 0.0f, 0.1f, 0.0f );
- glClear( GL_COLOR_BUFFER_BIT );
- glDrawBuffers( 2, (GLenum[]){ GL_COLOR_ATTACHMENT0,
- GL_COLOR_ATTACHMENT1 } );
-#if 0
- view_world = &world_static.instances[respawn_chooser.world_id];
- render_world_override( view_world );
- render_world_routes( view_world, &skaterift.cam, 1 );
-#endif
+ render_world( world_current_instance(), &skaterift.cam, 0, 0, 1, 1 );
+
+ 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{
- render_world( view_world, &skaterift.cam, 0 );
- render_water_texture( view_world, &skaterift.cam, 0 );
- render_fb_bind( gpipeline.fb_main, 1 );
- render_water_surface( view_world, &skaterift.cam );
- render_remote_players( view_world, &skaterift.cam );
- ent_miniworld_render( view_world );
+ else if( global_miniworld.transition == -1 ){
+ holdout_world = &world_static.instances[ k_world_purpose_client ];
+ t = 1.0f-global_miniworld.t;
+ }
+ else {
}
-}
+ if( holdout_world ){
+ if( holdout_world->status != k_world_status_loaded )
+ return;
-static void render_scene_gate_subview(void){
- render_fb_bind( gpipeline.fb_main, 1 );
- world_instance *view_world = localplayer.viewable_world;
- if( !view_world ) return; /* ??? */
- if( skaterift.activity == k_skaterift_respawning ) 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 );
- int depth = 1;
- if( localplayer.gate_waiting ) depth = 0;
- render_world_gates( view_world, &skaterift.cam, depth );
+ 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 );
+ }
}
static void skaterift_composite_maincamera(void){
skaterift.cam.nearz = 0.1f;
skaterift.cam.farz = 2100.0f;
+ if( global_miniworld.transition ){
+ f32 dt = vg.time_frame_delta / 2.0f,
+ s = vg_signf( global_miniworld.transition );
+ global_miniworld.t += s * dt;
+
+ if( (global_miniworld.t > 1.0f) || (global_miniworld.t < 0.0f) ){
+ /* TODO: maybe next frame! */
+ global_miniworld.t = vg_clampf( global_miniworld.t, 0.0f, 1.0f );
+ global_miniworld.transition = 0;
+ }
+ else {
+ }
+ }
+
if( skaterift.activity == k_skaterift_respawning ){
camera_copy( &respawn_chooser.cam, &skaterift.cam );
skaterift.cam.nearz = 4.0f;
}
camera_update_transform( &skaterift.cam );
-
-#if 0
- if( skaterift.activity != k_skaterift_respawning ){
- if( localplayer.gate_waiting ){
- m3x3_mul( localplayer.basis_gate, skaterift.cam.transform,
- skaterift.cam.transform );
- }
- else{
- m3x3_mul( localplayer.basis, skaterift.cam.transform,
- skaterift.cam.transform );
- }
- }
-#endif
-
camera_update_view( &skaterift.cam );
camera_update_projection( &skaterift.cam );
camera_finalize( &skaterift.cam );
skaterift_composite_maincamera();
/* --------------------------------------------------------------------- */
-
- world_instance *view_world = localplayer.viewable_world;
- if( (view_world != NULL) && (skaterift.activity != k_skaterift_respawning) ){
- render_world_cubemaps( view_world );
- }
+ render_world_cubemaps( world_current_instance() );
/* variable res target */
render_fb_bind( gpipeline.fb_main, 1 );
portals */
/* continue with variable rate */
- render_scene_gate_subview();
+ if( !global_miniworld.transition ){
+ render_fb_bind( gpipeline.fb_main, 1 );
+ render_world_gates( world_current_instance(), &skaterift.cam );
+ }
/* composite */
present_view_with_post_processing();