From d881e58f625bb5514dc9ebec31ab8572340a21ed Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Sun, 18 Nov 2018 15:19:14 -1000 Subject: [PATCH] Fix COBBox::calculateAABox --- include/zeus/COBBox.hpp | 2 +- src/COBBox.cpp | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/include/zeus/COBBox.hpp b/include/zeus/COBBox.hpp index 9beda9f..76392e5 100644 --- a/include/zeus/COBBox.hpp +++ b/include/zeus/COBBox.hpp @@ -35,7 +35,7 @@ public: COBBox(const CTransform& xf, const CVector3f& extents) : transform(xf), extents(extents) {} - CAABox calculateAABox(const CTransform& transform = CTransform()) const; + CAABox calculateAABox(const CTransform& worldXf = CTransform()) const; static COBBox FromAABox(const CAABox& box, const CTransform& xf) { diff --git a/src/COBBox.cpp b/src/COBBox.cpp index 7e90dbe..958791d 100644 --- a/src/COBBox.cpp +++ b/src/COBBox.cpp @@ -3,15 +3,14 @@ namespace zeus { -CAABox COBBox::calculateAABox(const CTransform& transform) const +CAABox COBBox::calculateAABox(const CTransform& worldXf) const { CAABox ret = CAABox::skInvertedBox; - CTransform trans = transform * transform; + CTransform trans = worldXf * transform; static const CVector3f basis[8] = {{1.f, 1.f, 1.f}, {1.f, 1.f, -1.f}, {1.f, -1.f, 1.f}, {1.f, -1.f, -1.f}, {-1.f, -1.f, -1.f}, {-1.f, -1.f, 1.f}, {-1.f, 1.f, -1.f}, {-1.f, 1.f, 1.f}}; CVector3f p = extents * basis[0]; - ret.accumulateBounds(trans * p); p = extents * basis[1]; ret.accumulateBounds(trans * p);