diff --git a/include/qbsp/brush.hh b/include/qbsp/brush.hh index ab34182a..737c1be3 100644 --- a/include/qbsp/brush.hh +++ b/include/qbsp/brush.hh @@ -73,7 +73,7 @@ struct bspbrush_t qvec3d sphere_origin; double sphere_radius; - bool update_bounds(); + bool update_bounds(bool warn_on_failures); std::unique_ptr copy_unique() const; }; diff --git a/qbsp/brush.cc b/qbsp/brush.cc index ab8faae8..3da0e576 100644 --- a/qbsp/brush.cc +++ b/qbsp/brush.cc @@ -246,7 +246,7 @@ bool CreateBrushWindings(bspbrush_t *brush) } } - return brush->update_bounds(); + return brush->update_bounds(true); } /* @@ -578,7 +578,7 @@ void Brush_LoadEntity(mapentity_t *entity, const int hullnum, bspbrush_vector_t qbsp_options.target_game->print_content_stats(*stats, "brushes"); } -bool bspbrush_t::update_bounds() +bool bspbrush_t::update_bounds(bool warn_on_failures) { this->bounds = {}; @@ -591,11 +591,15 @@ bool bspbrush_t::update_bounds() for (size_t i = 0; i < 3; i++) { // todo: map_source_location in bspbrush_t if (this->bounds.mins()[0] <= -qbsp_options.worldextent.value() || this->bounds.maxs()[0] >= qbsp_options.worldextent.value()) { - logging::print("WARNING: {}: brush bounds out of range\n", mapbrush ? mapbrush->line : parser_source_location()); + if (warn_on_failures) { + logging::print("WARNING: {}: brush bounds out of range\n", mapbrush ? mapbrush->line : parser_source_location()); + } return false; } if (this->bounds.mins()[0] >= qbsp_options.worldextent.value() || this->bounds.maxs()[0] <= -qbsp_options.worldextent.value()) { - logging::print("WARNING: {}: no visible sides on brush\n", mapbrush ? mapbrush->line : parser_source_location()); + if (warn_on_failures) { + logging::print("WARNING: {}: no visible sides on brush\n", mapbrush ? mapbrush->line : parser_source_location()); + } return false; } } diff --git a/qbsp/brushbsp.cc b/qbsp/brushbsp.cc index 7bd58ebc..3785f2d2 100644 --- a/qbsp/brushbsp.cc +++ b/qbsp/brushbsp.cc @@ -527,14 +527,18 @@ static twosided> SplitBrush(std::unique_ptrupdate_bounds(); - bool bogus = false; - for (int j = 0; j < 3; j++) { - if (result[i]->bounds.mins()[j] < -qbsp_options.worldextent.value() || result[i]->bounds.maxs()[j] > qbsp_options.worldextent.value()) { - stats.c_bogus++; - bogus = true; - break; + + if (!result[i]->update_bounds(false)) { + stats.c_bogus++; + bogus = true; + } else { + for (int j = 0; j < 3; j++) { + if (result[i]->bounds.mins()[j] < -qbsp_options.worldextent.value() || result[i]->bounds.maxs()[j] > qbsp_options.worldextent.value()) { + stats.c_bogus++; + bogus = true; + break; + } } } @@ -1035,8 +1039,6 @@ static std::unique_ptr BrushBSP_internal(mapentity_t *entity, std::vecto { auto tree = std::make_unique(); - logging::funcheader(); - size_t c_faces = 0; size_t c_nonvisfaces = 0; size_t c_brushes = 0; @@ -1142,5 +1144,6 @@ static std::unique_ptr BrushBSP_internal(mapentity_t *entity, std::vecto std::unique_ptr BrushBSP(mapentity_t *entity, const std::vector> &brushlist, std::optional forced_quick_tree) { + logging::funcheader(); return BrushBSP_internal(entity, MakeBspBrushList(brushlist), forced_quick_tree); } \ No newline at end of file