face_t *AllocBspFace( void ) {
face_t *f;
- f = safe_malloc( sizeof( *f ) );
- memset( f, 0, sizeof( *f ) );
+ f = safe_malloc0( sizeof( *f ) );
return f;
}
*/
static void SelectSplitPlaneNum( node_t *node, face_t *list, int *splitPlaneNum, int *compileFlags ){
- face_t *split;
- face_t *check;
- face_t *bestSplit;
+ face_t *split;
+ face_t *check;
+ face_t *bestSplit;
int splits, facing, front, back;
int side;
- plane_t *plane;
+ plane_t *plane;
int value, bestValue;
int i;
vec3_t normal;
int planenum;
float sizeBias;
- //int frontC,backC,splitsC,facingC;
-
-
/* ydnar: set some defaults */
*splitPlaneNum = -1; /* leaf */
*compileFlags = 0;
if ( value > bestValue ) {
bestValue = value;
bestSplit = split;
- //frontC=front;
- //backC=back;
- //splitsC=splits;
- //facingC=facing;
}
}
return;
}
- //Sys_FPrintf (SYS_VRB, "F: %d B:%d S:%d FA:%ds\n",frontC,backC,splitsC,facingC );
-
/* set best split data */
*splitPlaneNum = bestSplit->planenum;
*compileFlags = bestSplit->compileFlags;
-#if 0
- if ( bestSplit->compileFlags & C_DETAIL ) {
- for ( split = list; split; split = split->next )
- if ( !( split->compileFlags & C_DETAIL ) ) {
- Sys_FPrintf( SYS_ERR, "DON'T DO SUCH SPLITS (1)\n" );
- }
- }
- if ( ( node->compileFlags & C_DETAIL ) && !( bestSplit->compileFlags & C_DETAIL ) ) {
- Sys_FPrintf( SYS_ERR, "DON'T DO SUCH SPLITS (2)\n" );
- }
-#endif
-
if ( *splitPlaneNum > -1 ) {
mapplanes[ *splitPlaneNum ].counter++;
}
winding_t *frontWinding, *backWinding;
int i;
int splitPlaneNum, compileFlags;
-#if 0
- qboolean isstruct = qfalse;
-#endif
/* count faces left */
continue;
}
-#if 0
- if ( !( split->compileFlags & C_DETAIL ) ) {
- isstruct = 1;
- }
-#endif
-
/* determine which side the face falls on */
side = WindingOnPlaneSide( split->w, plane->normal, plane->dist );
/* switch on side */
if ( side == SIDE_CROSS ) {
+ /* strict; if no winding is left, we have a "virtually identical" plane and don't want to split by it */
ClipWindingEpsilonStrict( split->w, plane->normal, plane->dist, CLIP_EPSILON * 2,
- &frontWinding, &backWinding ); /* strict; if no winding is left, we have a "virtually identical" plane and don't want to split by it */
+ &frontWinding, &backWinding );
if ( frontWinding ) {
newFace = AllocBspFace();
newFace->w = frontWinding;
}
}
-#if 0
- if ( ( node->compileFlags & C_DETAIL ) && isstruct ) {
- Sys_FPrintf( SYS_ERR, "I am detail, my child is structural, this is a wtf1\n", node->has_structural_children );
- }
-#endif
-
for ( i = 0 ; i < 2 ; i++ ) {
BuildFaceTree_r( node->children[i], childLists[i] );
node->has_structural_children |= node->children[i]->has_structural_children;
}
-
-#if 0
- if ( ( node->compileFlags & C_DETAIL ) && !( node->children[0]->compileFlags & C_DETAIL ) && node->children[0]->planenum != PLANENUM_LEAF ) {
- Sys_FPrintf( SYS_ERR, "I am detail, my child is structural\n", node->has_structural_children );
- }
- if ( ( node->compileFlags & C_DETAIL ) && isstruct ) {
- Sys_FPrintf( SYS_ERR, "I am detail, my child is structural, this is a wtf2\n", node->has_structural_children );
- }
-#endif
}