diff options
| author | TakaRikka <takarikka@outlook.com> | 2022-10-04 21:17:53 -0700 |
|---|---|---|
| committer | TakaRikka <takarikka@outlook.com> | 2022-10-04 21:17:53 -0700 |
| commit | 74c248990c5cc991aff8f119efd8b733770178a7 (patch) | |
| tree | 6f44f0e2711ebc8e59f3780ea78fe2ba89c452bd /include/JSystem/JGeometry.h | |
| parent | a3578d0c7c64b11258260bee1148d33195542c4f (diff) | |
move jasper's jsystem work over
Diffstat (limited to 'include/JSystem/JGeometry.h')
| -rw-r--r-- | include/JSystem/JGeometry.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/include/JSystem/JGeometry.h b/include/JSystem/JGeometry.h index 42e505a7b5..6eb88b0279 100644 --- a/include/JSystem/JGeometry.h +++ b/include/JSystem/JGeometry.h @@ -20,6 +20,18 @@ struct TVec3 { }; template <> +struct TVec3<s16> { + s16 x, y, z; + + TVec3& operator=(const TVec3& b) { + // Force copies to use lwz/lha + *((s32*)this) = *((s32*)&b); + z = b.z; + return *this; + } +}; + +template <> struct TVec3<f32> { f32 x; f32 y; @@ -47,6 +59,20 @@ struct TVec3<f32> { y = a.y * b.y; z = a.z * b.z; } + + inline TVec3<f32>& operator=(const TVec3<f32>& b) { + register f32* dst = &x; + const register f32* src = &b.x; + register f32 x_y; + register f32 z; + asm { + psq_l x_y, 0(src), 0, 0 + psq_st x_y, 0(dst), 0, 0 + lfs z, 8(src) + stfs z, 8(dst) + }; + return *this; + } }; template <typename T> |
