qbsp: add sphere bounds for bspbrush_t

This commit is contained in:
Eric Wasylishen 2022-07-05 00:20:57 -06:00
parent f4854ddb20
commit 20ca6d2ef9
2 changed files with 6 additions and 0 deletions

View File

@ -68,6 +68,9 @@ struct bspbrush_t {
std::optional<uint32_t> outputnumber; /* only set for original brushes */
mapentity_t *func_areaportal;
qvec3d sphere_origin;
double sphere_radius;
void update_bounds();
std::unique_ptr<bspbrush_t> copy_unique() const;

View File

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