From 4eebbd0bdd0621651cd3952591b4f52e37e8b497 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Sun, 21 Aug 2022 17:36:19 -0400 Subject: [PATCH] re-introduce qbsp3's "don't use clip brush sides as splitters" --- qbsp/brushbsp.cc | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/qbsp/brushbsp.cc b/qbsp/brushbsp.cc index b3135047..4f552734 100644 --- a/qbsp/brushbsp.cc +++ b/qbsp/brushbsp.cc @@ -1183,6 +1183,7 @@ struct brushbsp_input_stats_t : logging::stat_tracker_t stat &brushes = register_stat("brushes"); stat &faces = register_stat("visible faces"); stat &nonvis_faces = register_stat("non-visible faces"); + stat &clip_faces = register_stat("clip faces"); }; /* @@ -1255,6 +1256,19 @@ void BrushBSP(tree_t &tree, mapentity_t &entity, const bspbrush_t::container &br } } + // brushes that will not be visible at all will never be + // used as bsp splitters + // FIXME: should this be expanded to different things? should + // it figure out whether the side is skip as well? + if (b->contents.is_clip(qbsp_options.target_game)) { + for (side_t &side : b->sides) { + if (side.is_visible()) { + side.onnode = true; + stats.clip_faces++; + } + } + } + tree.bounds += b->bounds; } @@ -1359,20 +1373,10 @@ inline bspbrush_t::list SubtractBrush(const bspbrush_t::ptr &a, const bspbrush_t return out; } -struct chopstats_t +struct chopstats_t : logging::stat_tracker_t { - size_t c_swallowed = 0; // number of brushes completely swallowed - size_t c_from_split = 0; // number of new brushes created from being consumed - - ~chopstats_t() - { - if (c_swallowed) { - logging::print(logging::flag::STAT, " {:8} brushes swallowed\n", c_swallowed); - } - if (c_from_split) { - logging::print(logging::flag::STAT, " {:8} brushes created from the chompening\n", c_from_split); - } - } + stat &c_swallowed = register_stat("brushes swallowed"); + stat &c_from_split = register_stat("brushes created from the chompening"); }; /*