refactor: remove heap-allocated AABBs

This commit is contained in:
orng
2026-03-28 02:58:56 -05:00
parent e48a05bb8f
commit 7101d03c6a
88 changed files with 353 additions and 387 deletions

View File

@@ -27,7 +27,7 @@ Throwable::Throwable(Level* level) : Entity(level) {
void Throwable::defineSynchedData() {}
bool Throwable::shouldRenderAtSqrDistance(double distance) {
double size = bb->getSize() * 4;
double size = bb.getSize() * 4;
size *= 64.0f;
return distance < size * size;
}
@@ -147,7 +147,7 @@ void Throwable::tick() {
if (!level->isClientSide) {
std::shared_ptr<Entity> hitEntity = nullptr;
AABB grown = bb->expand(xd, yd, zd).grow(1, 1, 1);
AABB grown = bb.expand(xd, yd, zd).grow(1, 1, 1);
std::vector<std::shared_ptr<Entity> >* objects =
level->getEntities(shared_from_this(), &grown);
double nearest = 0;
@@ -157,7 +157,7 @@ void Throwable::tick() {
if (!e->isPickable() || (e == owner && flightTime < 5)) continue;
float rr = 0.3f;
AABB bb = e->bb->grow(rr, rr, rr);
AABB bb = e->bb.grow(rr, rr, rr);
HitResult* p = bb.clip(from, to);
if (p != NULL) {
double dd = from.distanceTo(p->pos);