diff options
| author | elijah-thomas774 <elijahthomas774@gmail.com> | 2026-10-15 14:29:12 -0400 |
|---|---|---|
| committer | elijah-thomas774 <elijahthomas774@gmail.com> | 2026-10-15 14:32:29 -0400 |
| commit | 8be39579f62ece80fd77dba4cf9714bea1f1d2b4 (patch) | |
| tree | 011fa175c687df99297dc743f9934bf1dac08033 /src/d/d_area.cpp | |
| parent | 7c9b59ffedcad3655f98b55898d5f980c86792d9 (diff) | |
dArea_c + various cleanups in passing
Diffstat (limited to 'src/d/d_area.cpp')
| -rw-r--r-- | src/d/d_area.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/d/d_area.cpp b/src/d/d_area.cpp new file mode 100644 index 00000000..6e9929fa --- /dev/null +++ b/src/d/d_area.cpp @@ -0,0 +1,33 @@ +#include "d/d_area.h" + +#include "common.h" +#include "m/m_mtx.h" +#include "m/m_vec.h" +#include "rvl/MTX/mtx.h" + +void dArea_c::set(const mVec3_c &position, const mAng rotY, const mVec3_c &scale, mMtx_c *pSrc, f32 scaleTerm) { + mMtx_c src; + if (pSrc == nullptr) { + pSrc = &src; + } + pSrc->transS(position.x, position.y + scale.y * 0.5f, position.z); + pSrc->YrotM(rotY); + pSrc->scaleM(scale.x + scaleTerm, scale.y + scaleTerm, scale.z + scaleTerm); + mArea.copyFrom(*pSrc); + MTXInverse(mArea, mArea); +} + +bool dArea_c::checkAreaBox(const mVec3_c &position) { + mVec3_c pos; + mArea.multVec(position, pos); + return (-0.5f <= pos.x && pos.x <= 0.5f) && // + (-0.5f <= pos.y && pos.y <= 0.5f) && // + (-0.5f <= pos.z && pos.z <= 0.5f); +} + +bool dArea_c::checkAreaCyl(const mVec3_c &position) { + mVec3_c pos; + mArea.multVec(position, pos); + return (-0.5f <= pos.y && pos.y <= 0.5f) && // + pos.squareMagXZ() <= 1.0f; +} |
