qbsp: isolate portal_state_t in prtfile.cc
This commit is contained in:
parent
1fb5753f60
commit
214a2550f4
|
|
@ -40,16 +40,6 @@ struct tree_t
|
|||
aabb3d bounds;
|
||||
};
|
||||
|
||||
class portal_state_t
|
||||
{
|
||||
public:
|
||||
int num_visportals;
|
||||
int num_visleafs; // leafs the player can be in
|
||||
int num_visclusters; // clusters of leafs
|
||||
int iNodesDone;
|
||||
bool uses_detail;
|
||||
};
|
||||
|
||||
struct portalstats_t {
|
||||
std::atomic<int> c_tinyportals;
|
||||
};
|
||||
|
|
@ -61,4 +51,4 @@ void MakeTreePortals(tree_t *tree);
|
|||
void FreeTreePortals_r(node_t *node);
|
||||
void AssertNoPortals(node_t *node);
|
||||
void MakeHeadnodePortals(tree_t *tree);
|
||||
void CutNodePortals_r(node_t *node, portal_state_t *state);
|
||||
void CutNodePortals_r(node_t *node);
|
||||
|
|
|
|||
|
|
@ -473,7 +473,7 @@ void MakeTreePortals_new(tree_t *tree)
|
|||
CutNodePortals_r
|
||||
================
|
||||
*/
|
||||
void CutNodePortals_r(node_t *node, portal_state_t *state)
|
||||
void CutNodePortals_r(node_t *node)
|
||||
{
|
||||
node_t *front, *back, *other_node;
|
||||
portal_t *portal, *new_portal, *next_portal;
|
||||
|
|
@ -584,11 +584,8 @@ void CutNodePortals_r(node_t *node, portal_state_t *state)
|
|||
}
|
||||
}
|
||||
|
||||
/* Display progress */
|
||||
logging::percent(state->iNodesDone++, splitnodes);
|
||||
|
||||
CutNodePortals_r(front, state);
|
||||
CutNodePortals_r(back, state);
|
||||
CutNodePortals_r(front);
|
||||
CutNodePortals_r(back);
|
||||
}
|
||||
|
||||
void AssertNoPortals(node_t *node)
|
||||
|
|
@ -610,15 +607,11 @@ Builds the exact polyhedrons for the nodes and leafs
|
|||
*/
|
||||
void MakeTreePortals(tree_t *tree)
|
||||
{
|
||||
portal_state_t state{};
|
||||
|
||||
state.iNodesDone = 0;
|
||||
|
||||
FreeTreePortals_r(tree->headnode);
|
||||
|
||||
AssertNoPortals(tree->headnode);
|
||||
MakeHeadnodePortals(tree);
|
||||
CutNodePortals_r(tree->headnode, &state);
|
||||
CutNodePortals_r(tree->headnode);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -147,6 +147,14 @@ static int WriteClusters_r(node_t *node, std::ofstream &portalFile, int visclust
|
|||
return viscluster;
|
||||
}
|
||||
|
||||
struct portal_state_t
|
||||
{
|
||||
int num_visportals;
|
||||
int num_visleafs; // leafs the player can be in
|
||||
int num_visclusters; // clusters of leafs
|
||||
bool uses_detail;
|
||||
};
|
||||
|
||||
static void CountPortals(const node_t *node, portal_state_t *state)
|
||||
{
|
||||
const portal_t *portal;
|
||||
|
|
@ -297,14 +305,12 @@ void WritePortalFile(tree_t *tree)
|
|||
|
||||
portal_state_t state{};
|
||||
|
||||
state.iNodesDone = 0;
|
||||
|
||||
FreeTreePortals_r(tree->headnode);
|
||||
|
||||
AssertNoPortals(tree->headnode);
|
||||
MakeHeadnodePortals(tree);
|
||||
|
||||
CutNodePortals_r(tree->headnode, &state);
|
||||
CutNodePortals_r(tree->headnode);
|
||||
|
||||
/* save portal file for vis tracing */
|
||||
WritePortalfile(tree->headnode, &state);
|
||||
|
|
|
|||
Loading…
Reference in New Issue