+VG_STATIC void world_render_if( enum mdl_shader shader,
+ enum geo_type geo_type,
+ void (*bind_point)(struct world_material *mat))
+{
+
+ for( int i=0; i<world.material_count; i++ )
+ {
+ struct world_material *mat = &world.materials[i];
+
+ if( mat->info.shader == shader )
+ {
+ mdl_submesh *sm;
+
+ if( geo_type == k_geo_type_solid )
+ sm = &mat->sm_geo;
+ else
+ sm = &mat->sm_no_collide;
+
+ if( !sm->indice_count )
+ continue;
+
+ bind_point( mat );
+ mdl_draw_submesh( sm );
+ }
+ }
+}
+
+VG_STATIC void world_render_both_stages( enum mdl_shader shader,
+ void (*bind_point)(struct world_material *mat))
+{
+ mesh_bind( &world.mesh_geo );
+ world_render_if( shader, k_geo_type_solid, bind_point );
+ mesh_bind( &world.mesh_no_collide );
+ world_render_if( shader, k_geo_type_nonsolid, bind_point );
+}
+
+VG_STATIC void bindpoint_diffuse_texture1( struct world_material *mat )
+{
+ glActiveTexture( GL_TEXTURE1 );
+ glBindTexture( GL_TEXTURE_2D, world.textures[ mat->info.tex_diffuse ] );
+}
+
+VG_STATIC void render_world_vb( camera *cam )