qbsp: fix ConvertNodeToLeaf, move MakeMarkFaces

This commit is contained in:
Eric Wasylishen 2022-02-21 16:56:18 -07:00
parent cab51405d6
commit eee96576dc
2 changed files with 13 additions and 15 deletions

View File

@ -570,12 +570,6 @@ static void ProcessEntity(mapentity_t *entity, const int hullnum)
MakeVisibleFaces(entity, nodes);
// fixme-brushbsp: only here for testing, was inside FillOutside if()
MergeAll(nodes);
// needs to come after any face creation
MakeMarkFaces(entity, nodes);
// build all the portals in the bsp tree
// some portals are solid polygons, and some are paths to other leafs
if (entity == pWorldEnt()) {
@ -624,6 +618,9 @@ static void ProcessEntity(mapentity_t *entity, const int hullnum)
// convert detail leafs to solid (in case we didn't make the call above)
DetailToSolid(nodes);
// needs to come after any face creation
MakeMarkFaces(entity, nodes);
if (options.fObjExport && entity == pWorldEnt()) {
ExportObj_Nodes("pre_makefaceedges_plane_faces", nodes);
ExportObj_Marksurfaces("pre_makefaceedges_marksurfaces", nodes);

View File

@ -45,16 +45,17 @@ static int mapbrushes;
void ConvertNodeToLeaf(node_t *node, const contentflags_t &contents)
{
// backup the mins/maxs
aabb3d bounds = node->bounds;
// zero it
memset(node, 0, sizeof(*node));
// restore relevant fields
node->bounds = bounds;
node->planenum = PLANENUM_LEAF;
for (int i = 0; i < 2; ++i) {
delete node->children[i];
node->children[i] = nullptr;
}
for (auto *face : node->facelist) {
delete face;
}
node->facelist = {};
node->contents = contents;
Q_assert(node->markfaces.empty());