#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
"\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"
return;
}
- render_world( view_world, &main_camera );
+ render_world( view_world, &main_camera, 0 );
int player_transparent = 1,
player_draw = 1;
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();
}
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 );
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 );
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;
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 );
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 );
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 );
/*
* 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;
* Draw world
*/
glCullFace( GL_FRONT );
- render_world( world, &water_cam );
+ render_world( world, &water_cam, layer_depth );
glCullFace( GL_BACK );
/*