qbsp: add -worldextent option for compiling large maps, default 65536

This commit is contained in:
Eric Wasylishen 2018-12-24 01:53:08 -07:00
parent f537fc2747
commit 4a360989f3
4 changed files with 13 additions and 7 deletions

View File

@ -156,9 +156,6 @@
#define T_EPSILON 0.0002
#define CONTINUOUS_EPSILON 0.0005
// FIXME: replace with MAX_WORLD_COORD/MIN_WORLD_COORD/WORLD_SIZE
#define BOGUS_RANGE 65536
// from q3map
#define MAX_WORLD_COORD ( 128*1024 )
#define MIN_WORLD_COORD ( -128*1024 )
@ -372,6 +369,7 @@ public:
bool fTestExpand;
bool fLeakTest;
bool fContentHack;
vec_t worldExtent;
options_t() {
memset(this, 0, sizeof(options_t));
@ -391,6 +389,7 @@ public:
this->fOldaxis = true;
this->maxNodeSize = 1024;
this->on_epsilon = 0.0001;
this->worldExtent = 65536;
}
};

View File

@ -105,7 +105,7 @@ CheckFace(face_t *face)
p2 = face->w.points[(i + 1) % face->w.numpoints];
for (j = 0; j < 3; j++)
if (p1[j] > BOGUS_RANGE || p1[j] < -BOGUS_RANGE)
if (p1[j] > options.worldExtent || p1[j] < -options.worldExtent)
Error("%s: coordinate out of range (%f)", __func__, p1[j]);
/* check the point is on the face plane */

View File

@ -856,6 +856,13 @@ ParseOptions(char *szOptions)
Error("Invalid argument to option %s", szTok);
options.on_epsilon= atof(szTok2);
szTok = szTok2;
} else if (!Q_strcasecmp(szTok, "worldextent")) {
szTok2 = GetTok(szTok + strlen(szTok) + 1, szEnd);
if (!szTok2)
Error("Invalid argument to option %s", szTok);
options.worldExtent= atof(szTok2);
logprint("Overriding maximum world extents to +/- %f units\n", options.worldExtent);
szTok = szTok2;
} else if (!Q_strcasecmp(szTok, "objexport")) {
options.fObjExport = true;
} else if (!Q_strcasecmp(szTok, "omitdetail")) {

View File

@ -38,7 +38,7 @@ BaseWindingForPlane(const qbsp_plane_t *p)
winding_t *w;
// find the major axis
max = -BOGUS_RANGE;
max = -options.worldExtent;
x = -1;
for (i = 0; i < 3; i++) {
v = fabs(p->normal[i]);
@ -69,8 +69,8 @@ BaseWindingForPlane(const qbsp_plane_t *p)
CrossProduct(vup, p->normal, vright);
VectorScale(vup, BOGUS_RANGE, vup);
VectorScale(vright, BOGUS_RANGE, vright);
VectorScale(vup, options.worldExtent, vup);
VectorScale(vright, options.worldExtent, vright);
// project a really big axis aligned box onto the plane
w = (winding_t *)AllocMem(WINDING, 4, true);