"enabled": {"type": "int", "default": 1 },
})
},
+ "info_player_terrorist":
+ {
+ "gizmo": [],
+ "allow": ('EMPTY',),
+ "keyvalues": ent_baseclass([ent_transform],\
+ {
+ "priority": {"type": "int", "default": 0 },
+ "enabled": {"type": "int", "default": 1 },
+ })
+ },
"light": { "keyvalues": ent_lights },
"light_spot": { "keyvalues": ent_lights },
# SUN
return newmesh;
}
+// Does some checks to determine if solid is valid or not
+static int cxr_valid_solid( struct cxr_mesh *mesh, struct cxr_auto_buffer *abverts, int *solid, int len )
+{
+ // Invalid 1: Similar normals
+ // Invalid 2: Co-planar point, that is not referenced by the polygon.
+ //
+ for( int i=0; i<len; i++ )
+ {
+ struct cxr_polygon *polyi = cxr_ab_ptr(&mesh->polys,solid[i]);
+
+ v4f plane;
+ normal_to_plane(polyi->normal, polyi->center, plane);
+
+ for( int j=0; j<len; j++ )
+ {
+ if( i==j ) continue;
+
+ struct cxr_polygon *polyj = cxr_ab_ptr(&mesh->polys,solid[j]);
+
+ for( int k=0; k<polyj->loop_total; k++ )
+ {
+ struct cxr_loop *lpj = cxr_ab_ptr(&mesh->loops, polyj->loop_start+k);
+
+ // Make sure this point isnt in our original poly
+ for( int l=0; l<polyi->loop_total; l++ )
+ {
+ struct cxr_loop *lpi = cxr_ab_ptr(&mesh->loops, polyi->loop_start+l);
+ if( lpi->index == lpj->index )
+ goto IL_SKIP_VERTEX;
+ }
+
+ if( fabs(plane_polarity(plane,cxr_ab_ptr(abverts,lpj->index))) < 0.001 )
+ return 0;
+
+IL_SKIP_VERTEX:;
+ }
+ }
+ }
+
+ return 1;
+}
+
// Return best availible solid from mesh, and patch existing mesh to fill the gap
// creted by it.
//
edge_tagged[i] = 1;
}
-
+#if 0
for( int i=0; i<vert_buffer->count; i++ )
if( vertex_tagged[i] )
cxr_debug_box( vertices[i], 0.03, (v4f){0.0,0.0,0.0,1.0});
if( hot_edge[i] )
cxr_debug_line( vertices[ edge->i0 ], vertices[ edge->i1 ], (v4f){0.0,1.0,1.0,1.0});
}
-
+#endif
// count regions
int *faces_tagged = malloc(mesh->polys.count*sizeof(int));
IL_SKIP_SIMILAR_PLANES:;
}
- solid[ solid_len ++ ] = loop->poly_right;
- faces_tagged[ loop->poly_right ] = i;
- changed = 1;
+ // Check for vertices in the new poly that exist on a current plane.
+ // this condition is an invalid configuration and should not be added.
+
+ solid[ solid_len ] = loop->poly_right;
+
+ if( cxr_valid_solid(mesh,vert_buffer,solid,solid_len+1 ) )
+ {
+ faces_tagged[ loop->poly_right ] = i;
+ changed = 1;
+ solid_len ++;
+ }
}
IL_SKIP_PLANE_ADD:;
cxr_debug_mesh( solid->pmesh, cxr_ab_ptr(&abverts,0), colours_random[cxr_range(i,8)] );
}
}
+
+ if( error )
+ {
+ for( int i=0; i<solids.count; i++ )
+ {
+ struct solidinf *solid = cxr_ab_ptr(&solids,i);
+ cxr_free_mesh( solid->pmesh );
+ }
+
+ cxr_ab_free( &abverts );
+ cxr_ab_free( &solids );
+ return error;
+ }
// Turn all those solids into VMF brushes
// --------------------------------------