1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-13 03:14:38 +00:00

Document undocumented matrix functions (#955)

* Document `func_800D1694` as `Matrix_TranslateRotateYXZ`

* Document `func_800D1FD4` as `Matrix_ReplaceRotation`

* Cleanup `Matrix_RotateAxis`

* Document `func_800A7EC0` as `SkinMatrix_SetRotateAxis`

* Document `func_800D2A34` and `func_800D2A98` as `Matrix_SetTranslateScaleMtx`(`F`)

* Document mostly unused functions at the end of `sys_matrix.c`

* Add in-use renamed functions to `namefixer.py`

* Add `Matrix_SetTranslateScaleMtx2` to `namefixer.py`

* Run formatter

* Fix namefixer.py mistake from #952

* Format clang-11.1

* Fix `Matrix_TranslateRotateYXZ` wrongly documented, it actually is `Matrix_SetTranslateRotateYXZ`

* VS Code is stellar at refactoring (no)

* Run formatter

* Come on VS Code

* Improve `Matrix_ReplaceRotation` docs

* Fix typo

* Fix namefixer.py
This commit is contained in:
Dragorn421 2022-01-11 00:28:01 +01:00 committed by GitHub
parent 0b8edc21c0
commit b1d3844325
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
63 changed files with 403 additions and 374 deletions

View file

@ -604,9 +604,10 @@ Mtx* SkinMatrix_MtxFToNewMtx(GraphicsContext* gfxCtx, MtxF* src) {
}
/**
* Produces a matrix which rotates vectors by angle a around a unit vector with components (x,y,z)
* Produces a matrix which rotates by binary angle `angle` around a unit vector (`axisX`,`axisY`,`axisZ`).
* NB: the rotation axis is assumed to be a unit vector.
*/
void func_800A7EC0(MtxF* mf, s16 a, f32 x, f32 y, f32 z) {
void SkinMatrix_SetRotateAxis(MtxF* mf, s16 angle, f32 axisX, f32 axisY, f32 axisZ) {
f32 sinA;
f32 cosA;
f32 xx;
@ -617,28 +618,28 @@ void func_800A7EC0(MtxF* mf, s16 a, f32 x, f32 y, f32 z) {
f32 xz;
f32 pad;
sinA = Math_SinS(a);
cosA = Math_CosS(a);
sinA = Math_SinS(angle);
cosA = Math_CosS(angle);
xx = x * x;
yy = y * y;
zz = z * z;
xy = x * y;
yz = y * z;
xz = x * z;
xx = axisX * axisX;
yy = axisY * axisY;
zz = axisZ * axisZ;
xy = axisX * axisY;
yz = axisY * axisZ;
xz = axisX * axisZ;
mf->xx = (1.0f - xx) * cosA + xx;
mf->yx = (1.0f - cosA) * xy + z * sinA;
mf->zx = (1.0f - cosA) * xz - y * sinA;
mf->yx = (1.0f - cosA) * xy + axisZ * sinA;
mf->zx = (1.0f - cosA) * xz - axisY * sinA;
mf->wx = 0.0f;
mf->xy = (1.0f - cosA) * xy - z * sinA;
mf->xy = (1.0f - cosA) * xy - axisZ * sinA;
mf->yy = (1.0f - yy) * cosA + yy;
mf->zy = (1.0f - cosA) * yz + x * sinA;
mf->zy = (1.0f - cosA) * yz + axisX * sinA;
mf->wy = 0.0f;
mf->xz = (1.0f - cosA) * xz + y * sinA;
mf->yz = (1.0f - cosA) * yz - x * sinA;
mf->xz = (1.0f - cosA) * xz + axisY * sinA;
mf->yz = (1.0f - cosA) * yz - axisX * sinA;
mf->zz = (1.0f - zz) * cosA + zz;
mf->wz = 0.0f;