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); }