qbsp: restore use of options.worldExtent

should fix minor precision differences in .prt files
This commit is contained in:
Eric Wasylishen 2021-10-08 19:04:11 -06:00
parent 1b1679fa22
commit 5cf82ee023
5 changed files with 11 additions and 9 deletions

View File

@ -147,7 +147,7 @@ std::vector<decomp_plane_t> RemoveRedundantPlanes(const std::vector<decomp_plane
// outward-facing plane // outward-facing plane
vec3_t normal; vec3_t normal;
VectorCopy(plane.normal, normal); VectorCopy(plane.normal, normal);
std::optional<winding_t> winding = winding_t::from_plane(normal, plane.distance); std::optional<winding_t> winding = winding_t::from_plane(normal, plane.distance, 10e6);
// clip `winding` by all of the other planes, flipped // clip `winding` by all of the other planes, flipped
for (const decomp_plane_t &plane2 : planes) { for (const decomp_plane_t &plane2 : planes) {

View File

@ -420,7 +420,7 @@ public:
return p; return p;
} }
static winding_base_t from_plane(const qvec3d &normal, const vec_t &dist) static winding_base_t from_plane(const qvec3d &normal, const vec_t &dist, const vec_t &worldextent)
{ {
/* find the major axis */ /* find the major axis */
vec_t max = -VECT_MAX; vec_t max = -VECT_MAX;
@ -452,8 +452,8 @@ public:
qvec3d org = normal * dist; qvec3d org = normal * dist;
qvec3d vright = qv::cross(vup, normal); qvec3d vright = qv::cross(vup, normal);
vup *= 10e6; vup *= worldextent;
vright *= 10e6; vright *= worldextent;
/* project a really big axis aligned box onto the plane */ /* project a really big axis aligned box onto the plane */
winding_base_t w(4); winding_base_t w(4);

View File

@ -32,7 +32,4 @@ struct qbsp_plane_t : plane_t
using winding_t = polylib::winding_base_t<MAXEDGES>; using winding_t = polylib::winding_base_t<MAXEDGES>;
inline winding_t BaseWindingForPlane(const qbsp_plane_t *p) winding_t BaseWindingForPlane(const qbsp_plane_t *p);
{
return winding_t::from_plane(p->normal, p->dist);
}

View File

@ -452,7 +452,7 @@ static void Leaf_MakeFaces(
VectorScale(plane.normal, -1, faceplane.normal); VectorScale(plane.normal, -1, faceplane.normal);
faceplane.dist = -plane.dist; faceplane.dist = -plane.dist;
std::optional<winding_t> winding = winding_t::from_plane(faceplane.normal, faceplane.dist); std::optional<winding_t> winding = winding_t::from_plane(faceplane.normal, faceplane.dist, 10e6);
// clip `winding` by all of the other planes // clip `winding` by all of the other planes
for (const plane_t &plane2 : planes) { for (const plane_t &plane2 : planes) {

View File

@ -492,6 +492,11 @@ static void EmitAreaPortals(node_t *headnode)
LogPrint(LOG_STAT, "{:5} numareaportals\n", map.bsp.dareaportals.size()); LogPrint(LOG_STAT, "{:5} numareaportals\n", map.bsp.dareaportals.size());
} }
winding_t BaseWindingForPlane(const qbsp_plane_t *p)
{
return winding_t::from_plane(p->normal, p->dist, options.worldExtent);
}
/* /*
=============== ===============
ProcessEntity ProcessEntity