[PATCH] qbsp: select better non-axial split planes
Make ChooseMidPlaneFromList a bit more picky about the non-axial planes it selects. This can matter a lot for maps which have a lot of non-axial-aligned brushwork (e.g. terrain, etc.) The number of clipnodes can skyrocket if planes are not chosen with at least a small amount of care. Signed-off-by: Tyrann <tyrann@disenchant.net>
This commit is contained in:
parent
00132a9ff0
commit
5a4499dc48
|
|
@ -243,11 +243,21 @@ ChooseMidPlaneFromList(surface_t *surfaces, vec3_t mins, vec3_t maxs)
|
|||
}
|
||||
|
||||
if (!bestsurface) {
|
||||
for (p = surfaces; p; p = p->next)
|
||||
if (!p->onnode)
|
||||
return p; // first valid surface
|
||||
Message(msgError, errNoValidPlanes);
|
||||
/* Choose based on spatial subdivision again */
|
||||
for (p = surfaces; p; p = p->next) {
|
||||
if (p->onnode)
|
||||
continue;
|
||||
|
||||
plane = &pPlanes[p->planenum];
|
||||
value = SplitPlaneMetric(plane, mins, maxs);
|
||||
if (value < bestvalue) {
|
||||
bestvalue = value;
|
||||
bestsurface = p;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!bestsurface)
|
||||
Message(msgError, errNoValidPlanes);
|
||||
|
||||
return bestsurface;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue