player__debugtext( 1, "head @%u | tail @%u\n", head, tail );
- for( u32 i=0; i<4; i++ ){
- player__debugtext( 1, "[%u]: [%hu, %hu]\n", i,
- replay->statehead->data_table[i][0],
- replay->statehead->data_table[i][1] );
- }
-
if( replay->statehead ){
+ for( u32 i=0; i<4; i++ ){
+ player__debugtext( 1, "[%u]: [%hu, %hu]\n", i,
+ replay->statehead->data_table[i][0],
+ replay->statehead->data_table[i][1] );
+ }
u32 state = (void *)replay->statehead - replay->data;
player__debugtext( 1, "gs @%u\n", state );
player__debugtext( 1, "gamestate_size: %hu\n",
v2_copy( src->uv, pvert->uv );
}
- for( u32 i=0; i<sm->indice_count; i++ )
- dst_indices[i] = src_indices[i] + ctx->vertex_count;
+ u32 real_indices = 0;
+ for( u32 i=0; i<sm->indice_count/3; i++ ){
+ u32 *tri = &src_indices[i*3];
+
+ 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_cross( ac, ab, tn );
+
+ if( v3_length2( tn ) <= 0.00001f )
+ continue;
+
+ 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;
+
+ real_indices += 3;
+ }
+
+ if( real_indices != sm->indice_count )
+ vg_warn( "Zero area triangles in model\n" );
ctx->vertex_count += sm->vertex_count;
- ctx->indice_count += sm->indice_count;
+ ctx->indice_count += real_indices;
}
/*
m4x3_copy( gate->to_world, 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,
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 );
}
- shader_model_gate_uMdl( mmdl );
-
glClear( GL_DEPTH_BUFFER_BIT );
glStencilFunc( GL_EQUAL, 1, 0xFF );
glStencilMask( 0x00 );