- vg_release_thread_sync();
-}
-
-VG_STATIC void render_world_depth( m4x4f projection, m4x3f camera );
-
-/*
- * Rendering
- */
-
-VG_STATIC void bind_terrain_textures(void)
-{
- vg_tex2d_bind( &tex_terrain_noise, 0 );
- vg_tex2d_bind( &tex_terrain_colours, 1 );
-}
-
-VG_STATIC void render_world_vb( m4x4f projection, v3f camera )
-{
- m4x3f identity_matrix;
- m4x3_identity( identity_matrix );
-
- shader_vblend_use();
- shader_vblend_uTexGarbage(0);
- shader_vblend_uTexGradients(1);
- shader_link_standard_ub( _shader_vblend.id, 2 );
- bind_terrain_textures();
-
- shader_vblend_uPv( projection );
- shader_vblend_uMdl( identity_matrix );
- shader_vblend_uCamera( camera );
-
- mesh_bind( &world.mesh_geo );
- mdl_draw_submesh( &world.sm_geo_vb );
-}
-
-VG_STATIC void render_world_alphatest( m4x4f projection, v3f camera )
-{
- m4x3f identity_matrix;
- m4x3_identity( identity_matrix );
-
- shader_alphatest_use();
- shader_alphatest_uTexGarbage(0);
- shader_alphatest_uTexMain(1);
- shader_link_standard_ub( _shader_alphatest.id, 2 );
-
- vg_tex2d_bind( &tex_terrain_noise, 0 );
- vg_tex2d_bind( &tex_alphatest, 1 );
-
- shader_alphatest_uPv( projection );
- shader_alphatest_uMdl( identity_matrix );
- shader_alphatest_uCamera( camera );
-
- glDisable(GL_CULL_FACE);
- mesh_bind( &world.mesh_no_collide );
- mdl_draw_submesh( &world.sm_foliage_alphatest );
-
- vg_tex2d_bind( &tex_graffiti, 1 );
- mdl_draw_submesh( &world.sm_graffiti );
-
- glEnable(GL_CULL_FACE);
-}
-
-VG_STATIC void render_terrain( m4x4f projection, v3f camera )
-{
- m4x3f identity_matrix;
- m4x3_identity( identity_matrix );
-
- shader_terrain_use();
- shader_terrain_uTexGarbage(0);
- shader_terrain_uTexGradients(1);
- shader_link_standard_ub( _shader_terrain.id, 2 );
- bind_terrain_textures();
-
- shader_terrain_uPv( projection );
- shader_terrain_uMdl( identity_matrix );
- shader_terrain_uCamera( camera );
-
- mesh_bind( &world.mesh_geo );
- mdl_draw_submesh( &world.sm_terrain );
- mdl_draw_submesh( &world.sm_geo_std_oob );
- mdl_draw_submesh( &world.sm_geo_std );
- mdl_draw_submesh( &world.sm_subworld );
-
- /* TODO: Dont draw in reflection */
- glDisable( GL_CULL_FACE );
- mesh_bind( &world.mesh_no_collide );
- mdl_draw_submesh( &world.sm_foliage_main );
- glEnable( GL_CULL_FACE );
-}
-
-VG_STATIC void render_lowerdome( m4x3f camera )
-{
- m4x4f projection, full;
- pipeline_projection( projection, 0.4f, 1000.0f );
-
- m4x3f inverse;
- m3x3_transpose( camera, inverse );
- v3_copy((v3f){0.0f,0.0f,0.0f}, inverse[3]);
- m4x3_expand( inverse, full );
- m4x4_mul( projection, full, full );
-
- m4x3f identity_matrix;
- m4x3_identity( identity_matrix );
-
- shader_planeinf_use();
- shader_planeinf_uMdl(identity_matrix);
- shader_planeinf_uPv(full);
- shader_planeinf_uCamera(camera[3]);
- shader_planeinf_uPlane( (v4f){0.0f,1.0f,0.0f,0.0f} );
-
- mdl_draw_submesh( &world.dome_lower );
-}
-
-VG_STATIC void render_sky(m4x3f camera)
-{
- m4x4f projection, full;
- pipeline_projection( projection, 0.4f, 1000.0f );
-
- m4x3f inverse;
- m3x3_transpose( camera, inverse );
- v3_copy((v3f){0.0f,0.0f,0.0f}, inverse[3]);
- m4x3_expand( inverse, full );
- m4x4_mul( projection, full, full );
-
- m4x3f identity_matrix;
- m4x3_identity( identity_matrix );
-
- shader_sky_use();
- shader_sky_uMdl(identity_matrix);
- shader_sky_uPv(full);
- shader_sky_uTexGarbage(0);
- shader_sky_uTime( world.sky_time );
-
- vg_tex2d_bind( &tex_terrain_noise, 0 );
-
- glDepthMask( GL_FALSE );
- glDisable( GL_DEPTH_TEST );
-
- mesh_bind( &world.skydome );
- mdl_draw_submesh( &world.dome_upper );
-
- glEnable( GL_DEPTH_TEST );
- glDepthMask( GL_TRUE );
-}
-
-VG_STATIC void render_world_gates( m4x4f projection, v3f playerco, m4x3f camera )
-{
- if( !world.gate_count )
- return;
-
- float closest = INFINITY;
- int id = 0;
-
- for( int i=0; i<world.gate_count; i++ )
- {
- struct route_gate *rg = &world.gates[i];
- float dist = v3_dist2( rg->gate.co[0], camera[3] );
-
- if( dist < closest )
- {
- closest = dist;
- id = i;
- }