mirror of https://github.com/AxioDL/zeus.git
Fix COBBox::calculateAABox
This commit is contained in:
parent
a427e0a8a2
commit
d881e58f62
|
@ -35,7 +35,7 @@ public:
|
||||||
|
|
||||||
COBBox(const CTransform& xf, const CVector3f& extents) : transform(xf), extents(extents) {}
|
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)
|
static COBBox FromAABox(const CAABox& box, const CTransform& xf)
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,15 +3,14 @@
|
||||||
namespace zeus
|
namespace zeus
|
||||||
{
|
{
|
||||||
|
|
||||||
CAABox COBBox::calculateAABox(const CTransform& transform) const
|
CAABox COBBox::calculateAABox(const CTransform& worldXf) const
|
||||||
{
|
{
|
||||||
CAABox ret = CAABox::skInvertedBox;
|
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},
|
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}};
|
{-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];
|
CVector3f p = extents * basis[0];
|
||||||
|
|
||||||
ret.accumulateBounds(trans * p);
|
ret.accumulateBounds(trans * p);
|
||||||
p = extents * basis[1];
|
p = extents * basis[1];
|
||||||
ret.accumulateBounds(trans * p);
|
ret.accumulateBounds(trans * p);
|
||||||
|
|
Loading…
Reference in New Issue