quieten point off plane warning
qfbsp.c:
	allocate less memory for clipped winding
This commit is contained in:
Bill Currie 2003-09-17 21:03:52 +00:00
parent 83ba424ffc
commit 4f33663c8c
2 changed files with 16 additions and 7 deletions

View File

@ -31,6 +31,7 @@
#include "compat.h"
#include "bsp5.h"
#include "options.h"
int numbrushplanes;
plane_t planes[MAX_MAP_PLANES];
@ -73,10 +74,11 @@ CheckFace (face_t *f)
d = DotProduct (p1, planes[f->planenum].normal)
- planes[f->planenum].dist;
//XXX point off plane autofix
// point off plane autofix
if (d < -ON_EPSILON || d > ON_EPSILON)
printf ("CheckFace: point off plane: %g @ (%g %g %g)\n", d,
p1[0], p1[1], p1[2]);
if (options.verbosity > 1)
printf ("CheckFace: point off plane: %g @ (%g %g %g)\n", d,
p1[0], p1[1], p1[2]);
VectorMultSub (p1, d, planes[f->planenum].normal, p1);
// check the edge isn't degenerate

View File

@ -216,21 +216,28 @@ ClipWinding (winding_t *in, plane_t *split, qboolean keepon)
}
if (!counts[1])
return in;
#if 0
maxpts = in->numpoints + 4; // can't use counts[0]+2 because of fp
// grouping errors
#else
maxpts = counts[0] + 2;
#endif
neww = NewWinding (maxpts);
for (i = 0; i < in->numpoints; i++) {
p1 = in->points[i];
if (sides[i] == SIDE_ON) {
if (neww->numpoints == maxpts)
Sys_Error ("ClipWinding: points exceeded estimate");
VectorCopy (p1, neww->points[neww->numpoints]);
neww->numpoints++;
continue;
}
if (sides[i] == SIDE_FRONT) {
if (neww->numpoints == maxpts)
Sys_Error ("ClipWinding: points exceeded estimate");
VectorCopy (p1, neww->points[neww->numpoints]);
neww->numpoints++;
}
@ -238,6 +245,9 @@ ClipWinding (winding_t *in, plane_t *split, qboolean keepon)
if (sides[i + 1] == SIDE_ON || sides[i + 1] == sides[i])
continue;
if (neww->numpoints == maxpts)
Sys_Error ("ClipWinding: points exceeded estimate");
// generate a split point
p2 = in->points[(i + 1) % in->numpoints];
@ -255,9 +265,6 @@ ClipWinding (winding_t *in, plane_t *split, qboolean keepon)
neww->numpoints++;
}
if (neww->numpoints > maxpts)
Sys_Error ("ClipWinding: points exceeded estimate");
// free the original winding
FreeWinding (in);