#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();
}
* 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,
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 )
{
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 );
{
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] );