| 1 | #pragma once |
| 2 | |
| 3 | #include <math/seadMatrix.h> |
| 4 | #include <math/seadQuat.h> |
| 5 | #include <math/seadVector.h> |
| 6 | |
| 7 | namespace nn::util::neon { |
| 8 | struct MatrixColumnMajor4x3fType; |
| 9 | struct MatrixColumnMajor4x4fType; |
| 10 | } // namespace nn::util::neon |
| 11 | |
| 12 | namespace al { |
| 13 | |
| 14 | template <typename T> |
| 15 | struct Matrix43 { |
| 16 | T m[3][4]; |
| 17 | }; |
| 18 | |
| 19 | using Matrix43f = Matrix43<f32>; |
| 20 | |
| 21 | void makeMtxRotateTrans(sead::Matrix34f* outMtx, const sead::Vector3f& rotate, |
| 22 | const sead::Vector3f& trans); |
| 23 | void makeMtxFromTwoAxis(sead::Matrix34f* outMtx, const sead::Vector3f& vectorA, |
| 24 | const sead::Vector3f& vectorB, s32 axisA, s32 axisB); |
| 25 | void makeMtxFrontUp(sead::Matrix34f* outMtx, const sead::Vector3f& front, const sead::Vector3f& up); |
| 26 | void makeMtxFrontSide(sead::Matrix34f* outMtx, const sead::Vector3f& front, |
| 27 | const sead::Vector3f& side); |
| 28 | void makeMtxUpFront(sead::Matrix34f* outMtx, const sead::Vector3f& up, const sead::Vector3f& front); |
| 29 | void makeMtxUpSide(sead::Matrix34f* outMtx, const sead::Vector3f& up, const sead::Vector3f& side); |
| 30 | void makeMtxSideUp(sead::Matrix34f* outMtx, const sead::Vector3f& side, const sead::Vector3f& up); |
| 31 | void makeMtxSideFront(sead::Matrix34f* outMtx, const sead::Vector3f& side, |
| 32 | const sead::Vector3f& front); |
| 33 | void makeMtxFrontNoSupport(sead::Matrix34f* outMtx, const sead::Vector3f& front); |
| 34 | void makeMtxFrontNoSupportPos(sead::Matrix34f* outMtx, const sead::Vector3f& front, |
| 35 | const sead::Vector3f& pos); |
| 36 | void makeMtxUpNoSupport(sead::Matrix34f* outMtx, const sead::Vector3f& up); |
| 37 | void makeMtxUpNoSupportPos(sead::Matrix34f* outMtx, const sead::Vector3f& up, |
| 38 | const sead::Vector3f& pos); |
| 39 | void makeMtxSideNoSupport(sead::Matrix34f* outMtx, const sead::Vector3f& side); |
| 40 | void makeMtxSideNoSupportPos(sead::Matrix34f* outMtx, const sead::Vector3f& side, |
| 41 | const sead::Vector3f& pos); |
| 42 | void makeMtxQuatPos(sead::Matrix34f* outMtx, const sead::Quatf& quat, const sead::Vector3f& pos); |
| 43 | void makeMtxQuatScalePos(sead::Matrix34f* outMtx, const sead::Quatf& quat, |
| 44 | const sead::Vector3f& scale, const sead::Vector3f& pos); |
| 45 | void makeMtxQuatScalePos(sead::Matrix44f* outMtx, const sead::Quatf& quat, |
| 46 | const sead::Vector3f& scale, const sead::Vector3f& pos); |
| 47 | void makeMtxFrontUpPos(sead::Matrix34f* outMtx, const sead::Vector3f& front, |
| 48 | const sead::Vector3f& up, const sead::Vector3f& pos); |
| 49 | void makeMtxFrontSidePos(sead::Matrix34f* outMtx, const sead::Vector3f& front, |
| 50 | const sead::Vector3f& side, const sead::Vector3f& pos); |
| 51 | void makeMtxUpFrontPos(sead::Matrix34f* outMtx, const sead::Vector3f& up, |
| 52 | const sead::Vector3f& front, const sead::Vector3f& pos); |
| 53 | void makeMtxUpSidePos(sead::Matrix34f* outMtx, const sead::Vector3f& up, const sead::Vector3f& side, |
| 54 | const sead::Vector3f& pos); |
| 55 | void makeMtxSideUpPos(sead::Matrix34f* outMtx, const sead::Vector3f& side, const sead::Vector3f& up, |
| 56 | const sead::Vector3f& pos); |
| 57 | void makeMtxSideFrontPos(sead::Matrix34f* outMtx, const sead::Vector3f& side, |
| 58 | const sead::Vector3f& front, const sead::Vector3f& pos); |
| 59 | void makeMtxFollowTarget(sead::Matrix34f* outMtx, const sead::Matrix34f& baseMtx, |
| 60 | const sead::Vector3f& trans, const sead::Vector3f& rotate); |
| 61 | void makeMtxProj(sead::Matrix44f*, const sead::Vector2f&, const sead::Vector3f&, |
| 62 | const sead::Vector3f&); |
| 63 | void makeMtxProjFromQuatPoseUp(sead::Matrix44f*, const sead::Quatf&, const sead::Vector2f&, |
| 64 | const sead::Vector3f&); |
| 65 | void makeMtxProjFromQuatPoseFront(sead::Matrix44f*, const sead::Quatf&, const sead::Vector2f&, |
| 66 | const sead::Vector3f&); |
| 67 | void makeMtxProjFromQuatPoseSide(sead::Matrix44f*, const sead::Quatf&, const sead::Vector2f&, |
| 68 | const sead::Vector3f&); |
| 69 | void makeMtxProjFromUp(sead::Matrix44f*, const sead::Vector2f&, const sead::Vector3f&); |
| 70 | |
| 71 | void rotateMtxXDirDegree(sead::Matrix34f* outMtx, const sead::Matrix34f& baseMtx, f32 angle); |
| 72 | void rotateMtxYDirDegree(sead::Matrix34f* outMtx, const sead::Matrix34f& baseMtx, f32 angle); |
| 73 | void rotateMtxZDirDegree(sead::Matrix34f* outMtx, const sead::Matrix34f& baseMtx, f32 angle); |
| 74 | void rotateMtxCenterPosXDirDegree(sead::Matrix34f*, const sead::Matrix34f&, const sead::Vector3f&, |
| 75 | f32); |
| 76 | void rotateMtxCenterPosAxisDegree(sead::Matrix34f*, const sead::Matrix34f&, const sead::Vector3f&, |
| 77 | const sead::Vector3f&, f32); |
| 78 | void rotateMtxCenterPosYDirDegree(sead::Matrix34f*, const sead::Matrix34f&, const sead::Vector3f&, |
| 79 | f32); |
| 80 | void rotateMtxCenterPosZDirDegree(sead::Matrix34f*, const sead::Matrix34f&, const sead::Vector3f&, |
| 81 | f32); |
| 82 | void rotateMtxCenterPosQuat(sead::Matrix34f*, const sead::Matrix34f&, const sead::Vector3f&, |
| 83 | const sead::Quatf&); |
| 84 | |
| 85 | bool turnMtxXDirDegree(sead::Matrix34f*, const sead::Matrix34f&, const sead::Vector3f&, f32); |
| 86 | bool turnMtxYDirDegree(sead::Matrix34f*, const sead::Matrix34f&, const sead::Vector3f&, f32); |
| 87 | bool turnMtxZDirDegree(sead::Matrix34f*, const sead::Matrix34f&, const sead::Vector3f&, f32); |
| 88 | |
| 89 | void calcCameraPosFromViewMtx(sead::Vector3f*, const sead::Matrix34f&); |
| 90 | void calcMtxMul(sead::Vector3f*, const sead::Matrix34f&, const sead::Vector3f&); |
| 91 | void calcMtxMul(sead::Vector3f*, const Matrix43f&, const sead::Vector3f&); |
| 92 | void calcMtxScale(sead::Vector3f* outMtx, const sead::Matrix34f& mtx); |
| 93 | void calcMtxScale(sead::Vector3f* outMtx, const Matrix43f& mtx); |
| 94 | void normalizeMtxScale(sead::Matrix34f* outMtx, const sead::Matrix34f& mtx); |
| 95 | bool tryNormalizeMtxScaleOrIdentity(sead::Matrix34f* outMtx, const sead::Matrix34f& mtx); |
| 96 | void calcMtxLocalTrans(sead::Vector3f*, const sead::Matrix34f&, const sead::Vector3f&); |
| 97 | void calcTransLocalOffsetByMtx(sead::Vector3f*, const sead::Matrix34f&, const sead::Vector3f&); |
| 98 | void preScaleMtx(sead::Matrix34f* outMtx, const sead::Vector3f& scale); |
| 99 | void addTransMtxLocalOffset(sead::Matrix34f*, const sead::Matrix34f&, const sead::Vector3f&); |
| 100 | |
| 101 | void blendMtx(sead::Matrix34f*, const sead::Matrix34f&, const sead::Matrix34f&, f32); |
| 102 | void blendMtxRotate(sead::Matrix34f*, const sead::Matrix34f&, const sead::Matrix34f&, f32); |
| 103 | void blendMtxTrans(sead::Matrix34f*, const sead::Matrix34f&, const sead::Matrix34f&, f32); |
| 104 | |
| 105 | f32 calcMtxLocalDirAngleOnPlaneToTarget(const sead::Matrix34f*, const sead::Vector3f&, s32, s32); |
| 106 | f32 calcMtxLocalDirAngleOnPlaneToDir(const sead::Matrix34f*, const sead::Vector3f&, s32, s32); |
| 107 | bool calcRotAxisOrZero(sead::Vector3f*, const sead::Matrix34f&); |
| 108 | void calcMxtInvertOrtho(sead::Matrix34f*, const sead::Matrix34f&); |
| 109 | void calcNearFarByInvProjection(f32*, f32*, const sead::Matrix44f&); |
| 110 | void calcMovedInertiaTensor(sead::Matrix33f*, const sead::Matrix33f&, const sead::Vector3f&, f32); |
| 111 | void calcInertiaTensorByMovedTensorAndCenter(sead::Matrix33f*, const sead::Matrix33f&, |
| 112 | const sead::Vector3f&, f32); |
| 113 | void calcInertiaTensorSphere(sead::Matrix33f*, f32, f32); |
| 114 | void calcInertiaTensorBox(sead::Matrix33f*, const sead::Vector3f&, f32); |
| 115 | |
| 116 | void makeMtx34f(sead::Matrix34f*, const nn::util::neon::MatrixColumnMajor4x3fType&); |
| 117 | void makeMtx44f(sead::Matrix44f*, const nn::util::neon::MatrixColumnMajor4x4fType&); |
| 118 | |
| 119 | } // namespace al |
| 120 | |