-#include "world.h"
-
-vg_tex2d tex_terrain_colours = { .path = "textures/gradients.qoi",
- .flags = VG_TEXTURE_CLAMP|VG_TEXTURE_NEAREST };
-
-vg_tex2d tex_terrain_noise = { .path = "textures/garbage.qoi",
- .flags = VG_TEXTURE_NEAREST };
-
-vg_tex2d tex_alphatest = { .path = "textures/alphatest.qoi",
- .flags = VG_TEXTURE_NEAREST };
-
-vg_tex2d tex_graffiti = { .path = "textures/graffitibox.qoi",
- .flags = VG_TEXTURE_NEAREST };
-
-static void world_render_init(void)
-{
- vg_info( "Loading default world textures\n" );
-
- vg_acquire_thread_sync();
- {
- vg_tex2d_init( (vg_tex2d *[]){ &tex_terrain_colours,
- &tex_terrain_noise,
- &tex_alphatest,
- &tex_graffiti }, 4 );
- }
- vg_release_thread_sync();
-}
-
-static void world_render_free(void*_)
-{
- vg_tex2d_free( (vg_tex2d *[]){ &tex_terrain_colours,
- &tex_terrain_noise,
- &tex_alphatest,
- &tex_graffiti }, 4 );
-}
-
-
-
-static void render_world_depth( m4x4f projection, m4x3f camera );
-
-
-
-
-/*
- * Rendering
- */
-
-static void bind_terrain_textures(void)
-{
- vg_tex2d_bind( &tex_terrain_noise, 0 );
- vg_tex2d_bind( &tex_terrain_colours, 1 );
-}
-
-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 );
-
- scene_bind( &world.geo );
- mdl_draw_submesh( &world.sm_geo_vb );
-
- mesh_bind( &world.cars );
-
-#if 0
- for( int i=0; i<vg_list_size(world.van_man); i++ )
- {
- shader_vblend_uMdl( world.van_man[i].transform );
- mdl_draw_submesh( &world.car_holden );
- }
-#endif
-}
-
-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 );