tone down triangle complainers
authorhgn <hgodden00@gmail.com>
Fri, 4 Aug 2023 11:26:02 +0000 (12:26 +0100)
committerhgn <hgodden00@gmail.com>
Fri, 4 Aug 2023 11:26:02 +0000 (12:26 +0100)
maps_src/mp_spawn/main.mdl
rigidbody.h
scene.h

index 3aa6cfba3e8c1c580cfb0f86b2d6141e459da991..7f8f1d3a8f210d47b1e66a60f1fd48fd489f3121 100644 (file)
Binary files a/maps_src/mp_spawn/main.mdl and b/maps_src/mp_spawn/main.mdl differ
index 92419991f7b0e6f21c5659a63a2db9f5bfb9700c..1c1e8c8cd48f991ee642c65ab7023840b90ad29c 100644 (file)
@@ -852,7 +852,9 @@ VG_STATIC int rb_sphere__triangle( m4x3f mtxA, rb_sphere *b,
       v3_copy( tn, ct->n );
 
       if( v3_length2( ct->n ) <= 0.00001f ){
+#ifdef RIGIDBODY_CRY_ABOUT_EVERYTHING
          vg_error( "Zero area triangle!\n" );
+#endif
          return 0;
       }
 
@@ -960,6 +962,14 @@ VG_STATIC int rb_box__scene( m4x3f mtxA, boxf bbx,
       v3_sub( tri[1], tri[0], v0 );
       v3_sub( tri[2], tri[0], v1 );
       v3_cross( v0, v1, n );
+
+      if( v3_length2( n ) <= 0.00001f ){
+#ifdef RIGIDBODY_CRY_ABOUT_EVERYTHING
+         vg_error( "Zero area triangle!\n" );
+#endif
+         return 0;
+      }
+
       v3_normalize( n );
 
       /* find best feature */
@@ -1098,7 +1108,9 @@ VG_STATIC int rb_capsule__triangle( m4x3f mtxA, rb_capsule *c,
    v3_cross( v0, v1, n );
 
    if( v3_length2( n ) <= 0.00001f ){
+#ifdef RIGIDBODY_CRY_ABOUT_EVERYTHING
       vg_error( "Zero area triangle!\n" );
+#endif
       return 0;
    }
 
diff --git a/scene.h b/scene.h
index 6d77e42fddd25bd540f25c4448b2364053bed25b..83badb2fbca423444213dc3825af14e633bf25a3 100644 (file)
--- a/scene.h
+++ b/scene.h
@@ -135,11 +135,12 @@ VG_STATIC void scene_add_mdl_submesh( scene_context *ctx, mdl_context *mdl,
 
    u32 real_indices = 0;
    for( u32 i=0; i<sm->indice_count/3; i++ ){
-      u32 *tri = &src_indices[i*3];
+      u32 *src = &src_indices[i*3],
+          *dst = &dst_indices[real_indices];
 
       v3f ab, ac, tn;
-      v3_sub( src_verts[tri[2]].co, src_verts[tri[0]].co, ab );
-      v3_sub( src_verts[tri[1]].co, src_verts[tri[0]].co, ac );
+      v3_sub( src_verts[src[2]].co, src_verts[src[0]].co, ab );
+      v3_sub( src_verts[src[1]].co, src_verts[src[0]].co, ac );
       v3_cross( ac, ab, tn );
 
 #if 0
@@ -147,9 +148,9 @@ VG_STATIC void scene_add_mdl_submesh( scene_context *ctx, mdl_context *mdl,
          continue;
 #endif
 
-      dst_indices[real_indices+0] = tri[0] + ctx->vertex_count;
-      dst_indices[real_indices+1] = tri[1] + ctx->vertex_count;
-      dst_indices[real_indices+2] = tri[2] + ctx->vertex_count;
+      dst[0] = src[0] + ctx->vertex_count;
+      dst[1] = src[1] + ctx->vertex_count;
+      dst[2] = src[2] + ctx->vertex_count;
 
       real_indices += 3;
    }