mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
brush.c:
quieten point off plane warning qfbsp.c: allocate less memory for clipped winding
This commit is contained in:
parent
83ba424ffc
commit
4f33663c8c
2 changed files with 16 additions and 7 deletions
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include "compat.h"
|
||||
#include "bsp5.h"
|
||||
#include "options.h"
|
||||
|
||||
int numbrushplanes;
|
||||
plane_t planes[MAX_MAP_PLANES];
|
||||
|
@ -73,8 +74,9 @@ 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)
|
||||
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);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue