SOME REGRESSIONS
authorhgn <hgodden00@gmail.com>
Mon, 24 Jul 2023 07:35:59 +0000 (08:35 +0100)
committerhgn <hgodden00@gmail.com>
Mon, 24 Jul 2023 07:35:59 +0000 (08:35 +0100)
scene.h
world_gate.c
world_gate.h
world_routes.c

diff --git a/scene.h b/scene.h
index 13de419f2542d4f300087babb87ebbe581df49d7..6d77e42fddd25bd540f25c4448b2364053bed25b 100644 (file)
--- a/scene.h
+++ b/scene.h
@@ -142,8 +142,10 @@ VG_STATIC void scene_add_mdl_submesh( scene_context *ctx, mdl_context *mdl,
       v3_sub( src_verts[tri[1]].co, src_verts[tri[0]].co, ac );
       v3_cross( ac, ab, tn );
 
+#if 0
       if( v3_length2( tn ) <= 0.00001f )
          continue;
+#endif
 
       dst_indices[real_indices+0] = tri[0] + ctx->vertex_count;
       dst_indices[real_indices+1] = tri[1] + ctx->vertex_count;
index b49113b3f0c381d1f27a618d9a213e57c3748776..765a09987e6f68cd61344e8163a2f641747dfe3c 100644 (file)
@@ -68,6 +68,15 @@ VG_STATIC void world_gates_init(void)
    mdl_close( &mgate );
 }
 
+VG_STATIC void ent_gate_get_mdl_mtx( ent_gate *gate, m4x3f mmdl ){
+   m4x3_copy( gate->to_world, mmdl );
+   
+   if( !(gate->flags & k_ent_gate_custom_mesh) ){
+      m3x3_scale( mmdl, (v3f){ gate->dimensions[0], 
+                               gate->dimensions[1], 1.0f } );
+   }
+}
+
 /*
  * Render the view through a gate
  */
@@ -148,10 +157,10 @@ VG_STATIC int render_gate( world_instance *world, world_instance *world_inside,
       glDisable( GL_CULL_FACE );
 
       m4x3f mmdl;
-      m4x3_copy( gate->to_world, mmdl );
+      ent_gate_get_mdl_mtx( gate, mmdl );
+      shader_model_gate_uMdl( mmdl );
       
       if( gate->flags & k_ent_gate_custom_mesh ){
-         shader_model_gate_uMdl( mmdl );
          mesh_bind( &world->mesh_no_collide );
          for( u32 i=0; i<gate->submesh_count; i++ ){
             mdl_submesh *sm = mdl_arritm( &world->meta.submeshs, 
@@ -160,9 +169,6 @@ VG_STATIC int render_gate( world_instance *world, world_instance *world_inside,
          }
       }
       else {
-         m3x3_scale( mmdl, (v3f){ gate->dimensions[0], 
-                                  gate->dimensions[1], 1.0f } );
-         shader_model_gate_uMdl( mmdl );
          mesh_bind( &world_gates.mesh );
          mdl_draw_submesh( &world_gates.sm_surface );
       }
index 89040fd811583e7812fa6faaa54e133f862ed332..6f384400b7962beafeeabc2adf7705a448a38d94 100644 (file)
@@ -28,5 +28,6 @@ VG_STATIC ent_gate *world_intersect_gates( world_instance *world,
                                            v3f pos, v3f last );
 
 VG_STATIC void ent_gate_call( world_instance *world, ent_call *call );
+VG_STATIC void ent_gate_get_mdl_mtx( ent_gate *gate, m4x3f mmdl );
 
 #endif /* WORLD_GATE_H */
index 26261a1ed72cc56e4658827dbf83af118e24b1c6..bd91b3c441bb41392593300ae87cb5f03c67aadf 100644 (file)
@@ -1109,12 +1109,15 @@ VG_STATIC void world_routes_update_timer_texts( world_instance *world )
             positions[0][1] = h1;
          }
 
-         m3x3_copy( gate->to_world, text->transform );
+         m4x3f mmdl;
+         ent_gate_get_mdl_mtx( gate, mmdl );
+
+         m3x3_copy( mmdl, text->transform );
          float ratio = v3_length(text->transform[0]) / 
                         v3_length(text->transform[1]);
 
          m3x3_scale( text->transform, (v3f){ size, size*ratio, 0.1f } );
-         m4x3_mulv( gate->to_world, positions[j], text->transform[3] );
+         m4x3_mulv( mmdl, positions[j], text->transform[3] );
       }
    }
 }
@@ -1304,7 +1307,10 @@ VG_STATIC void render_world_routes( world_instance *world, camera *cam,
 
          ent_checkpoint *cp = mdl_arritm( &world->ent_checkpoint, next );
          ent_gate *gate = mdl_arritm( &world->ent_gate, cp->gate_index );
-         shader_model_gate_uMdl( gate->to_world );
+
+         m4x3f mmdl;
+         ent_gate_get_mdl_mtx( gate, mmdl );
+         shader_model_gate_uMdl( mmdl );
 
          for( u32 j=0; j<4; j++ ){
             if( gate->routes[j] == i ){