qbsp: add -debugleafvolumes
This commit is contained in:
parent
a926e5c397
commit
c90c16ee45
|
|
@ -98,6 +98,7 @@ enum tree_split_t
|
||||||
FAST
|
FAST
|
||||||
};
|
};
|
||||||
|
|
||||||
|
vec_t BrushVolume(const bspbrush_t &brush);
|
||||||
bspbrush_t::ptr BrushFromBounds(const aabb3d &bounds);
|
bspbrush_t::ptr BrushFromBounds(const aabb3d &bounds);
|
||||||
void BrushBSP(tree_t &tree, mapentity_t &entity, const bspbrush_t::container &brushes, tree_split_t split_type);
|
void BrushBSP(tree_t &tree, mapentity_t &entity, const bspbrush_t::container &brushes, tree_split_t split_type);
|
||||||
void ChopBrushes(bspbrush_t::container &brushes, bool allow_fragmentation);
|
void ChopBrushes(bspbrush_t::container &brushes, bool allow_fragmentation);
|
||||||
|
|
@ -366,6 +366,8 @@ public:
|
||||||
setting_bool debugleak{this, "debugleak", false, &debugging_group, "write more diagnostic files for debugging leaks"};
|
setting_bool debugleak{this, "debugleak", false, &debugging_group, "write more diagnostic files for debugging leaks"};
|
||||||
setting_bool debugbspbrushes{
|
setting_bool debugbspbrushes{
|
||||||
this, "debugbspbrushes", false, &debugging_group, "save bsp brushes after BrushBSP to a .map, for visualizing BSP splits"};
|
this, "debugbspbrushes", false, &debugging_group, "save bsp brushes after BrushBSP to a .map, for visualizing BSP splits"};
|
||||||
|
setting_bool debugleafvolumes{this, "debugleafvolumes", false, &debugging_group,
|
||||||
|
"save bsp leaf volumes after BrushBSP to a .map, for visualizing BSP splits"};
|
||||||
setting_debugexpand debugexpand{this, "debugexpand", &debugging_group, "write expanded hull .map for debugging/inspecting hulls/brush bevelling"};
|
setting_debugexpand debugexpand{this, "debugexpand", &debugging_group, "write expanded hull .map for debugging/inspecting hulls/brush bevelling"};
|
||||||
setting_bool keepprt{this, "keepprt", false, &debugging_group, "avoid deleting the .prt file on leaking maps"};
|
setting_bool keepprt{this, "keepprt", false, &debugging_group, "avoid deleting the .prt file on leaking maps"};
|
||||||
setting_bool includeskip{this, "includeskip", false, &common_format_group,
|
setting_bool includeskip{this, "includeskip", false, &common_format_group,
|
||||||
|
|
|
||||||
|
|
@ -152,6 +152,11 @@ static vec_t BrushVolume(T begin, T end)
|
||||||
return volume;
|
return volume;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vec_t BrushVolume(const bspbrush_t &brush)
|
||||||
|
{
|
||||||
|
return BrushVolume(brush.sides.begin(), brush.sides.end());
|
||||||
|
}
|
||||||
|
|
||||||
//========================================================
|
//========================================================
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -554,7 +559,7 @@ static twosided<bspbrush_t::ptr> SplitBrush(bspbrush_t::ptr brush, size_t planen
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
vec_t v1 = BrushVolume(result[i]->sides.begin(), result[i]->sides.end());
|
vec_t v1 = BrushVolume(*result[i]);
|
||||||
if (v1 < qbsp_options.microvolume.value()) {
|
if (v1 < qbsp_options.microvolume.value()) {
|
||||||
result[i] = nullptr;
|
result[i] = nullptr;
|
||||||
if (stats) {
|
if (stats) {
|
||||||
|
|
|
||||||
41
qbsp/qbsp.cc
41
qbsp/qbsp.cc
|
|
@ -402,6 +402,17 @@ static void GatherBspbrushes_r(node_t *node, bspbrush_t::container &container)
|
||||||
GatherBspbrushes_r(node->children[1], container);
|
GatherBspbrushes_r(node->children[1], container);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void GatherLeafVolumes_r(node_t *node, bspbrush_t::container &container)
|
||||||
|
{
|
||||||
|
if (node->is_leaf) {
|
||||||
|
container.push_back(node->volume);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GatherLeafVolumes_r(node->children[0], container);
|
||||||
|
GatherLeafVolumes_r(node->children[1], container);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
===============
|
===============
|
||||||
ProcessEntity
|
ProcessEntity
|
||||||
|
|
@ -529,10 +540,17 @@ static void ProcessEntity(mapentity_t &entity, hull_index_t hullnum)
|
||||||
|
|
||||||
if (map.is_world_entity(entity)) {
|
if (map.is_world_entity(entity)) {
|
||||||
// debug output of bspbrushes
|
// debug output of bspbrushes
|
||||||
if (qbsp_options.debugbspbrushes.value() && (!hullnum.has_value() || hullnum.value() == 0)) {
|
if (!hullnum.has_value() || hullnum.value() == 0) {
|
||||||
bspbrush_t::container all_bspbrushes;
|
if (qbsp_options.debugbspbrushes.value()) {
|
||||||
GatherBspbrushes_r(tree.headnode, all_bspbrushes);
|
bspbrush_t::container all_bspbrushes;
|
||||||
WriteBspBrushMap("first-brushbsp", all_bspbrushes);
|
GatherBspbrushes_r(tree.headnode, all_bspbrushes);
|
||||||
|
WriteBspBrushMap("first-brushbsp", all_bspbrushes);
|
||||||
|
}
|
||||||
|
if (qbsp_options.debugleafvolumes.value()) {
|
||||||
|
bspbrush_t::container all_bspbrushes;
|
||||||
|
GatherLeafVolumes_r(tree.headnode, all_bspbrushes);
|
||||||
|
WriteBspBrushMap("first-brushbsp-volumes", all_bspbrushes);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// flood fills from the void.
|
// flood fills from the void.
|
||||||
|
|
@ -545,10 +563,17 @@ static void ProcessEntity(mapentity_t &entity, hull_index_t hullnum)
|
||||||
BrushBSP(tree, entity, brushes, tree_split_t::PRECISE);
|
BrushBSP(tree, entity, brushes, tree_split_t::PRECISE);
|
||||||
|
|
||||||
// debug output of bspbrushes
|
// debug output of bspbrushes
|
||||||
if (qbsp_options.debugbspbrushes.value() && (!hullnum.has_value() || hullnum.value() == 0)) {
|
if (!hullnum.has_value() || hullnum.value() == 0) {
|
||||||
bspbrush_t::container all_bspbrushes;
|
if (qbsp_options.debugbspbrushes.value()) {
|
||||||
GatherBspbrushes_r(tree.headnode, all_bspbrushes);
|
bspbrush_t::container all_bspbrushes;
|
||||||
WriteBspBrushMap("second-brushbsp", all_bspbrushes);
|
GatherBspbrushes_r(tree.headnode, all_bspbrushes);
|
||||||
|
WriteBspBrushMap("second-brushbsp", all_bspbrushes);
|
||||||
|
}
|
||||||
|
if (qbsp_options.debugleafvolumes.value()) {
|
||||||
|
bspbrush_t::container all_bspbrushes;
|
||||||
|
GatherLeafVolumes_r(tree.headnode, all_bspbrushes);
|
||||||
|
WriteBspBrushMap("second-brushbsp-volumes", all_bspbrushes);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// make the real portals for vis tracing
|
// make the real portals for vis tracing
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue