sys_matrix OK, documented, rename some other mathematics functions (#787)

* Import data and bss, add some name options

* Decomp rest of stack functions,
remove RSPMatrix,
split header

* sys_matrix OK (thanks Tharo)

Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com>

* pragma weaks in sinf and cosf, change documentation
change mcros to use 0x8000

* Rename sinf and cosf

* Correct initialisation of sMtxFClear

* More minor cleanup

* Rename stack functions

* Matrix_InsertMatrix -> Matrix_Mult

* The big transpose rename

* Fix MirRay_DrawReflectedBeam

* Matrix_InsertTranslation -> Matrix_Translate

* Matrix_Insert.Rotation_s -> Matrix_Rotate$1S
+ RotateY -> RotateYS

* Matrix_Insert(.)Rotation_f -> Matrix_Rotate$1F

* Matrix_RotateStateAroundXAxis -> Matrix_RotateXFApply
Matrix_SetStateXRotation -> Matrix_RotateXFNew

* Matrix_MultiplyVector3fByState -> Matrix_MultVec3f

* Matrix_MultiplyVector3fXZByCurrentState -> Matrix_MultVec3fXZ

* Matrix_GetStateTranslation -> Matrix_MultZero

* Matrix_GetStateTranslationAndScaled(.) -> Matrix_MultVec$1

* Matrix_FromRSPMatrix -> Matrix_MtxToMtxF

* Matrix_MultiplyVector3fByMatrix -> Matrix_MultVec3fExt

* Matrix_TransposeXYZ -> Matrix_Transpose

* Matrix_ToRSPMatrix -> Matrix_MtxFToMtx

* Matrix_AppendToPolyOpaDisp -> Matrix_MtxFToNewMtx
and document the conversion functions

* Matrix_NormalizeXYZ -> Matrix_ReplaceRotation

* Matrix_InsertRotationAroundUnitVector_f -> Matrix_RotateAxisF and S

* Matrix_InsertRotation -> Matrix_RotateZYX

* Document the last functions

* Small cleanup

* Matrix_JointPosition -> Matrix_TranslateRotateZYX

* Matrix_SetStateRotationAndTranslation -> Matrix_SetTranslateRotateYXZ

* func_8018219C -> Matrix_MtxFToYXZRot

* func_801822C4 -> Matrix_MtxFToZYXRot

* Fix files

* Format

* Review 1

* Renames

* Fix warning in EnDragon

* Format

* Convert `mode` to an actual enum

* Add enums, typedefs, externs to sys_matrix header

* Review

* One more

* More review

* Fix function names

* Format

* Fix names

* Format

* Review

* engineer's review

* Fix build

* Format

* Fix again

Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com>
This commit is contained in:
EllipticEllipsis
2022-05-26 04:24:39 +01:00
committed by GitHub
parent e1477702ca
commit 8049dec339
303 changed files with 5474 additions and 3324 deletions
+5 -46
View File
@@ -148,8 +148,8 @@ void GfxPrint_Open(GfxPrint* printer, Gfx* dList);
Gfx* GfxPrint_Close(GfxPrint* printer);
s32 GfxPrint_VPrintf(GfxPrint* printer, const char* fmt, va_list args);
s32 GfxPrint_Printf(GfxPrint* printer, const char* fmt, ...);
void MtxConv_F2L(MatrixInternal* m1, MtxF* m2);
void MtxConv_L2F(MtxF* m1, MatrixInternal* m2);
void MtxConv_F2L(Mtx* m1, MtxF* m2);
void MtxConv_L2F(MtxF* m1, Mtx* m2);
void __assert(const char* file, u32 lineNum);
// void func_800862B4(void);
void* SystemArena_MallocMin1(u32 size);
@@ -220,7 +220,7 @@ OSIntMask osSetIntMask(OSIntMask im);
// OSIntMask osGetIntMask(void);
// void osVoiceSetWord(void);
// void guScale(void);
f32 __sinf(f32 __x);
f32 sinf(f32 __x);
s16 sins(u16 x);
OSTask* _VirtualToPhysicalTask(OSTask* intp);
void osSpTaskLoad(OSTask* intp);
@@ -377,7 +377,7 @@ void __osRestoreInt(OSIntMask im);
void __osViInit(void);
void __osViSwapContext(void);
OSMesgQueue* osPiGetCmdQueue(void);
f32 __cosf(f32 __x);
f32 cosf(f32 __x);
s32 osEPiReadIo(OSPiHandle* pihandle, u32 devAddr, u32* data);
void osViSetSpecialFeatures(u32 func);
s16 coss(u16 x);
@@ -3072,53 +3072,12 @@ s32 Math3D_XYInSphere(Sphere16* sphere, f32 x, f32 y);
s32 Math3D_YZInSphere(Sphere16* sphere, f32 y, f32 z);
// void func_8017FB1C(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE4 param_8, UNK_TYPE4 param_9, UNK_TYPE4 param_10, UNK_TYPE4 param_11);
// void func_8017FD44(void);
u16 Math_GetAtan2Tbl(f32 opposite, f32 adjacent);
s16 Math_Atan2S(f32 opposite, f32 adjacent);
f32 Math_Atan2F(f32 opposite, f32 adjacent);
s16 Math_FAtan2F(f32 adjacent, f32 opposite);
f32 Math_Acot2F(f32 adjacent, f32 opposite);
void Matrix_StateAlloc(GameState* gameState);
void Matrix_StatePush(void);
void Matrix_StatePop(void);
void Matrix_CopyCurrentState(MtxF* matrix);
void Matrix_SetCurrentState(MtxF* matrix);
MtxF* Matrix_GetCurrentState(void);
void Matrix_InsertMatrix(MtxF* matrix, s32 appendToState);
void Matrix_InsertTranslation(f32 x, f32 y, f32 z, s32 appendToState);
void Matrix_Scale(f32 xScale, f32 yScale, f32 zScale, s32 appendToState);
void Matrix_InsertXRotation_s(s16 rotation, s32 appendToState);
void Matrix_InsertXRotation_f(f32 rotation, s32 appendToState);
void Matrix_RotateStateAroundXAxis(f32 rotation);
void Matrix_SetStateXRotation(f32 rotation);
void Matrix_RotateY(s16 rotation, s32 appendToState);
void Matrix_InsertYRotation_f(f32 rotation, s32 appendToState);
void Matrix_InsertZRotation_s(s16 rotation, s32 appendToState);
void Matrix_InsertZRotation_f(f32 rotation, s32 appendToState);
void Matrix_InsertRotation(s16 xRotation, s16 yRotation, s16 zRotation, s32 appendToState);
void Matrix_JointPosition(Vec3f* position, Vec3s* rotation);
void Matrix_RotateAndTranslateState(Vec3f* translation, Vec3s* rotation);
void Matrix_SetStateRotationAndTranslation(f32 x, f32 y, f32 z, Vec3s* rotation);
RSPMatrix* Matrix_ToRSPMatrix(MtxF* src, RSPMatrix* dst);
Mtx* Matrix_ToMtx(Mtx* dest);
RSPMatrix* Matrix_GetStateAsRSPMatrix(RSPMatrix* matrix);
Mtx* Matrix_NewMtx(GraphicsContext* gfxCtx);
RSPMatrix* Matrix_AppendStateToPolyOpaDisp(GraphicsContext* gfxCtx);
void Matrix_AppendToPolyOpaDisp(MtxF* mtx, GraphicsContext* gfxCtx);
void Matrix_MultiplyVector3fByState(Vec3f* src, Vec3f* dst);
void Matrix_GetStateTranslation(Vec3f* dst);
void Matrix_GetStateTranslationAndScaledX(f32 scale, Vec3f* dst);
void Matrix_GetStateTranslationAndScaledY(f32 scale, Vec3f* dst);
void Matrix_GetStateTranslationAndScaledZ(f32 scale, Vec3f* dst);
void Matrix_MultiplyVector3fXZByCurrentState(Vec3f* src, Vec3f* dst);
void Matrix_MtxFCopy(MtxF* dst, MtxF* src);
void Matrix_FromRSPMatrix(Mtx* src, MtxF* dst);
void Matrix_MultiplyVector3fByMatrix(Vec3f* src, Vec3f* dst, MtxF* matrix);
void Matrix_TransposeXYZ(MtxF* matrix);
void Matrix_NormalizeXYZ(MtxF* matrix);
void func_8018219C(MtxF* pfParm1, Vec3s* psParm2, s32 iParm3);
// void func_801822C4(void);
void Matrix_InsertRotationAroundUnitVector_f(f32 rotation, Vec3f* vector, s32 appendToState);
void Matrix_InsertRotationAroundUnitVector_s(s16 rotation, Vec3f* vector, s32 appendToState);
u64* SysUcode_GetUCodeBoot(void);
size_t SysUcode_GetUCodeBootSize(void);