qbsp: import CreateVisPortals_r from qbsp3
This commit is contained in:
parent
65e6fafb3e
commit
1fb5753f60
|
|
@ -50,7 +50,13 @@ public:
|
|||
bool uses_detail;
|
||||
};
|
||||
|
||||
struct portalstats_t {
|
||||
std::atomic<int> c_tinyportals;
|
||||
};
|
||||
|
||||
contentflags_t ClusterContents(const node_t *node);
|
||||
void MakeNodePortal(node_t *node, portalstats_t &stats);
|
||||
void SplitNodePortals(node_t *node, portalstats_t &stats);
|
||||
void MakeTreePortals(tree_t *tree);
|
||||
void FreeTreePortals_r(node_t *node);
|
||||
void AssertNoPortals(node_t *node);
|
||||
|
|
|
|||
|
|
@ -262,10 +262,6 @@ std::optional<winding_t> BaseWindingForNode(node_t *node)
|
|||
return w;
|
||||
}
|
||||
|
||||
struct portalstats_t {
|
||||
std::atomic<int> c_tinyportals;
|
||||
};
|
||||
|
||||
/*
|
||||
==================
|
||||
MakeNodePortal
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@
|
|||
#include <fstream>
|
||||
#include <fmt/ostream.h>
|
||||
|
||||
#include "tbb/task_group.h"
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
|
|
@ -263,6 +265,27 @@ static void WritePortalfile(node_t *headnode, portal_state_t *state)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
CreateVisPortals_r
|
||||
================
|
||||
*/
|
||||
void CreateVisPortals_r(node_t *node, portalstats_t &stats)
|
||||
{
|
||||
// stop as soon as we get to a detail_seperator, which
|
||||
// means that everything below is in a single cluster
|
||||
if (node->planenum == PLANENUM_LEAF || node->detail_separator )
|
||||
return;
|
||||
|
||||
MakeNodePortal(node, stats);
|
||||
SplitNodePortals(node, stats);
|
||||
|
||||
tbb::task_group g;
|
||||
g.run([&]() { CreateVisPortals_r(node->children[0], stats); });
|
||||
g.run([&]() { CreateVisPortals_r(node->children[1], stats); });
|
||||
g.wait();
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
WritePortalFile
|
||||
|
|
|
|||
Loading…
Reference in New Issue