From 20ca6d2ef9617ecc6095415aa8aedfb4de55fb0f Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Tue, 5 Jul 2022 00:20:57 -0600 Subject: [PATCH] qbsp: add sphere bounds for bspbrush_t --- include/qbsp/brush.hh | 3 +++ qbsp/brush.cc | 3 +++ 2 files changed, 6 insertions(+) diff --git a/include/qbsp/brush.hh b/include/qbsp/brush.hh index 86ebacb4..cb1f0e6d 100644 --- a/include/qbsp/brush.hh +++ b/include/qbsp/brush.hh @@ -68,6 +68,9 @@ struct bspbrush_t { std::optional outputnumber; /* only set for original brushes */ mapentity_t *func_areaportal; + qvec3d sphere_origin; + double sphere_radius; + void update_bounds(); std::unique_ptr copy_unique() const; diff --git a/qbsp/brush.cc b/qbsp/brush.cc index 6f5b8d50..13e81727 100644 --- a/qbsp/brush.cc +++ b/qbsp/brush.cc @@ -1096,4 +1096,7 @@ void bspbrush_t::update_bounds() for (const auto &face : sides) { this->bounds = this->bounds.unionWith(face.w.bounds()); } + + this->sphere_origin = (bounds.mins() + bounds.maxs()) / 2.0; + this->sphere_radius = qv::length((bounds.maxs() - bounds.mins()) / 2.0); }