From 7a2032debc2c3bff7e4f795f39fd0e798186b4c2 Mon Sep 17 00:00:00 2001 From: hgn Date: Mon, 27 Mar 2023 12:15:16 +0100 Subject: [PATCH] marker improvement --- render.h | 6 ++++-- shaders/scene_scoretext.h | 2 +- skaterift.c | 9 ++++++--- world_gate.h | 6 +++--- world_render.h | 12 +++++++----- world_routes.h | 8 +++++--- world_water.h | 5 +++-- 7 files changed, 29 insertions(+), 19 deletions(-) diff --git a/render.h b/render.h index 44414ea..f17018b 100644 --- a/render.h +++ b/render.h @@ -16,9 +16,11 @@ #include "shaders/vblend.h" #endif -VG_STATIC void render_water_texture( world_instance *world, camera *cam ); +VG_STATIC void render_water_texture( world_instance *world, camera *cam, + int layer_depth ); VG_STATIC void render_water_surface( world_instance *world, camera *cam ); -VG_STATIC void render_world( world_instance *world, camera *cam ); +VG_STATIC void render_world( world_instance *world, camera *cam, + int layer_depth ); VG_STATIC void render_world_depth( world_instance *world, camera *cam ); #ifndef RENDER_H diff --git a/shaders/scene_scoretext.h b/shaders/scene_scoretext.h index dcefedb..417cc2a 100644 --- a/shaders/scene_scoretext.h +++ b/shaders/scene_scoretext.h @@ -72,7 +72,7 @@ static struct vg_shader _shader_scene_scoretext = { "\n" " gl_Position = vproj0;\n" "\n" -" aUv = a_uv;\n" +" aUv = a_uv + vec2( floor(uInfo.z+0.5)*(1.0/64.0), yoff );\n" " aNorm = vec4( mat3(uMdl) * mat3(mlocal) * a_norm.xyz, a_norm.w );\n" " aCo = a_co;\n" " aWorldCo = world_pos0;\n" diff --git a/skaterift.c b/skaterift.c index 6343098..e50c1e5 100644 --- a/skaterift.c +++ b/skaterift.c @@ -498,7 +498,7 @@ VG_STATIC void render_scene(void) return; } - render_world( view_world, &main_camera ); + render_world( view_world, &main_camera, 0 ); int player_transparent = 1, player_draw = 1; @@ -513,10 +513,13 @@ VG_STATIC void render_scene(void) player__render( &main_camera, &localplayer ); - render_water_texture( view_world, &main_camera ); + render_water_texture( view_world, &main_camera, 0 ); render_fb_bind( gpipeline.fb_main ); render_water_surface( view_world, &main_camera ); - render_world_gates( view_world, &main_camera ); + + int depth = 1; + if( localplayer.gate_waiting ) depth = 0; + render_world_gates( view_world, &main_camera, depth ); if( player_transparent && player_draw ) render_player_transparent(); diff --git a/world_gate.h b/world_gate.h index f2a383c..93322aa 100644 --- a/world_gate.h +++ b/world_gate.h @@ -67,7 +67,7 @@ VG_STATIC void world_gates_init(void) } VG_STATIC int render_gate( world_instance *world_inside, - ent_gate *gate, camera *cam ) + ent_gate *gate, camera *cam, int layer_depth ) { v3f viewdir, gatedir; m3x3_mulv( cam->transform, (v3f){0.0f,0.0f,-1.0f}, viewdir ); @@ -151,12 +151,12 @@ VG_STATIC int render_gate( world_instance *world_inside, glStencilMask( 0x00 ); } - render_world( world_inside, &gate_camera ); + render_world( world_inside, &gate_camera, layer_depth ); { glDisable( GL_STENCIL_TEST ); - render_water_texture( world_inside, &gate_camera ); + render_water_texture( world_inside, &gate_camera, layer_depth ); render_fb_bind( gpipeline.fb_main ); glEnable( GL_STENCIL_TEST ); diff --git a/world_render.h b/world_render.h index 517c19f..811e6a4 100644 --- a/world_render.h +++ b/world_render.h @@ -346,7 +346,8 @@ VG_STATIC void render_sky( world_instance *world, camera *cam ) glDepthMask( GL_TRUE ); } -VG_STATIC void render_world_gates( world_instance *world, camera *cam ) +VG_STATIC void render_world_gates( world_instance *world, camera *cam, + int layer_depth ) { float closest = INFINITY; @@ -371,18 +372,19 @@ VG_STATIC void render_world_gates( world_instance *world, camera *cam ) if( gate ){ #if 0 world_instance *dest_world = &world_global.worlds[ gate->world_index ]; - render_gate( dest_world, gate, cam ); + render_gate( dest_world, gate, cam, layer_depth ); #else - render_gate( world, gate, cam ); + render_gate( world, gate, cam, layer_depth ); #endif } } -VG_STATIC void render_world( world_instance *world, camera *cam ) +VG_STATIC void render_world( world_instance *world, camera *cam, + int layer_depth ) { render_sky( world, cam ); - render_world_routes( world, cam ); + render_world_routes( world, cam, layer_depth ); render_world_standard( world, cam ); render_world_vb( world, cam ); render_world_alphatest( world, cam ); diff --git a/world_routes.h b/world_routes.h index 05ef3c9..91456aa 100644 --- a/world_routes.h +++ b/world_routes.h @@ -564,7 +564,8 @@ VG_STATIC void world_bind_light_index( world_instance *world, GLuint shader, GLuint location, int slot ); -VG_STATIC void render_world_routes( world_instance *world, camera *cam ) +VG_STATIC void render_world_routes( world_instance *world, camera *cam, + int layer_depth ) { m4x3f identity_matrix; m4x3_identity( identity_matrix ); @@ -626,8 +627,9 @@ VG_STATIC void render_world_routes( world_instance *world, camera *cam ) shader_model_gate_uColour( colour ); - u32 next = route->checkpoints_start + - (route->active_checkpoint+1) % route->checkpoints_count; + u32 next = route->active_checkpoint+1+layer_depth; + 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 ); diff --git a/world_water.h b/world_water.h index 22de2c9..f44d265 100644 --- a/world_water.h +++ b/world_water.h @@ -48,7 +48,8 @@ VG_STATIC void world_bind_light_index( world_instance *world, /* * Does not write motion vectors */ -VG_STATIC void render_water_texture( world_instance *world, camera *cam ) +VG_STATIC void render_water_texture( world_instance *world, camera *cam, + int layer_depth ) { if( !world->water.enabled || (vg.quality_profile == k_quality_profile_low) ) return; @@ -91,7 +92,7 @@ VG_STATIC void render_water_texture( world_instance *world, camera *cam ) * Draw world */ glCullFace( GL_FRONT ); - render_world( world, &water_cam ); + render_world( world, &water_cam, layer_depth ); glCullFace( GL_BACK ); /* -- 2.25.1