2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-09 09:47:43 +00:00

CCollisionSurface: Collapse separate CVector3f instances into std::array

Will allow converting GetVertices() over to returning a reference to
std::array, rather than simply a pointer.
This commit is contained in:
Lioncash
2020-04-06 05:54:21 -04:00
parent 41c2ede092
commit ecf3cfdb49
2 changed files with 10 additions and 10 deletions

View File

@@ -5,16 +5,16 @@
namespace urde {
CCollisionSurface::CCollisionSurface(const zeus::CVector3f& a, const zeus::CVector3f& b, const zeus::CVector3f& c,
u32 flags)
: x0_a(a), xc_b(b), x18_c(c), x24_flags(flags) {}
: x0_data{a, b, c}, x24_flags(flags) {}
zeus::CVector3f CCollisionSurface::GetNormal() const {
zeus::CVector3f v1 = (xc_b - x0_a).cross(x18_c - x0_a);
const zeus::CVector3f v1 = (x0_data[1] - x0_data[0]).cross(x0_data[2] - x0_data[0]);
return zeus::CUnitVector3f(v1, true);
}
zeus::CPlane CCollisionSurface::GetPlane() const {
zeus::CVector3f norm = GetNormal();
return {norm, norm.dot(x0_a)};
const zeus::CVector3f norm = GetNormal();
return {norm, norm.dot(x0_data[0])};
}
} // namespace urde