diff options
| author | Jasper St. Pierre <jstpierre@mecheye.net> | 2023-09-30 16:59:17 -0700 |
|---|---|---|
| committer | Jasper St. Pierre <jstpierre@mecheye.net> | 2023-09-30 16:59:17 -0700 |
| commit | c983ef2106cbbedea128471841ec2ed90a2a69ad (patch) | |
| tree | e9a68fa8ca048ef774d29453abfac74fe36b06af /include/JSystem | |
| parent | d06e54362d821eba80a7defb2d1eb7c17d11b1b5 (diff) | |
JPAMath start
Diffstat (limited to 'include/JSystem')
| -rw-r--r-- | include/JSystem/JGeometry.h | 16 | ||||
| -rw-r--r-- | include/JSystem/JMath/JMath.h | 2 | ||||
| -rw-r--r-- | include/JSystem/JParticle/JPAMath.h | 16 |
3 files changed, 19 insertions, 15 deletions
diff --git a/include/JSystem/JGeometry.h b/include/JSystem/JGeometry.h index ac4857ec..a8afb2d5 100644 --- a/include/JSystem/JGeometry.h +++ b/include/JSystem/JGeometry.h @@ -151,10 +151,10 @@ struct TVec3<f32> { return C_VECSquareMag((Vec*)&x); } - void normalize() { + f32 normalize() { f32 sq = squared(); if (sq <= FLT_EPSILON * 32.0f) { - return; + return 0.0f; } f32 norm; if (sq <= 0.0f) { @@ -162,14 +162,15 @@ struct TVec3<f32> { } else { norm = fsqrt_step(sq); } - scale(norm); + scale(1.0f / norm); + return norm; } - void normalize(const TVec3<f32>& other) { + f32 normalize(const TVec3<f32>& other) { f32 sq = other.squared(); if (sq <= FLT_EPSILON * 32.0f) { zero(); - return; + return 0.0f; } f32 norm; if (sq <= 0.0f) { @@ -177,7 +178,8 @@ struct TVec3<f32> { } else { norm = fsqrt_step(sq); } - scale(norm, other); + scale(1.0f / norm, other); + return norm; } f32 length() const { @@ -249,7 +251,7 @@ struct TVec3<f32> { void cross(const TVec3<f32>& a, const TVec3<f32>& b) { VECCrossProduct(a, b, *this); } - + void setLength(f32 len) { f32 sq = squared(); if (sq <= FLT_EPSILON * 32.0f) { diff --git a/include/JSystem/JMath/JMath.h b/include/JSystem/JMath/JMath.h index fac4d5b4..4de6b86a 100644 --- a/include/JSystem/JMath/JMath.h +++ b/include/JSystem/JMath/JMath.h @@ -118,4 +118,6 @@ inline void gekko_ps_copy16(register void* dst, register const void* src) { }; // namespace JMath +f32 JMAHermiteInterpolation(f32, f32, f32, f32, f32, f32, f32); + #endif /* JMATH_H */ diff --git a/include/JSystem/JParticle/JPAMath.h b/include/JSystem/JParticle/JPAMath.h index 93bf3b3f..51d4fbe5 100644 --- a/include/JSystem/JParticle/JPAMath.h +++ b/include/JSystem/JParticle/JPAMath.h @@ -4,13 +4,13 @@ #include "JSystem/JGeometry.h" #include "dolphin/types.h" -void JPAGetYZRotateMtx(short, short, float(*)[4]); -void JPAGetXYZRotateMtx(short, short, short, float(*)[4]); -void JPAGetDirMtx(const JGeometry::TVec3<float>&, float(*)[4]); -void JPASetSVecfromMtx(float(*)[4], JGeometry::TVec3<float>&); -void JPASetRMtxTVecfromMtx(float(*)[4], float(*)[4], JGeometry::TVec3<float>&); -void JPASetRMtxSTVecfromMtx(float(*)[4], float(*)[4], JGeometry::TVec3<float>&, JGeometry::TVec3<float>&); -void JPAGetKeyFrameValue(float, unsigned short, const float*); -void JPAGetUnitVec(short, short, JGeometry::TVec3<float>&); +void JPAGetYZRotateMtx(s16, s16, f32(*)[4]); +void JPAGetXYZRotateMtx(s16, s16, s16, f32(*)[4]); +void JPAGetDirMtx(const JGeometry::TVec3<f32>&, f32(*)[4]); +void JPASetSVecfromMtx(f32(*)[4], JGeometry::TVec3<f32>&); +void JPASetRMtxTVecfromMtx(f32(*)[4], f32(*)[4], JGeometry::TVec3<f32>&); +void JPASetRMtxSTVecfromMtx(f32(*)[4], f32(*)[4], JGeometry::TVec3<f32>&, JGeometry::TVec3<f32>&); +f32 JPAGetKeyFrameValue(f32, u16, const f32*); +void JPAGetUnitVec(s16, s16, JGeometry::TVec3<f32>&); #endif /* JPAMATH_H */ |
