fov slider input maps menu stuff
[carveJwlIkooP6JGAAIwe30JlM.git] / world_render.h
index 25d72ee5e9df1e99a95932be02259f5a945534cd..ae9399bf8e02d711484159672c0384bd8aaabc9b 100644 (file)
@@ -7,28 +7,16 @@
 
 #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 };
-
 VG_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_tex2d_init( (vg_tex2d *[]){ &tex_terrain_noise }, 1 );
    }
    vg_release_thread_sync();
 }
@@ -39,10 +27,9 @@ VG_STATIC void render_world_depth( m4x4f projection, m4x3f camera );
  * Rendering
  */
 
-VG_STATIC void bind_terrain_textures(void)
+VG_STATIC void bind_terrain_noise(void)
 {
    vg_tex2d_bind( &tex_terrain_noise, 0 );
-   vg_tex2d_bind( &tex_terrain_colours, 1 );
 }
 
 VG_STATIC void world_render_if( enum mdl_shader shader, 
@@ -106,6 +93,24 @@ VG_STATIC void render_world_vb( m4x4f projection, v3f camera )
                              bindpoint_diffuse_texture1 );
 }
 
+VG_STATIC void render_world_standard( m4x4f projection, v3f camera )
+{
+   m4x3f identity_matrix;
+   m4x3_identity( identity_matrix );
+
+   shader_standard_use();
+   shader_standard_uTexGarbage(0);
+   shader_standard_uTexMain(1);
+   shader_link_standard_ub( _shader_standard.id, 2 );
+   bind_terrain_noise();
+
+   shader_standard_uPv( projection );
+   shader_standard_uMdl( identity_matrix );
+   shader_standard_uCamera( camera );
+   
+   world_render_both_stages( k_shader_standard,
+                             bindpoint_diffuse_texture1 );
+}
 
 VG_STATIC void render_world_alphatest( m4x4f projection, v3f camera )
 {
@@ -116,8 +121,7 @@ VG_STATIC void render_world_alphatest( m4x4f projection, v3f camera )
    shader_alphatest_uTexGarbage(0);
    shader_alphatest_uTexMain(1);
    shader_link_standard_ub( _shader_alphatest.id, 2 );
-
-   vg_tex2d_bind( &tex_terrain_noise, 0 );
+   bind_terrain_noise();
 
    shader_alphatest_uPv( projection );
    shader_alphatest_uMdl( identity_matrix );
@@ -245,6 +249,7 @@ VG_STATIC void render_world( m4x4f projection, m4x3f camera )
 {
    render_sky( camera );
    render_world_routes( projection, camera[3] );
+   render_world_standard( projection, camera[3] );
    render_world_vb( projection, camera[3] );
    render_world_alphatest( projection, camera[3] );
    render_terrain( projection, camera[3] );