clear runs when respawning
[carveJwlIkooP6JGAAIwe30JlM.git] / world_render.c
index a7bb6939c6b5d02b07f76e6c5eb29fd2d997afc1..2cbd07beaecd4519cb1920cc9f787b03acb81c0d 100644 (file)
@@ -417,6 +417,7 @@ void world_render_challenges( world_instance *world, struct world_pass *pass,
                               v3f pos, int layer_depth ){
    if( !world ) return;
    if( skaterift.activity == k_skaterift_replay ) return;
+   if( world != world_current_instance() ) return;
 
    /* sort lists */
    f32 radius = 40.0f;
@@ -453,7 +454,7 @@ void world_render_challenges( world_instance *world, struct world_pass *pass,
       while( mdl_entity_id_type(next) == k_ent_objective ){
          u32 index = mdl_entity_id_id( next );
          objective_list[ objective_count ++ ] = index;
-         
+
          ent_objective *objective = mdl_arritm( &world->ent_objective, index );
          next = objective->id_next;
       }
@@ -646,9 +647,16 @@ VG_STATIC void bindpoint_terrain( world_instance *world,
    shader_scene_terrain_uBlendOffset( mat->info.colour1 );
 }
 
-VG_STATIC void bindpoint_none( world_instance *world,
-                               struct world_surface *mat ){
-   
+VG_STATIC void bindpoint_override( world_instance *world,
+                                   struct world_surface *mat ){
+   if( mat->info.flags & k_material_flag_collision ){
+      shader_scene_override_uAlphatest(0);
+   }
+   else{
+      glActiveTexture( GL_TEXTURE1 );
+      glBindTexture( GL_TEXTURE_2D, world->textures[ mat->info.tex_diffuse ] );
+      shader_scene_override_uAlphatest(1);
+   }
 }
 
 VG_STATIC void render_terrain( world_instance *world, camera *cam )
@@ -914,7 +922,7 @@ void render_world_override_pass( world_instance *world,
 VG_STATIC void render_world_override( world_instance *world ){
    struct world_pass pass = {
       .cam = &skaterift.cam,
-      .fn_bind_textures = bindpoint_none,
+      .fn_bind_textures = bindpoint_override,
       .fn_set_mdl = shader_scene_override_uMdl,
       .fn_set_uPvmPrev = shader_scene_override_uPvmPrev,
       .shader = k_shader_override