mirror of
https://github.com/zeldaret/mm.git
synced 2026-05-23 23:05:08 -04:00
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:
+1895
-40
File diff suppressed because it is too large
Load Diff
+46
-47
@@ -92,10 +92,10 @@ void ActorShadow_Draw(Actor* actor, Lights* lights, GlobalContext* globalCtx, Gf
|
||||
}
|
||||
|
||||
func_800C0094(actor->floorPoly, actor->world.pos.x, actor->floorHeight, actor->world.pos.z, &mtx);
|
||||
Matrix_SetCurrentState(&mtx);
|
||||
Matrix_Put(&mtx);
|
||||
|
||||
if ((dlist != gCircleShadowDL) || (actor->scale.x != actor->scale.z)) {
|
||||
Matrix_RotateY(actor->shape.rot.y, MTXMODE_APPLY);
|
||||
Matrix_RotateYS(actor->shape.rot.y, MTXMODE_APPLY);
|
||||
}
|
||||
|
||||
shadowScale *= actor->shape.shadowScale;
|
||||
@@ -151,8 +151,8 @@ void ActorShadow_DrawFoot(GlobalContext* globalCtx, Light* light, MtxF* arg2, s3
|
||||
sp58 = Math_FAtan2F(dir2, dir0);
|
||||
shadowScaleZ *= (4.5f - (light->l.dir[1] * 0.035f));
|
||||
shadowScaleZ = CLAMP_MIN(shadowScaleZ, 1.0f);
|
||||
Matrix_SetCurrentState(arg2);
|
||||
Matrix_RotateY(sp58, MTXMODE_APPLY);
|
||||
Matrix_Put(arg2);
|
||||
Matrix_RotateYS(sp58, MTXMODE_APPLY);
|
||||
Matrix_Scale(shadowScaleX, 1.0f, shadowScaleX * shadowScaleZ, MTXMODE_APPLY);
|
||||
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD);
|
||||
@@ -301,9 +301,9 @@ void ActorShadow_DrawFeet(Actor* actor, Lights* mapper, GlobalContext* globalCtx
|
||||
void Actor_SetFeetPos(Actor* actor, s32 limbIndex, s32 leftFootIndex, Vec3f* leftFootPos, s32 rightFootIndex,
|
||||
Vec3f* rightFootPos) {
|
||||
if (limbIndex == leftFootIndex) {
|
||||
Matrix_MultiplyVector3fByState(leftFootPos, &actor->shape.feetPos[FOOT_LEFT]);
|
||||
Matrix_MultVec3f(leftFootPos, &actor->shape.feetPos[FOOT_LEFT]);
|
||||
} else if (limbIndex == rightFootIndex) {
|
||||
Matrix_MultiplyVector3fByState(rightFootPos, &actor->shape.feetPos[FOOT_RIGHT]);
|
||||
Matrix_MultVec3f(rightFootPos, &actor->shape.feetPos[FOOT_RIGHT]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -533,22 +533,22 @@ void Actor_DrawZTarget(TargetContext* targetCtx, GlobalContext* globalCtx) {
|
||||
var2 = ((entry->unkC - 120.0f) * 0.001f) + 0.15f;
|
||||
}
|
||||
|
||||
Matrix_InsertTranslation(entry->pos.x, entry->pos.y, 0.0f, MTXMODE_NEW);
|
||||
Matrix_Translate(entry->pos.x, entry->pos.y, 0.0f, MTXMODE_NEW);
|
||||
Matrix_Scale(var2, 0.15f, 1.0f, MTXMODE_APPLY);
|
||||
|
||||
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, entry->color.r, entry->color.g, entry->color.b,
|
||||
(u8)alpha);
|
||||
|
||||
Matrix_InsertZRotation_s((targetCtx->unk4B * 512), MTXMODE_APPLY);
|
||||
Matrix_RotateZS((targetCtx->unk4B * 512), MTXMODE_APPLY);
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
Matrix_InsertZRotation_s(0x4000, MTXMODE_APPLY);
|
||||
Matrix_StatePush();
|
||||
Matrix_InsertTranslation(entry->unkC, entry->unkC, 0.0f, MTXMODE_APPLY);
|
||||
Matrix_RotateZS(0x4000, MTXMODE_APPLY);
|
||||
Matrix_Push();
|
||||
Matrix_Translate(entry->unkC, entry->unkC, 0.0f, MTXMODE_APPLY);
|
||||
gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx),
|
||||
G_MTX_MODELVIEW | G_MTX_LOAD);
|
||||
gSPDisplayList(OVERLAY_DISP++, gZTargetLockOnTriangleDL);
|
||||
Matrix_StatePop();
|
||||
Matrix_Pop();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -566,10 +566,10 @@ void Actor_DrawZTarget(TargetContext* targetCtx, GlobalContext* globalCtx) {
|
||||
|
||||
POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0x07);
|
||||
|
||||
Matrix_InsertTranslation(actor->focus.pos.x,
|
||||
actor->focus.pos.y + (actor->targetArrowOffset * actor->scale.y) + 17.0f,
|
||||
actor->focus.pos.z, MTXMODE_NEW);
|
||||
Matrix_RotateY((globalCtx->gameplayFrames * 3000), MTXMODE_APPLY);
|
||||
Matrix_Translate(actor->focus.pos.x,
|
||||
actor->focus.pos.y + (actor->targetArrowOffset * actor->scale.y) + 17.0f,
|
||||
actor->focus.pos.z, MTXMODE_NEW);
|
||||
Matrix_RotateYS((globalCtx->gameplayFrames * 3000), MTXMODE_APPLY);
|
||||
Matrix_Scale((iREG(27) + 35) / 1000.0f, (iREG(28) + 60) / 1000.0f, (iREG(29) + 50) / 1000.0f,
|
||||
MTXMODE_APPLY);
|
||||
|
||||
@@ -2511,14 +2511,13 @@ void Actor_Draw(GlobalContext* globalCtx, Actor* actor) {
|
||||
Lights_Draw(light, globalCtx->state.gfxCtx);
|
||||
|
||||
if (actor->flags & ACTOR_FLAG_1000) {
|
||||
Matrix_SetStateRotationAndTranslation(
|
||||
Matrix_SetTranslateRotateYXZ(
|
||||
actor->world.pos.x + globalCtx->mainCamera.skyboxOffset.x,
|
||||
actor->world.pos.y + ((actor->shape.yOffset * actor->scale.y) + globalCtx->mainCamera.skyboxOffset.y),
|
||||
actor->world.pos.z + globalCtx->mainCamera.skyboxOffset.z, &actor->shape.rot);
|
||||
} else {
|
||||
Matrix_SetStateRotationAndTranslation(actor->world.pos.x,
|
||||
actor->world.pos.y + (actor->shape.yOffset * actor->scale.y),
|
||||
actor->world.pos.z, &actor->shape.rot);
|
||||
Matrix_SetTranslateRotateYXZ(actor->world.pos.x, actor->world.pos.y + (actor->shape.yOffset * actor->scale.y),
|
||||
actor->world.pos.z, &actor->shape.rot);
|
||||
}
|
||||
|
||||
Matrix_Scale(actor->scale.x, actor->scale.y, actor->scale.z, MTXMODE_APPLY);
|
||||
@@ -3543,14 +3542,14 @@ void Actor_SpawnBodyParts(Actor* actor, GlobalContext* globalCtx, s32 arg2, Gfx*
|
||||
MtxF* currentMatrix;
|
||||
|
||||
if (*dList != NULL) {
|
||||
currentMatrix = Matrix_GetCurrentState();
|
||||
currentMatrix = Matrix_GetCurrent();
|
||||
spawnedPart =
|
||||
Actor_SpawnAsChild(&globalCtx->actorCtx, actor, globalCtx, ACTOR_EN_PART, currentMatrix->mf[3][0],
|
||||
currentMatrix->mf[3][1], currentMatrix->mf[3][2], 0, 0, actor->objBankIndex, arg2);
|
||||
if (spawnedPart != NULL) {
|
||||
part = (EnPart*)spawnedPart;
|
||||
|
||||
func_8018219C(currentMatrix, &part->actor.shape.rot, 0);
|
||||
Matrix_MtxFToYXZRot(currentMatrix, &part->actor.shape.rot, false);
|
||||
part->unk_150 = *dList;
|
||||
Math_Vec3f_Copy(&part->actor.scale, &actor->scale);
|
||||
}
|
||||
@@ -3772,9 +3771,9 @@ void func_800BC620(Vec3f* arg0, Vec3f* arg1, u8 alpha, GlobalContext* globalCtx)
|
||||
sp54 = BgCheck_EntityRaycastFloor2(globalCtx, &globalCtx->colCtx, &sp44, &sp48);
|
||||
if (sp44 != NULL) {
|
||||
func_800C0094(sp44, arg0->x, sp54, arg0->z, &sp58);
|
||||
Matrix_SetCurrentState(&sp58);
|
||||
Matrix_Put(&sp58);
|
||||
} else {
|
||||
Matrix_InsertTranslation(arg0->x, arg0->y, arg0->z, MTXMODE_NEW);
|
||||
Matrix_Translate(arg0->x, arg0->y, arg0->z, MTXMODE_NEW);
|
||||
}
|
||||
Matrix_Scale(arg1->x, 1.0f, arg1->z, MTXMODE_APPLY);
|
||||
|
||||
@@ -3841,16 +3840,16 @@ void Actor_DrawDoorLock(GlobalContext* globalCtx, s32 frame, s32 type) {
|
||||
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx);
|
||||
|
||||
Matrix_InsertTranslation(0.0f, entry->yShift, 500.0f, MTXMODE_APPLY);
|
||||
Matrix_CopyCurrentState(&baseMtxF);
|
||||
Matrix_Translate(0.0f, entry->yShift, 500.0f, MTXMODE_APPLY);
|
||||
Matrix_Get(&baseMtxF);
|
||||
|
||||
chainsTranslateX = __sinf(entry->chainAngle - chainRotZ) * -(10 - frame) * 0.1f * entry->chainLength;
|
||||
chainsTranslateY = __cosf(entry->chainAngle - chainRotZ) * (10 - frame) * 0.1f * entry->chainLength;
|
||||
chainsTranslateX = sinf(entry->chainAngle - chainRotZ) * -(10 - frame) * 0.1f * entry->chainLength;
|
||||
chainsTranslateY = cosf(entry->chainAngle - chainRotZ) * (10 - frame) * 0.1f * entry->chainLength;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
Matrix_SetCurrentState(&baseMtxF);
|
||||
Matrix_InsertZRotation_f(chainRotZ, MTXMODE_APPLY);
|
||||
Matrix_InsertTranslation(chainsTranslateX, chainsTranslateY, 0.0f, MTXMODE_APPLY);
|
||||
Matrix_Put(&baseMtxF);
|
||||
Matrix_RotateZF(chainRotZ, MTXMODE_APPLY);
|
||||
Matrix_Translate(chainsTranslateX, chainsTranslateY, 0.0f, MTXMODE_APPLY);
|
||||
if (entry->chainsScale != 1.0f) {
|
||||
Matrix_Scale(entry->chainsScale, entry->chainsScale, entry->chainsScale, MTXMODE_APPLY);
|
||||
}
|
||||
@@ -3867,7 +3866,7 @@ void Actor_DrawDoorLock(GlobalContext* globalCtx, s32 frame, s32 type) {
|
||||
chainRotZ += rotZStep;
|
||||
}
|
||||
|
||||
Matrix_SetCurrentState(&baseMtxF);
|
||||
Matrix_Put(&baseMtxF);
|
||||
Matrix_Scale(frame * 0.1f, frame * 0.1f, frame * 0.1f, MTXMODE_APPLY);
|
||||
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
@@ -4516,7 +4515,7 @@ void Actor_DrawDamageEffects(GlobalContext* globalCtx, Actor* actor, Vec3f limbP
|
||||
u32 gameplayFrames = globalCtx->gameplayFrames;
|
||||
f32 effectAlphaScaled;
|
||||
|
||||
currentMatrix = Matrix_GetCurrentState();
|
||||
currentMatrix = Matrix_GetCurrent();
|
||||
|
||||
// Apply sfx along with damage effect
|
||||
if ((actor != NULL) && (effectAlpha > 0.05f) && (globalCtx->gameOverCtx.state == 0)) {
|
||||
@@ -4565,15 +4564,15 @@ void Actor_DrawDamageEffects(GlobalContext* globalCtx, Actor* actor, Vec3f limbP
|
||||
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, KREG(20) + 200, KREG(21) + 200, KREG(22) + 255, (u8)alpha);
|
||||
|
||||
Matrix_InsertTranslation(limbPos->x, limbPos->y, limbPos->z, MTXMODE_NEW);
|
||||
Matrix_Translate(limbPos->x, limbPos->y, limbPos->z, MTXMODE_NEW);
|
||||
Matrix_Scale(frozenScale, frozenScale, frozenScale, MTXMODE_APPLY);
|
||||
|
||||
if (limbIndex & 1) {
|
||||
Matrix_InsertYRotation_f(M_PI, MTXMODE_APPLY);
|
||||
Matrix_RotateYF(M_PI, MTXMODE_APPLY);
|
||||
}
|
||||
|
||||
if (limbIndex & 2) {
|
||||
Matrix_InsertZRotation_f(M_PI, MTXMODE_APPLY);
|
||||
Matrix_RotateZF(M_PI, MTXMODE_APPLY);
|
||||
}
|
||||
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx),
|
||||
@@ -4604,8 +4603,8 @@ void Actor_DrawDamageEffects(GlobalContext* globalCtx, Actor* actor, Vec3f limbP
|
||||
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, twoTexScrollParam * 3,
|
||||
twoTexScrollParam * -12, 32, 64, 1, 0, 0, 32, 32));
|
||||
|
||||
Matrix_InsertTranslation(limbPos->x, limbPos->y, limbPos->z, MTXMODE_NEW);
|
||||
Matrix_NormalizeXYZ(&globalCtx->billboardMtxF);
|
||||
Matrix_Translate(limbPos->x, limbPos->y, limbPos->z, MTXMODE_NEW);
|
||||
Matrix_ReplaceRotation(&globalCtx->billboardMtxF);
|
||||
Matrix_Scale(steamScale, steamScale, 1.0f, MTXMODE_APPLY);
|
||||
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx),
|
||||
@@ -4625,7 +4624,7 @@ void Actor_DrawDamageEffects(GlobalContext* globalCtx, Actor* actor, Vec3f limbP
|
||||
type = 255;
|
||||
}
|
||||
|
||||
Matrix_SetCurrentState(&globalCtx->billboardMtxF);
|
||||
Matrix_Put(&globalCtx->billboardMtxF);
|
||||
Matrix_Scale((effectScale * 0.005f) * 1.35f, (effectScale * 0.005f), (effectScale * 0.005f) * 1.35f,
|
||||
MTXMODE_APPLY);
|
||||
|
||||
@@ -4651,7 +4650,7 @@ void Actor_DrawDamageEffects(GlobalContext* globalCtx, Actor* actor, Vec3f limbP
|
||||
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0,
|
||||
((limbIndex * 10 + gameplayFrames) * -20) & 0x1FF, 32, 128));
|
||||
|
||||
Matrix_InsertYRotation_f(M_PI, MTXMODE_APPLY);
|
||||
Matrix_RotateYF(M_PI, MTXMODE_APPLY);
|
||||
currentMatrix->mf[3][0] = limbPos->x;
|
||||
currentMatrix->mf[3][1] = limbPos->y;
|
||||
currentMatrix->mf[3][2] = limbPos->z;
|
||||
@@ -4688,12 +4687,12 @@ void Actor_DrawDamageEffects(GlobalContext* globalCtx, Actor* actor, Vec3f limbP
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 100, 128);
|
||||
}
|
||||
|
||||
Matrix_SetCurrentState(&globalCtx->billboardMtxF);
|
||||
Matrix_Put(&globalCtx->billboardMtxF);
|
||||
Matrix_Scale(lightOrbsScale, lightOrbsScale, 1.0f, MTXMODE_APPLY);
|
||||
|
||||
// Apply and draw a light orb over each limb of frozen actor
|
||||
for (limbIndex = 0; limbIndex < limbPosCount; limbIndex++, limbPos++) {
|
||||
Matrix_InsertZRotation_f(randPlusMinusPoint5Scaled(2 * M_PI), MTXMODE_APPLY);
|
||||
Matrix_RotateZF(randPlusMinusPoint5Scaled(2 * M_PI), MTXMODE_APPLY);
|
||||
currentMatrix->mf[3][0] = limbPos->x;
|
||||
currentMatrix->mf[3][1] = limbPos->y;
|
||||
currentMatrix->mf[3][2] = limbPos->z;
|
||||
@@ -4726,14 +4725,14 @@ void Actor_DrawDamageEffects(GlobalContext* globalCtx, Actor* actor, Vec3f limbP
|
||||
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, (u8)(sREG(20) + 255), (u8)(sREG(21) + 255), (u8)sREG(22), (u8)sREG(23));
|
||||
|
||||
Matrix_SetCurrentState(&globalCtx->billboardMtxF);
|
||||
Matrix_Put(&globalCtx->billboardMtxF);
|
||||
Matrix_Scale(electricSparksScale, electricSparksScale, electricSparksScale, MTXMODE_APPLY);
|
||||
|
||||
// Every limb draws two electric sparks at random orientations
|
||||
for (limbIndex = 0; limbIndex < limbPosCount; limbIndex++, limbPos++) {
|
||||
// first electric spark
|
||||
Matrix_RotateStateAroundXAxis(Rand_ZeroFloat(2 * M_PI));
|
||||
Matrix_InsertZRotation_f(Rand_ZeroFloat(2 * M_PI), MTXMODE_APPLY);
|
||||
Matrix_RotateXFApply(Rand_ZeroFloat(2 * M_PI));
|
||||
Matrix_RotateZF(Rand_ZeroFloat(2 * M_PI), MTXMODE_APPLY);
|
||||
currentMatrix->mf[3][0] = randPlusMinusPoint5Scaled((f32)sREG(24) + 30.0f) + limbPos->x;
|
||||
currentMatrix->mf[3][1] = randPlusMinusPoint5Scaled((f32)sREG(24) + 30.0f) + limbPos->y;
|
||||
currentMatrix->mf[3][2] = randPlusMinusPoint5Scaled((f32)sREG(24) + 30.0f) + limbPos->z;
|
||||
@@ -4744,8 +4743,8 @@ void Actor_DrawDamageEffects(GlobalContext* globalCtx, Actor* actor, Vec3f limbP
|
||||
gSPDisplayList(POLY_XLU_DISP++, gElectricSparkVtxDL);
|
||||
|
||||
// second electric spark
|
||||
Matrix_RotateStateAroundXAxis(Rand_ZeroFloat(2 * M_PI));
|
||||
Matrix_InsertZRotation_f(Rand_ZeroFloat(2 * M_PI), MTXMODE_APPLY);
|
||||
Matrix_RotateXFApply(Rand_ZeroFloat(2 * M_PI));
|
||||
Matrix_RotateZF(Rand_ZeroFloat(2 * M_PI), MTXMODE_APPLY);
|
||||
currentMatrix->mf[3][0] = randPlusMinusPoint5Scaled((f32)sREG(24) + 30.0f) + limbPos->x;
|
||||
currentMatrix->mf[3][1] = randPlusMinusPoint5Scaled((f32)sREG(24) + 30.0f) + limbPos->y;
|
||||
currentMatrix->mf[3][2] = randPlusMinusPoint5Scaled((f32)sREG(24) + 30.0f) + limbPos->z;
|
||||
|
||||
+12
-12
@@ -248,20 +248,20 @@ void func_800C0094(CollisionPoly* poly, f32 tx, f32 ty, f32 tz, MtxF* dest) {
|
||||
phi_f12 = 0.0f;
|
||||
}
|
||||
dest->xx = z_f14;
|
||||
dest->xy = (-nx) * phi_f14;
|
||||
dest->xz = (-nx) * phi_f12;
|
||||
dest->yx = nx;
|
||||
dest->yx = (-nx) * phi_f14;
|
||||
dest->zx = (-nx) * phi_f12;
|
||||
dest->xy = nx;
|
||||
dest->yy = ny;
|
||||
dest->yz = nz;
|
||||
dest->zx = 0.0f;
|
||||
dest->zy = -phi_f12;
|
||||
dest->zy = nz;
|
||||
dest->xz = 0.0f;
|
||||
dest->yz = -phi_f12;
|
||||
dest->zz = phi_f14;
|
||||
dest->wx = tx;
|
||||
dest->wy = ty;
|
||||
dest->wz = tz;
|
||||
dest->xw = 0.0f;
|
||||
dest->yw = 0.0f;
|
||||
dest->zw = 0.0f;
|
||||
dest->xw = tx;
|
||||
dest->yw = ty;
|
||||
dest->zw = tz;
|
||||
dest->wx = 0.0f;
|
||||
dest->wy = 0.0f;
|
||||
dest->wz = 0.0f;
|
||||
dest->ww = 1.0f;
|
||||
}
|
||||
|
||||
|
||||
@@ -3691,7 +3691,7 @@ void Collider_UpdateSpheres(s32 limb, ColliderJntSph* collider) {
|
||||
D_801EE1C0.x = collider->elements[i].dim.modelSphere.center.x;
|
||||
D_801EE1C0.y = collider->elements[i].dim.modelSphere.center.y;
|
||||
D_801EE1C0.z = collider->elements[i].dim.modelSphere.center.z;
|
||||
Matrix_MultiplyVector3fByState(&D_801EE1C0, &D_801EE1D0);
|
||||
Matrix_MultVec3f(&D_801EE1C0, &D_801EE1D0);
|
||||
collider->elements[i].dim.worldSphere.center.x = D_801EE1D0.x;
|
||||
collider->elements[i].dim.worldSphere.center.y = D_801EE1D0.y;
|
||||
collider->elements[i].dim.worldSphere.center.z = D_801EE1D0.z;
|
||||
@@ -3733,7 +3733,7 @@ void Collider_UpdateSphere(s32 limb, ColliderSphere* collider) {
|
||||
D_801EE1E0.x = collider->dim.modelSphere.center.x;
|
||||
D_801EE1E0.y = collider->dim.modelSphere.center.y;
|
||||
D_801EE1E0.z = collider->dim.modelSphere.center.z;
|
||||
Matrix_MultiplyVector3fByState(&D_801EE1E0, &D_801EE1F0);
|
||||
Matrix_MultVec3f(&D_801EE1E0, &D_801EE1F0);
|
||||
collider->dim.worldSphere.center.x = D_801EE1F0.x;
|
||||
collider->dim.worldSphere.center.y = D_801EE1F0.y;
|
||||
collider->dim.worldSphere.center.z = D_801EE1F0.z;
|
||||
|
||||
@@ -68,10 +68,10 @@ void DebugDisplay_DrawSpriteI8(DebugDispObject* dispObj, void* texture, GlobalCo
|
||||
func_8012C6FC(globalCtx->state.gfxCtx);
|
||||
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, dispObj->color.r, dispObj->color.g, dispObj->color.b, dispObj->color.a);
|
||||
Matrix_InsertTranslation(dispObj->pos.x, dispObj->pos.y, dispObj->pos.z, MTXMODE_NEW);
|
||||
Matrix_Translate(dispObj->pos.x, dispObj->pos.y, dispObj->pos.z, MTXMODE_NEW);
|
||||
Matrix_Scale(dispObj->scale.x, dispObj->scale.y, dispObj->scale.z, MTXMODE_APPLY);
|
||||
Matrix_InsertMatrix(&globalCtx->billboardMtxF, MTXMODE_APPLY);
|
||||
Matrix_InsertRotation(dispObj->rot.x, dispObj->rot.y, dispObj->rot.z, MTXMODE_APPLY);
|
||||
Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY);
|
||||
Matrix_RotateZYX(dispObj->rot.x, dispObj->rot.y, dispObj->rot.z, MTXMODE_APPLY);
|
||||
|
||||
gDPLoadTextureBlock(POLY_XLU_DISP++, texture, G_IM_FMT_I, G_IM_SIZ_8b, 16, 16, 0, G_TX_NOMIRROR | G_TX_WRAP,
|
||||
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
|
||||
@@ -94,7 +94,7 @@ void DebugDisplay_DrawPolygon(DebugDispObject* dispObj, void* arg1, GlobalContex
|
||||
|
||||
gSPSetLights1(POLY_XLU_DISP++, sDebugDisplayLight1);
|
||||
|
||||
Matrix_SetStateRotationAndTranslation(dispObj->pos.x, dispObj->pos.y, dispObj->pos.z, &dispObj->rot);
|
||||
Matrix_SetTranslateRotateYXZ(dispObj->pos.x, dispObj->pos.y, dispObj->pos.z, &dispObj->rot);
|
||||
Matrix_Scale(dispObj->scale.x, dispObj->scale.y, dispObj->scale.z, MTXMODE_APPLY);
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ void EffFootmark_Draw(GlobalContext* globalCtx) {
|
||||
|
||||
for (footmark = globalCtx->footprintInfo, i = 0; i < 100; i++, footmark++) {
|
||||
if (footmark->actor != NULL) {
|
||||
Matrix_SetCurrentState(&footmark->displayMatrix);
|
||||
Matrix_Put(&footmark->displayMatrix);
|
||||
Matrix_Scale(footmark->size * (1.0f / 0x100) * 0.7f, 1, footmark->size * (1.0f / 0x100), MTXMODE_APPLY);
|
||||
|
||||
gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD);
|
||||
|
||||
@@ -104,7 +104,7 @@ void SkelCurve_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, SkelAnimeCurve*
|
||||
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx);
|
||||
|
||||
Matrix_StatePush();
|
||||
Matrix_Push();
|
||||
|
||||
if (overrideLimbDraw == NULL ||
|
||||
(overrideLimbDraw != NULL && overrideLimbDraw(globalCtx, skelCurve, limbIndex, thisx))) {
|
||||
@@ -126,7 +126,7 @@ void SkelCurve_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, SkelAnimeCurve*
|
||||
pos.y = transform->y;
|
||||
pos.z = transform->z;
|
||||
|
||||
Matrix_JointPosition(&pos, &rot);
|
||||
Matrix_TranslateRotateZYX(&pos, &rot);
|
||||
Matrix_Scale(scale.x, scale.y, scale.z, MTXMODE_APPLY);
|
||||
|
||||
if (lod == 0) {
|
||||
@@ -164,7 +164,7 @@ void SkelCurve_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, SkelAnimeCurve*
|
||||
SkelCurve_DrawLimb(globalCtx, limb->firstChildIdx, skelCurve, overrideLimbDraw, postLimbDraw, lod, thisx);
|
||||
}
|
||||
|
||||
Matrix_StatePop();
|
||||
Matrix_Pop();
|
||||
|
||||
if (limb->nextLimbIdx != LIMB_DONE) {
|
||||
SkelCurve_DrawLimb(globalCtx, limb->nextLimbIdx, skelCurve, overrideLimbDraw, postLimbDraw, lod, thisx);
|
||||
|
||||
@@ -159,7 +159,7 @@ void FireObj_Draw(GlobalContext* globalCtx, FireObj* fire) {
|
||||
vec.x = 0;
|
||||
vec.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000;
|
||||
vec.z = 0;
|
||||
Matrix_SetStateRotationAndTranslation(fire->position.x, fire->position.y, fire->position.z, &vec);
|
||||
Matrix_SetTranslateRotateYXZ(fire->position.x, fire->position.y, fire->position.z, &vec);
|
||||
Matrix_Scale(fire->xScale, fire->yScale, 1.0f, MTXMODE_APPLY);
|
||||
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
|
||||
+1
-1
@@ -431,7 +431,7 @@ void Lights_DrawGlow(GlobalContext* globalCtx) {
|
||||
|
||||
gDPSetPrimColor(dl++, 0, 0, params->color[0], params->color[1], params->color[2], 50);
|
||||
|
||||
Matrix_InsertTranslation(params->x, params->y, params->z, MTXMODE_NEW);
|
||||
Matrix_Translate(params->x, params->y, params->z, MTXMODE_NEW);
|
||||
Matrix_Scale(scale, scale, scale, MTXMODE_APPLY);
|
||||
|
||||
gSPMatrix(dl++, Matrix_NewMtx(globalCtx->state.gfxCtx),
|
||||
|
||||
+46
-46
@@ -33,7 +33,7 @@ void SkelAnime_DrawLimbLod(GlobalContext* globalCtx, s32 limbIndex, void** skele
|
||||
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx);
|
||||
|
||||
Matrix_StatePush();
|
||||
Matrix_Push();
|
||||
limb = Lib_SegmentedToVirtual(skeleton[limbIndex]);
|
||||
limbIndex++;
|
||||
rot = jointTable[limbIndex];
|
||||
@@ -44,7 +44,7 @@ void SkelAnime_DrawLimbLod(GlobalContext* globalCtx, s32 limbIndex, void** skele
|
||||
|
||||
dList = limb->dLists[lod];
|
||||
if ((overrideLimbDraw == NULL) || (overrideLimbDraw(globalCtx, limbIndex, &dList, &pos, &rot, actor) == 0)) {
|
||||
Matrix_JointPosition(&pos, &rot);
|
||||
Matrix_TranslateRotateZYX(&pos, &rot);
|
||||
if (dList != NULL) {
|
||||
Gfx* polyTemp = POLY_OPA_DISP;
|
||||
|
||||
@@ -63,7 +63,7 @@ void SkelAnime_DrawLimbLod(GlobalContext* globalCtx, s32 limbIndex, void** skele
|
||||
SkelAnime_DrawLimbLod(globalCtx, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor, lod);
|
||||
}
|
||||
|
||||
Matrix_StatePop();
|
||||
Matrix_Pop();
|
||||
|
||||
if (limb->sibling != LIMB_DONE) {
|
||||
SkelAnime_DrawLimbLod(globalCtx, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor,
|
||||
@@ -91,7 +91,7 @@ void SkelAnime_DrawLod(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTa
|
||||
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx);
|
||||
|
||||
Matrix_StatePush();
|
||||
Matrix_Push();
|
||||
|
||||
rootLimb = Lib_SegmentedToVirtual(skeleton[0]);
|
||||
pos.x = jointTable[0].x;
|
||||
@@ -102,7 +102,7 @@ void SkelAnime_DrawLod(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTa
|
||||
dList = rootLimb->dLists[lod];
|
||||
|
||||
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, 1, &dList, &pos, &rot, actor)) {
|
||||
Matrix_JointPosition(&pos, &rot);
|
||||
Matrix_TranslateRotateZYX(&pos, &rot);
|
||||
if (dList != NULL) {
|
||||
Gfx* polyTemp = POLY_OPA_DISP;
|
||||
|
||||
@@ -123,7 +123,7 @@ void SkelAnime_DrawLod(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTa
|
||||
lod);
|
||||
}
|
||||
|
||||
Matrix_StatePop();
|
||||
Matrix_Pop();
|
||||
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx);
|
||||
}
|
||||
@@ -143,7 +143,7 @@ void SkelAnime_DrawFlexLimbLod(GlobalContext* globalCtx, s32 limbIndex, void** s
|
||||
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx);
|
||||
|
||||
Matrix_StatePush();
|
||||
Matrix_Push();
|
||||
|
||||
limb = Lib_SegmentedToVirtual(skeleton[limbIndex]);
|
||||
limbIndex++;
|
||||
@@ -157,7 +157,7 @@ void SkelAnime_DrawFlexLimbLod(GlobalContext* globalCtx, s32 limbIndex, void** s
|
||||
newDList = limbDList = limb->dLists[lod];
|
||||
|
||||
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &newDList, &pos, &rot, actor)) {
|
||||
Matrix_JointPosition(&pos, &rot);
|
||||
Matrix_TranslateRotateZYX(&pos, &rot);
|
||||
if (newDList != NULL) {
|
||||
Matrix_ToMtx(*mtx);
|
||||
gSPMatrix(POLY_OPA_DISP++, *mtx, G_MTX_LOAD);
|
||||
@@ -178,7 +178,7 @@ void SkelAnime_DrawFlexLimbLod(GlobalContext* globalCtx, s32 limbIndex, void** s
|
||||
lod, mtx);
|
||||
}
|
||||
|
||||
Matrix_StatePop();
|
||||
Matrix_Pop();
|
||||
|
||||
if (limb->sibling != LIMB_DONE) {
|
||||
SkelAnime_DrawFlexLimbLod(globalCtx, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor,
|
||||
@@ -211,7 +211,7 @@ void SkelAnime_DrawFlexLod(GlobalContext* globalCtx, void** skeleton, Vec3s* joi
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx);
|
||||
|
||||
gSPSegment(POLY_OPA_DISP++, 0x0D, mtx);
|
||||
Matrix_StatePush();
|
||||
Matrix_Push();
|
||||
|
||||
rootLimb = Lib_SegmentedToVirtual(skeleton[0]);
|
||||
pos.x = jointTable[0].x;
|
||||
@@ -223,7 +223,7 @@ void SkelAnime_DrawFlexLod(GlobalContext* globalCtx, void** skeleton, Vec3s* joi
|
||||
newDList = limbDList = rootLimb->dLists[lod];
|
||||
|
||||
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, 1, &newDList, &pos, &rot, actor)) {
|
||||
Matrix_JointPosition(&pos, &rot);
|
||||
Matrix_TranslateRotateZYX(&pos, &rot);
|
||||
if (newDList != NULL) {
|
||||
Gfx* polyTemp = POLY_OPA_DISP;
|
||||
|
||||
@@ -246,7 +246,7 @@ void SkelAnime_DrawFlexLod(GlobalContext* globalCtx, void** skeleton, Vec3s* joi
|
||||
actor, lod, &mtx);
|
||||
}
|
||||
|
||||
Matrix_StatePop();
|
||||
Matrix_Pop();
|
||||
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx);
|
||||
}
|
||||
@@ -263,7 +263,7 @@ void SkelAnime_DrawLimbOpa(GlobalContext* globalCtx, s32 limbIndex, void** skele
|
||||
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx);
|
||||
|
||||
Matrix_StatePush();
|
||||
Matrix_Push();
|
||||
|
||||
limb = Lib_SegmentedToVirtual(skeleton[limbIndex]);
|
||||
limbIndex++;
|
||||
@@ -274,7 +274,7 @@ void SkelAnime_DrawLimbOpa(GlobalContext* globalCtx, s32 limbIndex, void** skele
|
||||
dList = limb->dList;
|
||||
|
||||
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &dList, &pos, &rot, actor)) {
|
||||
Matrix_JointPosition(&pos, &rot);
|
||||
Matrix_TranslateRotateZYX(&pos, &rot);
|
||||
if (dList != NULL) {
|
||||
Gfx* polyTemp = POLY_OPA_DISP;
|
||||
|
||||
@@ -292,7 +292,7 @@ void SkelAnime_DrawLimbOpa(GlobalContext* globalCtx, s32 limbIndex, void** skele
|
||||
SkelAnime_DrawLimbOpa(globalCtx, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor);
|
||||
}
|
||||
|
||||
Matrix_StatePop();
|
||||
Matrix_Pop();
|
||||
|
||||
if (limb->sibling != LIMB_DONE) {
|
||||
SkelAnime_DrawLimbOpa(globalCtx, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor);
|
||||
@@ -318,7 +318,7 @@ void SkelAnime_DrawOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTa
|
||||
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx);
|
||||
|
||||
Matrix_StatePush();
|
||||
Matrix_Push();
|
||||
rootLimb = Lib_SegmentedToVirtual(skeleton[0]);
|
||||
|
||||
pos.x = jointTable[0].x;
|
||||
@@ -329,7 +329,7 @@ void SkelAnime_DrawOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTa
|
||||
dList = rootLimb->dList;
|
||||
|
||||
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, 1, &dList, &pos, &rot, actor)) {
|
||||
Matrix_JointPosition(&pos, &rot);
|
||||
Matrix_TranslateRotateZYX(&pos, &rot);
|
||||
if (dList != NULL) {
|
||||
Gfx* polyTemp = POLY_OPA_DISP;
|
||||
|
||||
@@ -347,7 +347,7 @@ void SkelAnime_DrawOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTa
|
||||
SkelAnime_DrawLimbOpa(globalCtx, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor);
|
||||
}
|
||||
|
||||
Matrix_StatePop();
|
||||
Matrix_Pop();
|
||||
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx);
|
||||
}
|
||||
@@ -363,7 +363,7 @@ void SkelAnime_DrawFlexLimbOpa(GlobalContext* globalCtx, s32 limbIndex, void** s
|
||||
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx);
|
||||
|
||||
Matrix_StatePush();
|
||||
Matrix_Push();
|
||||
|
||||
limb = Lib_SegmentedToVirtual(skeleton[limbIndex]);
|
||||
limbIndex++;
|
||||
@@ -376,7 +376,7 @@ void SkelAnime_DrawFlexLimbOpa(GlobalContext* globalCtx, s32 limbIndex, void** s
|
||||
newDList = limbDList = limb->dList;
|
||||
|
||||
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &newDList, &pos, &rot, actor)) {
|
||||
Matrix_JointPosition(&pos, &rot);
|
||||
Matrix_TranslateRotateZYX(&pos, &rot);
|
||||
if (newDList != NULL) {
|
||||
Matrix_ToMtx(*limbMatricies);
|
||||
gSPMatrix(POLY_OPA_DISP++, *limbMatricies, G_MTX_LOAD);
|
||||
@@ -397,7 +397,7 @@ void SkelAnime_DrawFlexLimbOpa(GlobalContext* globalCtx, s32 limbIndex, void** s
|
||||
limbMatricies);
|
||||
}
|
||||
|
||||
Matrix_StatePop();
|
||||
Matrix_Pop();
|
||||
|
||||
if (limb->sibling != LIMB_DONE) {
|
||||
SkelAnime_DrawFlexLimbOpa(globalCtx, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor,
|
||||
@@ -430,7 +430,7 @@ void SkelAnime_DrawFlexOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* joi
|
||||
|
||||
gSPSegment(POLY_OPA_DISP++, 0x0D, mtx);
|
||||
|
||||
Matrix_StatePush();
|
||||
Matrix_Push();
|
||||
|
||||
rootLimb = Lib_SegmentedToVirtual(skeleton[0]);
|
||||
|
||||
@@ -442,7 +442,7 @@ void SkelAnime_DrawFlexOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* joi
|
||||
newDList = limbDList = rootLimb->dList;
|
||||
|
||||
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, 1, &newDList, &pos, &rot, actor)) {
|
||||
Matrix_JointPosition(&pos, &rot);
|
||||
Matrix_TranslateRotateZYX(&pos, &rot);
|
||||
if (newDList != NULL) {
|
||||
Gfx* polyTemp = POLY_OPA_DISP;
|
||||
|
||||
@@ -467,7 +467,7 @@ void SkelAnime_DrawFlexOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* joi
|
||||
actor, &mtx);
|
||||
}
|
||||
|
||||
Matrix_StatePop();
|
||||
Matrix_Pop();
|
||||
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx);
|
||||
}
|
||||
@@ -483,7 +483,7 @@ void SkelAnime_DrawTransformFlexLimbOpa(GlobalContext* globalCtx, s32 limbIndex,
|
||||
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx);
|
||||
|
||||
Matrix_StatePush();
|
||||
Matrix_Push();
|
||||
|
||||
limb = Lib_SegmentedToVirtual(skeleton[limbIndex]);
|
||||
limbIndex++;
|
||||
@@ -496,8 +496,8 @@ void SkelAnime_DrawTransformFlexLimbOpa(GlobalContext* globalCtx, s32 limbIndex,
|
||||
newDList = limbDList = limb->dList;
|
||||
|
||||
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &newDList, &pos, &rot, actor)) {
|
||||
Matrix_JointPosition(&pos, &rot);
|
||||
Matrix_StatePush();
|
||||
Matrix_TranslateRotateZYX(&pos, &rot);
|
||||
Matrix_Push();
|
||||
|
||||
transformLimbDraw(globalCtx, limbIndex, actor);
|
||||
|
||||
@@ -514,7 +514,7 @@ void SkelAnime_DrawTransformFlexLimbOpa(GlobalContext* globalCtx, s32 limbIndex,
|
||||
(*mtx)++;
|
||||
}
|
||||
}
|
||||
Matrix_StatePop();
|
||||
Matrix_Pop();
|
||||
}
|
||||
|
||||
if (postLimbDraw != NULL) {
|
||||
@@ -526,7 +526,7 @@ void SkelAnime_DrawTransformFlexLimbOpa(GlobalContext* globalCtx, s32 limbIndex,
|
||||
transformLimbDraw, actor, mtx);
|
||||
}
|
||||
|
||||
Matrix_StatePop();
|
||||
Matrix_Pop();
|
||||
|
||||
if (limb->sibling != LIMB_DONE) {
|
||||
SkelAnime_DrawTransformFlexLimbOpa(globalCtx, limb->sibling, skeleton, jointTable, overrideLimbDraw,
|
||||
@@ -566,7 +566,7 @@ void SkelAnime_DrawTransformFlexOpa(GlobalContext* globalCtx, void** skeleton, V
|
||||
|
||||
gSPSegment(POLY_OPA_DISP++, 0x0D, mtx);
|
||||
|
||||
Matrix_StatePush();
|
||||
Matrix_Push();
|
||||
|
||||
rootLimb = Lib_SegmentedToVirtual(skeleton[0]);
|
||||
|
||||
@@ -578,8 +578,8 @@ void SkelAnime_DrawTransformFlexOpa(GlobalContext* globalCtx, void** skeleton, V
|
||||
newDList = limbDList = rootLimb->dList;
|
||||
|
||||
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, 1, &newDList, &pos, &rot, actor)) {
|
||||
Matrix_JointPosition(&pos, &rot);
|
||||
Matrix_StatePush();
|
||||
Matrix_TranslateRotateZYX(&pos, &rot);
|
||||
Matrix_Push();
|
||||
|
||||
transformLimbDraw(globalCtx, 1, actor);
|
||||
|
||||
@@ -595,7 +595,7 @@ void SkelAnime_DrawTransformFlexOpa(GlobalContext* globalCtx, void** skeleton, V
|
||||
Matrix_ToMtx(mtx++);
|
||||
}
|
||||
}
|
||||
Matrix_StatePop();
|
||||
Matrix_Pop();
|
||||
}
|
||||
|
||||
if (postLimbDraw != NULL) {
|
||||
@@ -607,7 +607,7 @@ void SkelAnime_DrawTransformFlexOpa(GlobalContext* globalCtx, void** skeleton, V
|
||||
postLimbDraw, transformLimbDraw, actor, &mtx);
|
||||
}
|
||||
|
||||
Matrix_StatePop();
|
||||
Matrix_Pop();
|
||||
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx);
|
||||
}
|
||||
@@ -660,7 +660,7 @@ Gfx* SkelAnime_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, void** skeleton
|
||||
Vec3f pos;
|
||||
Vec3s rot;
|
||||
|
||||
Matrix_StatePush();
|
||||
Matrix_Push();
|
||||
|
||||
limb = Lib_SegmentedToVirtual(skeleton[limbIndex]);
|
||||
limbIndex++;
|
||||
@@ -673,7 +673,7 @@ Gfx* SkelAnime_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, void** skeleton
|
||||
dList = limb->dList;
|
||||
|
||||
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &dList, &pos, &rot, actor, &gfx)) {
|
||||
Matrix_JointPosition(&pos, &rot);
|
||||
Matrix_TranslateRotateZYX(&pos, &rot);
|
||||
if (dList != NULL) {
|
||||
gSPMatrix(&gfx[0], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_LOAD);
|
||||
gSPDisplayList(&gfx[1], dList);
|
||||
@@ -690,7 +690,7 @@ Gfx* SkelAnime_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, void** skeleton
|
||||
gfx);
|
||||
}
|
||||
|
||||
Matrix_StatePop();
|
||||
Matrix_Pop();
|
||||
|
||||
if (limb->sibling != LIMB_DONE) {
|
||||
gfx = SkelAnime_DrawLimb(globalCtx, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor,
|
||||
@@ -716,7 +716,7 @@ Gfx* SkelAnime_Draw(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Matrix_StatePush();
|
||||
Matrix_Push();
|
||||
|
||||
rootLimb = Lib_SegmentedToVirtual(skeleton[0]);
|
||||
|
||||
@@ -729,7 +729,7 @@ Gfx* SkelAnime_Draw(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable
|
||||
dList = rootLimb->dList;
|
||||
|
||||
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, 1, &dList, &pos, &rot, actor, &gfx)) {
|
||||
Matrix_JointPosition(&pos, &rot);
|
||||
Matrix_TranslateRotateZYX(&pos, &rot);
|
||||
if (dList != NULL) {
|
||||
gSPMatrix(&gfx[0], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_LOAD);
|
||||
gSPDisplayList(&gfx[1], dList);
|
||||
@@ -746,7 +746,7 @@ Gfx* SkelAnime_Draw(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable
|
||||
actor, gfx);
|
||||
}
|
||||
|
||||
Matrix_StatePop();
|
||||
Matrix_Pop();
|
||||
|
||||
return gfx;
|
||||
}
|
||||
@@ -763,7 +763,7 @@ Gfx* SkelAnime_DrawFlexLimb(GlobalContext* globalCtx, s32 limbIndex, void** skel
|
||||
Vec3f pos;
|
||||
Vec3s rot;
|
||||
|
||||
Matrix_StatePush();
|
||||
Matrix_Push();
|
||||
|
||||
limb = Lib_SegmentedToVirtual(skeleton[limbIndex]);
|
||||
limbIndex++;
|
||||
@@ -776,7 +776,7 @@ Gfx* SkelAnime_DrawFlexLimb(GlobalContext* globalCtx, s32 limbIndex, void** skel
|
||||
newDList = limbDList = limb->dList;
|
||||
|
||||
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &newDList, &pos, &rot, actor, &gfx)) {
|
||||
Matrix_JointPosition(&pos, &rot);
|
||||
Matrix_TranslateRotateZYX(&pos, &rot);
|
||||
if (newDList != NULL) {
|
||||
gSPMatrix(&gfx[0], Matrix_ToMtx(*mtx), G_MTX_LOAD);
|
||||
gSPDisplayList(&gfx[1], newDList);
|
||||
@@ -799,7 +799,7 @@ Gfx* SkelAnime_DrawFlexLimb(GlobalContext* globalCtx, s32 limbIndex, void** skel
|
||||
actor, mtx, gfx);
|
||||
}
|
||||
|
||||
Matrix_StatePop();
|
||||
Matrix_Pop();
|
||||
|
||||
if (limb->sibling != LIMB_DONE) {
|
||||
gfx = SkelAnime_DrawFlexLimb(globalCtx, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw,
|
||||
@@ -832,7 +832,7 @@ Gfx* SkelAnime_DrawFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jointT
|
||||
|
||||
gSPSegment(gfx++, 0x0D, mtx);
|
||||
|
||||
Matrix_StatePush();
|
||||
Matrix_Push();
|
||||
|
||||
rootLimb = Lib_SegmentedToVirtual(skeleton[0]);
|
||||
|
||||
@@ -845,7 +845,7 @@ Gfx* SkelAnime_DrawFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jointT
|
||||
newDList = limbDList = rootLimb->dList;
|
||||
|
||||
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, 1, &newDList, &pos, &rot, actor, &gfx)) {
|
||||
Matrix_JointPosition(&pos, &rot);
|
||||
Matrix_TranslateRotateZYX(&pos, &rot);
|
||||
if (newDList != NULL) {
|
||||
gSPMatrix(&gfx[0], Matrix_ToMtx(mtx), G_MTX_LOAD);
|
||||
gSPDisplayList(&gfx[1], newDList);
|
||||
@@ -868,7 +868,7 @@ Gfx* SkelAnime_DrawFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jointT
|
||||
actor, &mtx, gfx);
|
||||
}
|
||||
|
||||
Matrix_StatePop();
|
||||
Matrix_Pop();
|
||||
|
||||
return gfx;
|
||||
}
|
||||
|
||||
+9
-9
@@ -13,13 +13,13 @@ void Skin_UpdateVertices(MtxF* mtx, SkinVertex* skinVertices, SkinLimbModif* mod
|
||||
Vec3f normal;
|
||||
Vec3f sp44;
|
||||
|
||||
wTemp.x = mtx->wx;
|
||||
wTemp.y = mtx->wy;
|
||||
wTemp.z = mtx->wz;
|
||||
wTemp.x = mtx->xw;
|
||||
wTemp.y = mtx->yw;
|
||||
wTemp.z = mtx->zw;
|
||||
|
||||
mtx->wx = 0.0f;
|
||||
mtx->wy = 0.0f;
|
||||
mtx->wz = 0.0f;
|
||||
mtx->xw = 0.0f;
|
||||
mtx->yw = 0.0f;
|
||||
mtx->zw = 0.0f;
|
||||
|
||||
for (vertexEntry = skinVertices; vertexEntry < &skinVertices[modifEntry->vtxCount]; vertexEntry++) {
|
||||
vtx = &vtxBuf[vertexEntry->index];
|
||||
@@ -39,9 +39,9 @@ void Skin_UpdateVertices(MtxF* mtx, SkinVertex* skinVertices, SkinLimbModif* mod
|
||||
vtx->n.n[2] = normal.z;
|
||||
}
|
||||
|
||||
mtx->wx = wTemp.x;
|
||||
mtx->wy = wTemp.y;
|
||||
mtx->wz = wTemp.z;
|
||||
mtx->xw = wTemp.x;
|
||||
mtx->yw = wTemp.y;
|
||||
mtx->zw = wTemp.z;
|
||||
}
|
||||
|
||||
void Skin_ApplyLimbModifications(GraphicsContext* gfxCtx, Skin* skin, s32 limbIndex, s32 arg3) {
|
||||
|
||||
+264
-265
@@ -1,13 +1,11 @@
|
||||
#include "global.h"
|
||||
|
||||
// clang-format off
|
||||
MtxF sMtxFClear = {
|
||||
1.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 1.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 1.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 1.0f,
|
||||
};
|
||||
// clang-format on
|
||||
MtxF sMtxFClear = { {
|
||||
{ 1.0f, 0.0f, 0.0f, 0.0f },
|
||||
{ 0.0f, 1.0f, 0.0f, 0.0f },
|
||||
{ 0.0f, 0.0f, 1.0f, 0.0f },
|
||||
{ 0.0f, 0.0f, 0.0f, 1.0f },
|
||||
} };
|
||||
|
||||
/**
|
||||
* Multiplies a 4 component row vector [ src , 1 ] by the matrix mf and writes the resulting 4 components to xyzDest
|
||||
@@ -16,10 +14,10 @@ MtxF sMtxFClear = {
|
||||
* \f[ [\texttt{xyzDest}, \texttt{wDest}] = [\texttt{src}, 1] \cdot [mf] \f]
|
||||
*/
|
||||
void SkinMatrix_Vec3fMtxFMultXYZW(MtxF* mf, Vec3f* src, Vec3f* xyzDest, f32* wDest) {
|
||||
xyzDest->x = mf->wx + ((src->x * mf->xx) + (src->y * mf->yx) + (src->z * mf->zx));
|
||||
xyzDest->y = mf->wy + ((src->x * mf->xy) + (src->y * mf->yy) + (src->z * mf->zy));
|
||||
xyzDest->z = mf->wz + ((src->x * mf->xz) + (src->y * mf->yz) + (src->z * mf->zz));
|
||||
*wDest = mf->ww + ((src->x * mf->xw) + (src->y * mf->yw) + (src->z * mf->zw));
|
||||
xyzDest->x = mf->xw + ((src->x * mf->xx) + (src->y * mf->xy) + (src->z * mf->xz));
|
||||
xyzDest->y = mf->yw + ((src->x * mf->yx) + (src->y * mf->yy) + (src->z * mf->yz));
|
||||
xyzDest->z = mf->zw + ((src->x * mf->zx) + (src->y * mf->zy) + (src->z * mf->zz));
|
||||
*wDest = mf->ww + ((src->x * mf->wx) + (src->y * mf->wy) + (src->z * mf->wz));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -29,21 +27,22 @@ void SkinMatrix_Vec3fMtxFMultXYZW(MtxF* mf, Vec3f* src, Vec3f* xyzDest, f32* wDe
|
||||
*/
|
||||
void SkinMatrix_Vec3fMtxFMultXYZ(MtxF* mf, Vec3f* src, Vec3f* dest) {
|
||||
f32 mx = mf->xx;
|
||||
f32 my = mf->yx;
|
||||
f32 mz = mf->zx;
|
||||
f32 mw = mf->wx;
|
||||
f32 my = mf->xy;
|
||||
f32 mz = mf->xz;
|
||||
f32 mw = mf->xw;
|
||||
|
||||
dest->x = mw + ((src->x * mx) + (src->y * my) + (src->z * mz));
|
||||
|
||||
mx = mf->xy;
|
||||
mx = mf->yx;
|
||||
my = mf->yy;
|
||||
mz = mf->zy;
|
||||
mw = mf->wy;
|
||||
mz = mf->yz;
|
||||
mw = mf->yw;
|
||||
dest->y = mw + ((src->x * mx) + (src->y * my) + (src->z * mz));
|
||||
|
||||
mx = mf->xz;
|
||||
my = mf->yz;
|
||||
mx = mf->zx;
|
||||
my = mf->zy;
|
||||
mz = mf->zz;
|
||||
mw = mf->wz;
|
||||
mw = mf->zw;
|
||||
dest->z = mw + ((src->x * mx) + (src->y * my) + (src->z * mz));
|
||||
}
|
||||
|
||||
@@ -59,122 +58,122 @@ void SkinMatrix_MtxFMtxFMult(MtxF* mfB, MtxF* mfA, MtxF* dest) {
|
||||
|
||||
//---COL1---
|
||||
f32 cx = mfB->xx;
|
||||
f32 cy = mfB->yx;
|
||||
f32 cz = mfB->zx;
|
||||
f32 cw = mfB->wx;
|
||||
f32 cy = mfB->xy;
|
||||
f32 cz = mfB->xz;
|
||||
f32 cw = mfB->xw;
|
||||
//--------
|
||||
|
||||
rx = mfA->xx;
|
||||
ry = mfA->xy;
|
||||
rz = mfA->xz;
|
||||
rw = mfA->xw;
|
||||
ry = mfA->yx;
|
||||
rz = mfA->zx;
|
||||
rw = mfA->wx;
|
||||
dest->xx = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw);
|
||||
|
||||
rx = mfA->yx;
|
||||
rx = mfA->xy;
|
||||
ry = mfA->yy;
|
||||
rz = mfA->yz;
|
||||
rw = mfA->yw;
|
||||
dest->yx = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw);
|
||||
|
||||
rx = mfA->zx;
|
||||
ry = mfA->zy;
|
||||
rz = mfA->zz;
|
||||
rw = mfA->zw;
|
||||
dest->zx = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw);
|
||||
|
||||
rx = mfA->wx;
|
||||
ry = mfA->wy;
|
||||
rz = mfA->wz;
|
||||
rw = mfA->ww;
|
||||
dest->wx = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw);
|
||||
|
||||
//---2Col---
|
||||
cx = mfB->xy;
|
||||
cy = mfB->yy;
|
||||
cz = mfB->zy;
|
||||
cw = mfB->wy;
|
||||
//--------
|
||||
rx = mfA->xx;
|
||||
ry = mfA->xy;
|
||||
rz = mfA->xz;
|
||||
rw = mfA->xw;
|
||||
rz = mfA->zy;
|
||||
rw = mfA->wy;
|
||||
dest->xy = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw);
|
||||
|
||||
rx = mfA->yx;
|
||||
ry = mfA->yy;
|
||||
rz = mfA->yz;
|
||||
rw = mfA->yw;
|
||||
dest->yy = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw);
|
||||
|
||||
rx = mfA->zx;
|
||||
ry = mfA->zy;
|
||||
rx = mfA->xz;
|
||||
ry = mfA->yz;
|
||||
rz = mfA->zz;
|
||||
rw = mfA->zw;
|
||||
dest->zy = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw);
|
||||
|
||||
rx = mfA->wx;
|
||||
ry = mfA->wy;
|
||||
rz = mfA->wz;
|
||||
rw = mfA->ww;
|
||||
dest->wy = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw);
|
||||
|
||||
//---3Col---
|
||||
cx = mfB->xz;
|
||||
cy = mfB->yz;
|
||||
cz = mfB->zz;
|
||||
cw = mfB->wz;
|
||||
//--------
|
||||
rx = mfA->xx;
|
||||
ry = mfA->xy;
|
||||
rz = mfA->xz;
|
||||
rw = mfA->xw;
|
||||
rw = mfA->wz;
|
||||
dest->xz = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw);
|
||||
|
||||
rx = mfA->yx;
|
||||
rx = mfA->xw;
|
||||
ry = mfA->yw;
|
||||
rz = mfA->zw;
|
||||
rw = mfA->ww;
|
||||
dest->xw = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw);
|
||||
|
||||
//---2Col---
|
||||
cx = mfB->yx;
|
||||
cy = mfB->yy;
|
||||
cz = mfB->yz;
|
||||
cw = mfB->yw;
|
||||
//--------
|
||||
rx = mfA->xx;
|
||||
ry = mfA->yx;
|
||||
rz = mfA->zx;
|
||||
rw = mfA->wx;
|
||||
dest->yx = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw);
|
||||
|
||||
rx = mfA->xy;
|
||||
ry = mfA->yy;
|
||||
rz = mfA->yz;
|
||||
rw = mfA->yw;
|
||||
rz = mfA->zy;
|
||||
rw = mfA->wy;
|
||||
dest->yy = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw);
|
||||
|
||||
rx = mfA->xz;
|
||||
ry = mfA->yz;
|
||||
rz = mfA->zz;
|
||||
rw = mfA->wz;
|
||||
dest->yz = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw);
|
||||
|
||||
rx = mfA->zx;
|
||||
ry = mfA->zy;
|
||||
rx = mfA->xw;
|
||||
ry = mfA->yw;
|
||||
rz = mfA->zw;
|
||||
rw = mfA->ww;
|
||||
dest->yw = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw);
|
||||
|
||||
//---3Col---
|
||||
cx = mfB->zx;
|
||||
cy = mfB->zy;
|
||||
cz = mfB->zz;
|
||||
cw = mfB->zw;
|
||||
//--------
|
||||
rx = mfA->xx;
|
||||
ry = mfA->yx;
|
||||
rz = mfA->zx;
|
||||
rw = mfA->wx;
|
||||
dest->zx = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw);
|
||||
|
||||
rx = mfA->xy;
|
||||
ry = mfA->yy;
|
||||
rz = mfA->zy;
|
||||
rw = mfA->wy;
|
||||
dest->zy = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw);
|
||||
|
||||
rx = mfA->xz;
|
||||
ry = mfA->yz;
|
||||
rz = mfA->zz;
|
||||
rw = mfA->zw;
|
||||
rw = mfA->wz;
|
||||
dest->zz = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw);
|
||||
|
||||
rx = mfA->wx;
|
||||
ry = mfA->wy;
|
||||
rz = mfA->wz;
|
||||
rx = mfA->xw;
|
||||
ry = mfA->yw;
|
||||
rz = mfA->zw;
|
||||
rw = mfA->ww;
|
||||
dest->wz = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw);
|
||||
dest->zw = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw);
|
||||
|
||||
//---4Col---
|
||||
cx = mfB->xw;
|
||||
cy = mfB->yw;
|
||||
cz = mfB->zw;
|
||||
cx = mfB->wx;
|
||||
cy = mfB->wy;
|
||||
cz = mfB->wz;
|
||||
cw = mfB->ww;
|
||||
//--------
|
||||
rx = mfA->xx;
|
||||
ry = mfA->xy;
|
||||
rz = mfA->xz;
|
||||
rw = mfA->xw;
|
||||
dest->xw = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw);
|
||||
ry = mfA->yx;
|
||||
rz = mfA->zx;
|
||||
rw = mfA->wx;
|
||||
dest->wx = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw);
|
||||
|
||||
rx = mfA->yx;
|
||||
rx = mfA->xy;
|
||||
ry = mfA->yy;
|
||||
rz = mfA->yz;
|
||||
rw = mfA->yw;
|
||||
dest->yw = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw);
|
||||
rz = mfA->zy;
|
||||
rw = mfA->wy;
|
||||
dest->wy = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw);
|
||||
|
||||
rx = mfA->zx;
|
||||
ry = mfA->zy;
|
||||
rx = mfA->xz;
|
||||
ry = mfA->yz;
|
||||
rz = mfA->zz;
|
||||
rw = mfA->zw;
|
||||
dest->zw = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw);
|
||||
rw = mfA->wz;
|
||||
dest->wz = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw);
|
||||
|
||||
rx = mfA->wx;
|
||||
ry = mfA->wy;
|
||||
rz = mfA->wz;
|
||||
rx = mfA->xw;
|
||||
ry = mfA->yw;
|
||||
rz = mfA->zw;
|
||||
rw = mfA->ww;
|
||||
dest->ww = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw);
|
||||
}
|
||||
@@ -188,39 +187,39 @@ void SkinMatrix_GetClear(MtxF** mfp) {
|
||||
|
||||
void SkinMatrix_Clear(MtxF* mf) {
|
||||
mf->xx = 1.0f;
|
||||
mf->xy = 0.0f;
|
||||
mf->xz = 0.0f;
|
||||
mf->xw = 0.0f;
|
||||
mf->yx = 0.0f;
|
||||
mf->yy = 1.0f;
|
||||
mf->yz = 0.0f;
|
||||
mf->yw = 0.0f;
|
||||
mf->zx = 0.0f;
|
||||
mf->zy = 0.0f;
|
||||
mf->zz = 1.0f;
|
||||
mf->zw = 0.0f;
|
||||
mf->wx = 0.0f;
|
||||
mf->xy = 0.0f;
|
||||
mf->yy = 1.0f;
|
||||
mf->zy = 0.0f;
|
||||
mf->wy = 0.0f;
|
||||
mf->xz = 0.0f;
|
||||
mf->yz = 0.0f;
|
||||
mf->zz = 1.0f;
|
||||
mf->wz = 0.0f;
|
||||
mf->xw = 0.0f;
|
||||
mf->yw = 0.0f;
|
||||
mf->zw = 0.0f;
|
||||
mf->ww = 1.0f;
|
||||
}
|
||||
|
||||
void SkinMatrix_MtxFCopy(MtxF* src, MtxF* dest) {
|
||||
dest->xx = src->xx;
|
||||
dest->xy = src->xy;
|
||||
dest->xz = src->xz;
|
||||
dest->xw = src->xw;
|
||||
dest->yx = src->yx;
|
||||
dest->yy = src->yy;
|
||||
dest->yz = src->yz;
|
||||
dest->yw = src->yw;
|
||||
dest->zx = src->zx;
|
||||
dest->zy = src->zy;
|
||||
dest->zz = src->zz;
|
||||
dest->zw = src->zw;
|
||||
dest->wx = src->wx;
|
||||
dest->xy = src->xy;
|
||||
dest->yy = src->yy;
|
||||
dest->zy = src->zy;
|
||||
dest->wy = src->wy;
|
||||
dest->xz = src->xz;
|
||||
dest->yz = src->yz;
|
||||
dest->zz = src->zz;
|
||||
dest->wz = src->wz;
|
||||
dest->xw = src->xw;
|
||||
dest->yw = src->yw;
|
||||
dest->zw = src->zw;
|
||||
dest->ww = src->ww;
|
||||
}
|
||||
|
||||
@@ -282,18 +281,18 @@ s32 SkinMatrix_Invert(MtxF* src, MtxF* dest) {
|
||||
* Produces a matrix which scales x,y,z components of vectors or x,y,z rows of matrices (when applied on LHS)
|
||||
*/
|
||||
void SkinMatrix_SetScale(MtxF* mf, f32 x, f32 y, f32 z) {
|
||||
mf->xy = 0.0f;
|
||||
mf->xz = 0.0f;
|
||||
mf->xw = 0.0f;
|
||||
mf->yx = 0.0f;
|
||||
mf->yz = 0.0f;
|
||||
mf->yw = 0.0f;
|
||||
mf->zx = 0.0f;
|
||||
mf->zy = 0.0f;
|
||||
mf->zw = 0.0f;
|
||||
mf->wx = 0.0f;
|
||||
mf->xy = 0.0f;
|
||||
mf->zy = 0.0f;
|
||||
mf->wy = 0.0f;
|
||||
mf->xz = 0.0f;
|
||||
mf->yz = 0.0f;
|
||||
mf->wz = 0.0f;
|
||||
mf->xw = 0.0f;
|
||||
mf->yw = 0.0f;
|
||||
mf->zw = 0.0f;
|
||||
mf->ww = 1.0f;
|
||||
mf->xx = x;
|
||||
mf->yy = y;
|
||||
@@ -307,16 +306,16 @@ void SkinMatrix_SetRotateRPY(MtxF* mf, s16 roll, s16 pitch, s16 yaw) {
|
||||
f32 cos2;
|
||||
f32 sin = Math_SinS(yaw);
|
||||
f32 cos = Math_CosS(yaw);
|
||||
f32 yx;
|
||||
f32 xy;
|
||||
f32 sin2;
|
||||
f32 zx;
|
||||
f32 xz;
|
||||
f32 yy;
|
||||
f32 zy;
|
||||
f32 yz;
|
||||
|
||||
mf->yy = cos;
|
||||
mf->yx = -sin;
|
||||
mf->xw = mf->yw = mf->zw = 0;
|
||||
mf->xy = -sin;
|
||||
mf->wx = mf->wy = mf->wz = 0;
|
||||
mf->xw = mf->yw = mf->zw = 0;
|
||||
mf->ww = 1;
|
||||
|
||||
if (pitch != 0) {
|
||||
@@ -324,19 +323,19 @@ void SkinMatrix_SetRotateRPY(MtxF* mf, s16 roll, s16 pitch, s16 yaw) {
|
||||
cos2 = Math_CosS(pitch);
|
||||
|
||||
mf->xx = cos * cos2;
|
||||
mf->zx = cos * sin2;
|
||||
mf->xz = cos * sin2;
|
||||
|
||||
mf->xy = sin * cos2;
|
||||
mf->zy = sin * sin2;
|
||||
mf->xz = -sin2;
|
||||
mf->yx = sin * cos2;
|
||||
mf->yz = sin * sin2;
|
||||
mf->zx = -sin2;
|
||||
mf->zz = cos2;
|
||||
} else {
|
||||
mf->xx = cos;
|
||||
if (1) {}
|
||||
if (1) {}
|
||||
zx = sin; // required to match
|
||||
mf->xy = sin;
|
||||
mf->xz = mf->zx = mf->zy = 0;
|
||||
xz = sin; // required to match
|
||||
mf->yx = sin;
|
||||
mf->zx = mf->xz = mf->yz = 0;
|
||||
mf->zz = 1;
|
||||
}
|
||||
|
||||
@@ -344,22 +343,22 @@ void SkinMatrix_SetRotateRPY(MtxF* mf, s16 roll, s16 pitch, s16 yaw) {
|
||||
sin2 = Math_SinS(roll);
|
||||
cos2 = Math_CosS(roll);
|
||||
|
||||
yx = mf->yx;
|
||||
zx = mf->zx;
|
||||
mf->yx = (yx * cos2) + (zx * sin2);
|
||||
mf->zx = (zx * cos2) - (yx * sin2);
|
||||
xy = mf->xy;
|
||||
xz = mf->xz;
|
||||
mf->xy = (xy * cos2) + (xz * sin2);
|
||||
mf->xz = (xz * cos2) - (xy * sin2);
|
||||
|
||||
if (1) {}
|
||||
zy = mf->zy;
|
||||
yz = mf->yz;
|
||||
yy = mf->yy;
|
||||
mf->yy = (yy * cos2) + (zy * sin2);
|
||||
mf->zy = (zy * cos2) - (yy * sin2);
|
||||
mf->yy = (yy * cos2) + (yz * sin2);
|
||||
mf->yz = (yz * cos2) - (yy * sin2);
|
||||
|
||||
if (cos2) {}
|
||||
mf->yz = mf->zz * sin2;
|
||||
mf->zy = mf->zz * sin2;
|
||||
mf->zz = mf->zz * cos2;
|
||||
} else {
|
||||
mf->yz = 0;
|
||||
mf->zy = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -370,23 +369,23 @@ void SkinMatrix_SetRotateYRP(MtxF* mf, s16 yaw, s16 roll, s16 pitch) {
|
||||
f32 cos2;
|
||||
f32 sin;
|
||||
f32 cos;
|
||||
f32 xz;
|
||||
f32 zx;
|
||||
f32 sin2;
|
||||
f32 yz;
|
||||
f32 zy;
|
||||
f32 xx;
|
||||
f32 yx;
|
||||
f32 xy;
|
||||
|
||||
sin = Math_SinS(roll);
|
||||
cos = Math_CosS(roll);
|
||||
|
||||
mf->xx = cos;
|
||||
mf->xz = -sin;
|
||||
mf->zw = 0;
|
||||
mf->yw = 0;
|
||||
mf->xw = 0;
|
||||
mf->zx = -sin;
|
||||
mf->wz = 0;
|
||||
mf->wy = 0;
|
||||
mf->wx = 0;
|
||||
mf->zw = 0;
|
||||
mf->yw = 0;
|
||||
mf->xw = 0;
|
||||
mf->ww = 1;
|
||||
|
||||
if (yaw != 0) {
|
||||
@@ -394,19 +393,19 @@ void SkinMatrix_SetRotateYRP(MtxF* mf, s16 yaw, s16 roll, s16 pitch) {
|
||||
cos2 = Math_CosS(yaw);
|
||||
|
||||
mf->zz = cos * cos2;
|
||||
mf->yz = cos * sin2;
|
||||
mf->zy = cos * sin2;
|
||||
|
||||
mf->zx = sin * cos2;
|
||||
mf->yx = sin * sin2;
|
||||
mf->zy = -sin2;
|
||||
mf->xz = sin * cos2;
|
||||
mf->xy = sin * sin2;
|
||||
mf->yz = -sin2;
|
||||
mf->yy = cos2;
|
||||
} else {
|
||||
mf->zz = cos;
|
||||
if (1) {}
|
||||
if (1) {}
|
||||
yx = sin; // required to match
|
||||
mf->zx = sin;
|
||||
mf->yx = mf->yz = mf->zy = 0;
|
||||
xy = sin; // required to match
|
||||
mf->xz = sin;
|
||||
mf->xy = mf->zy = mf->yz = 0;
|
||||
mf->yy = 1;
|
||||
}
|
||||
|
||||
@@ -414,19 +413,19 @@ void SkinMatrix_SetRotateYRP(MtxF* mf, s16 yaw, s16 roll, s16 pitch) {
|
||||
sin2 = Math_SinS(pitch);
|
||||
cos2 = Math_CosS(pitch);
|
||||
xx = mf->xx;
|
||||
yx = mf->yx;
|
||||
mf->xx = (xx * cos2) + (yx * sin2);
|
||||
mf->yx = yx * cos2 - (xx * sin2);
|
||||
xy = mf->xy;
|
||||
mf->xx = (xx * cos2) + (xy * sin2);
|
||||
mf->xy = xy * cos2 - (xx * sin2);
|
||||
if (1) {}
|
||||
yz = mf->yz;
|
||||
xz = mf->xz;
|
||||
mf->xz = (xz * cos2) + (yz * sin2);
|
||||
mf->yz = (yz * cos2) - (xz * sin2);
|
||||
zy = mf->zy;
|
||||
zx = mf->zx;
|
||||
mf->zx = (zx * cos2) + (zy * sin2);
|
||||
mf->zy = (zy * cos2) - (zx * sin2);
|
||||
if (cos2) {}
|
||||
mf->xy = mf->yy * sin2;
|
||||
mf->yx = mf->yy * sin2;
|
||||
mf->yy = mf->yy * cos2;
|
||||
} else {
|
||||
mf->xy = 0;
|
||||
mf->yx = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -434,22 +433,22 @@ void SkinMatrix_SetRotateYRP(MtxF* mf, s16 yaw, s16 roll, s16 pitch) {
|
||||
* Produces a matrix which translates a vector by amounts in the x, y and z directions
|
||||
*/
|
||||
void SkinMatrix_SetTranslate(MtxF* mf, f32 x, f32 y, f32 z) {
|
||||
mf->xy = 0.0f;
|
||||
mf->xz = 0.0f;
|
||||
mf->xw = 0.0f;
|
||||
mf->yx = 0.0f;
|
||||
mf->yz = 0.0f;
|
||||
mf->yw = 0.0f;
|
||||
mf->zx = 0.0f;
|
||||
mf->wx = 0.0f;
|
||||
mf->xy = 0.0f;
|
||||
mf->zy = 0.0f;
|
||||
mf->zw = 0.0f;
|
||||
mf->wy = 0.0f;
|
||||
mf->xz = 0.0f;
|
||||
mf->yz = 0.0f;
|
||||
mf->wz = 0.0f;
|
||||
mf->xx = 1.0f;
|
||||
mf->yy = 1.0f;
|
||||
mf->zz = 1.0f;
|
||||
mf->ww = 1.0f;
|
||||
mf->wx = x;
|
||||
mf->wy = y;
|
||||
mf->wz = z;
|
||||
mf->xw = x;
|
||||
mf->yw = y;
|
||||
mf->zw = z;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -515,19 +514,19 @@ void SkinMatrix_MtxFToMtx(MtxF* src, Mtx* dest) {
|
||||
m1[0] = (temp >> 0x10);
|
||||
m1[16 + 0] = temp & 0xFFFF;
|
||||
|
||||
temp = src->xy * 0x10000;
|
||||
temp = src->yx * 0x10000;
|
||||
m1[1] = (temp >> 0x10);
|
||||
m1[16 + 1] = temp & 0xFFFF;
|
||||
|
||||
temp = src->xz * 0x10000;
|
||||
temp = src->zx * 0x10000;
|
||||
m1[2] = (temp >> 0x10);
|
||||
m1[16 + 2] = temp & 0xFFFF;
|
||||
|
||||
temp = src->xw * 0x10000;
|
||||
temp = src->wx * 0x10000;
|
||||
m1[3] = (temp >> 0x10);
|
||||
m1[16 + 3] = temp & 0xFFFF;
|
||||
|
||||
temp = src->yx * 0x10000;
|
||||
temp = src->xy * 0x10000;
|
||||
m1[4] = (temp >> 0x10);
|
||||
m1[16 + 4] = temp & 0xFFFF;
|
||||
|
||||
@@ -535,19 +534,19 @@ void SkinMatrix_MtxFToMtx(MtxF* src, Mtx* dest) {
|
||||
m1[5] = (temp >> 0x10);
|
||||
m1[16 + 5] = temp & 0xFFFF;
|
||||
|
||||
temp = src->yz * 0x10000;
|
||||
temp = src->zy * 0x10000;
|
||||
m1[6] = (temp >> 0x10);
|
||||
m1[16 + 6] = temp & 0xFFFF;
|
||||
|
||||
temp = src->yw * 0x10000;
|
||||
temp = src->wy * 0x10000;
|
||||
m1[7] = (temp >> 0x10);
|
||||
m1[16 + 7] = temp & 0xFFFF;
|
||||
|
||||
temp = src->zx * 0x10000;
|
||||
temp = src->xz * 0x10000;
|
||||
m1[8] = (temp >> 0x10);
|
||||
m1[16 + 8] = temp & 0xFFFF;
|
||||
|
||||
temp = src->zy * 0x10000;
|
||||
temp = src->yz * 0x10000;
|
||||
m1[9] = (temp >> 0x10);
|
||||
m2[9] = temp & 0xFFFF;
|
||||
|
||||
@@ -555,19 +554,19 @@ void SkinMatrix_MtxFToMtx(MtxF* src, Mtx* dest) {
|
||||
m1[10] = (temp >> 0x10);
|
||||
m2[10] = temp & 0xFFFF;
|
||||
|
||||
temp = src->zw * 0x10000;
|
||||
temp = src->wz * 0x10000;
|
||||
m1[11] = (temp >> 0x10);
|
||||
m2[11] = temp & 0xFFFF;
|
||||
|
||||
temp = src->wx * 0x10000;
|
||||
temp = src->xw * 0x10000;
|
||||
m1[12] = (temp >> 0x10);
|
||||
m2[12] = temp & 0xFFFF;
|
||||
|
||||
temp = src->wy * 0x10000;
|
||||
temp = src->yw * 0x10000;
|
||||
m1[13] = (temp >> 0x10);
|
||||
m2[13] = temp & 0xFFFF;
|
||||
|
||||
temp = src->wz * 0x10000;
|
||||
temp = src->zw * 0x10000;
|
||||
m1[14] = (temp >> 0x10);
|
||||
m2[14] = temp & 0xFFFF;
|
||||
|
||||
@@ -612,21 +611,21 @@ void SkinMatrix_SetRotateAroundVec(MtxF* mf, s16 a, f32 x, f32 y, f32 z) {
|
||||
xz = x * z;
|
||||
|
||||
mf->xx = (1.0f - xx) * cosA + xx;
|
||||
mf->xy = (1.0f - cosA) * xy + z * sinA;
|
||||
mf->xz = (1.0f - cosA) * xz - y * sinA;
|
||||
mf->xw = 0.0f;
|
||||
mf->yx = (1.0f - cosA) * xy + z * sinA;
|
||||
mf->zx = (1.0f - cosA) * xz - y * sinA;
|
||||
mf->wx = 0.0f;
|
||||
|
||||
mf->yx = (1.0f - cosA) * xy - z * sinA;
|
||||
mf->xy = (1.0f - cosA) * xy - z * sinA;
|
||||
mf->yy = (1.0f - yy) * cosA + yy;
|
||||
mf->yz = (1.0f - cosA) * yz + x * sinA;
|
||||
mf->yw = 0.0f;
|
||||
mf->zy = (1.0f - cosA) * yz + x * sinA;
|
||||
mf->wy = 0.0f;
|
||||
|
||||
mf->zx = (1.0f - cosA) * xz + y * sinA;
|
||||
mf->zy = (1.0f - cosA) * yz - x * sinA;
|
||||
mf->xz = (1.0f - cosA) * xz + y * sinA;
|
||||
mf->yz = (1.0f - cosA) * yz - x * sinA;
|
||||
mf->zz = (1.0f - zz) * cosA + zz;
|
||||
mf->zw = 0.0f;
|
||||
mf->wz = 0.0f;
|
||||
|
||||
mf->wx = mf->wy = mf->wz = 0.0f;
|
||||
mf->xw = mf->yw = mf->zw = 0.0f;
|
||||
mf->ww = 1.0f;
|
||||
}
|
||||
|
||||
@@ -642,27 +641,27 @@ void SkinMatrix_SetXRotation(MtxF* mf, s16 a) {
|
||||
cosA = 1.0f;
|
||||
}
|
||||
|
||||
mf->xy = 0.0f;
|
||||
mf->xz = 0.0f;
|
||||
mf->xw = 0.0f;
|
||||
|
||||
mf->yx = 0.0f;
|
||||
mf->yw = 0.0f;
|
||||
|
||||
mf->zx = 0.0f;
|
||||
mf->zw = 0.0f;
|
||||
|
||||
mf->wx = 0.0f;
|
||||
|
||||
mf->xy = 0.0f;
|
||||
mf->wy = 0.0f;
|
||||
|
||||
mf->xz = 0.0f;
|
||||
mf->wz = 0.0f;
|
||||
|
||||
mf->xw = 0.0f;
|
||||
mf->yw = 0.0f;
|
||||
mf->zw = 0.0f;
|
||||
|
||||
mf->xx = 1.0f;
|
||||
mf->ww = 1.0f;
|
||||
|
||||
mf->yy = cosA;
|
||||
mf->zz = cosA;
|
||||
mf->yz = sinA;
|
||||
mf->zy = -sinA;
|
||||
mf->zy = sinA;
|
||||
mf->yz = -sinA;
|
||||
}
|
||||
|
||||
void SkinMatrix_MulXRotation(MtxF* mf, s16 a) {
|
||||
@@ -675,25 +674,25 @@ void SkinMatrix_MulXRotation(MtxF* mf, s16 a) {
|
||||
sinA = Math_SinS(a);
|
||||
cosA = Math_CosS(a);
|
||||
|
||||
ry = mf->yx;
|
||||
rz = mf->zx;
|
||||
mf->yx = ry * cosA + rz * sinA;
|
||||
mf->zx = rz * cosA - ry * sinA;
|
||||
ry = mf->xy;
|
||||
rz = mf->xz;
|
||||
mf->xy = ry * cosA + rz * sinA;
|
||||
mf->xz = rz * cosA - ry * sinA;
|
||||
|
||||
ry = mf->yy;
|
||||
rz = mf->zy;
|
||||
rz = mf->yz;
|
||||
mf->yy = ry * cosA + rz * sinA;
|
||||
mf->zy = rz * cosA - ry * sinA;
|
||||
mf->yz = rz * cosA - ry * sinA;
|
||||
|
||||
ry = mf->yz;
|
||||
ry = mf->zy;
|
||||
rz = mf->zz;
|
||||
mf->yz = ry * cosA + rz * sinA;
|
||||
mf->zy = ry * cosA + rz * sinA;
|
||||
mf->zz = rz * cosA - ry * sinA;
|
||||
|
||||
ry = mf->yw;
|
||||
rz = mf->zw;
|
||||
mf->yw = ry * cosA + rz * sinA;
|
||||
mf->zw = rz * cosA - ry * sinA;
|
||||
ry = mf->wy;
|
||||
rz = mf->wz;
|
||||
mf->wy = ry * cosA + rz * sinA;
|
||||
mf->wz = rz * cosA - ry * sinA;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -709,27 +708,27 @@ void SkinMatrix_SetYRotation(MtxF* mf, s16 a) {
|
||||
cosA = 1.0f;
|
||||
}
|
||||
|
||||
mf->xy = 0.0f;
|
||||
mf->xw = 0.0f;
|
||||
|
||||
mf->yx = 0.0f;
|
||||
mf->yz = 0.0f;
|
||||
mf->yw = 0.0f;
|
||||
|
||||
mf->zy = 0.0f;
|
||||
mf->zw = 0.0f;
|
||||
|
||||
mf->wx = 0.0f;
|
||||
|
||||
mf->xy = 0.0f;
|
||||
mf->zy = 0.0f;
|
||||
mf->wy = 0.0f;
|
||||
|
||||
mf->yz = 0.0f;
|
||||
mf->wz = 0.0f;
|
||||
|
||||
mf->xw = 0.0f;
|
||||
mf->yw = 0.0f;
|
||||
mf->zw = 0.0f;
|
||||
|
||||
mf->yy = 1.0f;
|
||||
mf->ww = 1.0f;
|
||||
|
||||
mf->xx = cosA;
|
||||
mf->zz = cosA;
|
||||
mf->xz = -sinA;
|
||||
mf->zx = sinA;
|
||||
mf->zx = -sinA;
|
||||
mf->xz = sinA;
|
||||
}
|
||||
|
||||
void SkinMatrix_MulYRotation(MtxF* mf, s16 a) {
|
||||
@@ -743,24 +742,24 @@ void SkinMatrix_MulYRotation(MtxF* mf, s16 a) {
|
||||
cosA = Math_CosS(a);
|
||||
|
||||
rx = mf->xx;
|
||||
rz = mf->zx;
|
||||
rz = mf->xz;
|
||||
mf->xx = rx * cosA - rz * sinA;
|
||||
mf->zx = rx * sinA + rz * cosA;
|
||||
mf->xz = rx * sinA + rz * cosA;
|
||||
|
||||
rx = mf->xy;
|
||||
rz = mf->zy;
|
||||
mf->xy = rx * cosA - rz * sinA;
|
||||
mf->zy = rx * sinA + rz * cosA;
|
||||
rx = mf->yx;
|
||||
rz = mf->yz;
|
||||
mf->yx = rx * cosA - rz * sinA;
|
||||
mf->yz = rx * sinA + rz * cosA;
|
||||
|
||||
rx = mf->xz;
|
||||
rx = mf->zx;
|
||||
rz = mf->zz;
|
||||
mf->xz = rx * cosA - rz * sinA;
|
||||
mf->zx = rx * cosA - rz * sinA;
|
||||
mf->zz = rx * sinA + rz * cosA;
|
||||
|
||||
rx = mf->xw;
|
||||
rz = mf->zw;
|
||||
mf->xw = rx * cosA - rz * sinA;
|
||||
mf->zw = rx * sinA + rz * cosA;
|
||||
rx = mf->wx;
|
||||
rz = mf->wz;
|
||||
mf->wx = rx * cosA - rz * sinA;
|
||||
mf->wz = rx * sinA + rz * cosA;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -776,25 +775,25 @@ void SkinMatrix_SetZRotation(MtxF* mf, s16 a) {
|
||||
cosA = 1.0f;
|
||||
}
|
||||
|
||||
mf->xz = 0.0f;
|
||||
mf->xw = 0.0f;
|
||||
|
||||
mf->yz = 0.0f;
|
||||
mf->yw = 0.0f;
|
||||
|
||||
mf->zx = 0.0f;
|
||||
mf->zy = 0.0f;
|
||||
mf->zw = 0.0f;
|
||||
|
||||
mf->wx = 0.0f;
|
||||
|
||||
mf->zy = 0.0f;
|
||||
mf->wy = 0.0f;
|
||||
|
||||
mf->xz = 0.0f;
|
||||
mf->yz = 0.0f;
|
||||
mf->wz = 0.0f;
|
||||
|
||||
mf->xw = 0.0f;
|
||||
mf->yw = 0.0f;
|
||||
mf->zw = 0.0f;
|
||||
|
||||
mf->zz = 1.0f;
|
||||
mf->ww = 1.0f;
|
||||
|
||||
mf->xx = cosA;
|
||||
mf->yy = cosA;
|
||||
mf->xy = sinA;
|
||||
mf->yx = -sinA;
|
||||
mf->yx = sinA;
|
||||
mf->xy = -sinA;
|
||||
}
|
||||
|
||||
+15
-15
@@ -53,7 +53,7 @@ Gfx* SubS_DrawTransformFlexLimb(GlobalContext* globalCtx, s32 limbIndex, void**
|
||||
Vec3f pos;
|
||||
Vec3s rot;
|
||||
|
||||
Matrix_StatePush();
|
||||
Matrix_Push();
|
||||
limb = Lib_SegmentedToVirtual(skeleton[limbIndex]);
|
||||
limbIndex++;
|
||||
rot = jointTable[limbIndex];
|
||||
@@ -63,8 +63,8 @@ Gfx* SubS_DrawTransformFlexLimb(GlobalContext* globalCtx, s32 limbIndex, void**
|
||||
newDList = limbDList = limb->dList;
|
||||
|
||||
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &newDList, &pos, &rot, actor, &gfx)) {
|
||||
Matrix_JointPosition(&pos, &rot);
|
||||
Matrix_StatePush();
|
||||
Matrix_TranslateRotateZYX(&pos, &rot);
|
||||
Matrix_Push();
|
||||
|
||||
transformLimbDraw(globalCtx, limbIndex, actor, &gfx);
|
||||
|
||||
@@ -77,7 +77,7 @@ Gfx* SubS_DrawTransformFlexLimb(GlobalContext* globalCtx, s32 limbIndex, void**
|
||||
Matrix_ToMtx(*mtx);
|
||||
(*mtx)++;
|
||||
}
|
||||
Matrix_StatePop();
|
||||
Matrix_Pop();
|
||||
}
|
||||
if (postLimbDraw != NULL) {
|
||||
postLimbDraw(globalCtx, limbIndex, &limbDList, &rot, actor, &gfx);
|
||||
@@ -86,7 +86,7 @@ Gfx* SubS_DrawTransformFlexLimb(GlobalContext* globalCtx, s32 limbIndex, void**
|
||||
gfx = SubS_DrawTransformFlexLimb(globalCtx, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw,
|
||||
transformLimbDraw, actor, mtx, gfx);
|
||||
}
|
||||
Matrix_StatePop();
|
||||
Matrix_Pop();
|
||||
if (limb->sibling != LIMB_DONE) {
|
||||
gfx = SubS_DrawTransformFlexLimb(globalCtx, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw,
|
||||
transformLimbDraw, actor, mtx, gfx);
|
||||
@@ -119,7 +119,7 @@ Gfx* SubS_DrawTransformFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jo
|
||||
}
|
||||
|
||||
gSPSegment(gfx++, 0x0D, mtx);
|
||||
Matrix_StatePush();
|
||||
Matrix_Push();
|
||||
rootLimb = Lib_SegmentedToVirtual(skeleton[0]);
|
||||
pos.x = jointTable->x;
|
||||
pos.y = jointTable->y;
|
||||
@@ -129,8 +129,8 @@ Gfx* SubS_DrawTransformFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jo
|
||||
limbDList = rootLimb->dList;
|
||||
|
||||
if (overrideLimbDraw == NULL || !overrideLimbDraw(globalCtx, 1, &newDlist, &pos, &rot, actor, &gfx)) {
|
||||
Matrix_JointPosition(&pos, &rot);
|
||||
Matrix_StatePush();
|
||||
Matrix_TranslateRotateZYX(&pos, &rot);
|
||||
Matrix_Push();
|
||||
|
||||
transformLimbDraw(globalCtx, 1, actor, &gfx);
|
||||
|
||||
@@ -143,7 +143,7 @@ Gfx* SubS_DrawTransformFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jo
|
||||
Matrix_ToMtx(mtx);
|
||||
mtx++;
|
||||
}
|
||||
Matrix_StatePop();
|
||||
Matrix_Pop();
|
||||
}
|
||||
|
||||
if (postLimbDraw != NULL) {
|
||||
@@ -154,7 +154,7 @@ Gfx* SubS_DrawTransformFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jo
|
||||
gfx = SubS_DrawTransformFlexLimb(globalCtx, rootLimb->child, skeleton, jointTable, overrideLimbDraw,
|
||||
postLimbDraw, transformLimbDraw, actor, &mtx, gfx);
|
||||
}
|
||||
Matrix_StatePop();
|
||||
Matrix_Pop();
|
||||
return gfx;
|
||||
}
|
||||
|
||||
@@ -187,9 +187,9 @@ s32 SubS_UpdateLimb(s16 newRotZ, s16 newRotY, Vec3f* pos, Vec3s* rot, s32 stepRo
|
||||
Vec3s newRot;
|
||||
MtxF curState;
|
||||
|
||||
Matrix_MultiplyVector3fByState(&zeroVec, &newPos);
|
||||
Matrix_CopyCurrentState(&curState);
|
||||
func_8018219C(&curState, &newRot, MTXMODE_NEW);
|
||||
Matrix_MultVec3f(&zeroVec, &newPos);
|
||||
Matrix_Get(&curState);
|
||||
Matrix_MtxFToYXZRot(&curState, &newRot, MTXMODE_NEW);
|
||||
*pos = newPos;
|
||||
|
||||
if (!stepRot && !overrideRot) {
|
||||
@@ -538,7 +538,7 @@ void SubS_GenShadowTex(Vec3f bodyPartsPos[], Vec3f* worldPos, u8* tex, f32 tween
|
||||
pos.z = bodyPartPos->z - worldPos->z;
|
||||
}
|
||||
|
||||
Matrix_MultiplyVector3fByState(&pos, &startVec);
|
||||
Matrix_MultVec3f(&pos, &startVec);
|
||||
startCol = 64.0f + startVec.x;
|
||||
startRow = 64.0f - startVec.z;
|
||||
SubS_FillShadowTex(startCol >> 1, startRow >> 1, tex, sizes[i]);
|
||||
@@ -554,7 +554,7 @@ void SubS_DrawShadowTex(Actor* actor, GameState* gameState, u8* tex) {
|
||||
func_8012C28C(gfxCtx);
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, 100);
|
||||
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0);
|
||||
Matrix_InsertTranslation(actor->world.pos.x, 0.0f, actor->world.pos.z, MTXMODE_NEW);
|
||||
Matrix_Translate(actor->world.pos.x, 0.0f, actor->world.pos.z, MTXMODE_NEW);
|
||||
Matrix_Scale(0.6f, 1.0f, 0.6f, MTXMODE_APPLY);
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(POLY_OPA_DISP++, gShadowDL);
|
||||
|
||||
+8
-8
@@ -262,15 +262,15 @@ s32 View_StepDistortion(View* view, Mtx* projectionMtx) {
|
||||
F32_LERPIMP(view->curDistortionScale.z, view->distortionScale.z, view->distortionSpeed);
|
||||
}
|
||||
|
||||
Matrix_FromRSPMatrix(projectionMtx, &projectionMtxF);
|
||||
Matrix_SetCurrentState(&projectionMtxF);
|
||||
Matrix_RotateStateAroundXAxis(view->curDistortionDirRot.x);
|
||||
Matrix_InsertYRotation_f(view->curDistortionDirRot.y, MTXMODE_APPLY);
|
||||
Matrix_InsertZRotation_f(view->curDistortionDirRot.z, MTXMODE_APPLY);
|
||||
Matrix_MtxToMtxF(projectionMtx, &projectionMtxF);
|
||||
Matrix_Put(&projectionMtxF);
|
||||
Matrix_RotateXFApply(view->curDistortionDirRot.x);
|
||||
Matrix_RotateYF(view->curDistortionDirRot.y, MTXMODE_APPLY);
|
||||
Matrix_RotateZF(view->curDistortionDirRot.z, MTXMODE_APPLY);
|
||||
Matrix_Scale(view->curDistortionScale.x, view->curDistortionScale.y, view->curDistortionScale.z, MTXMODE_APPLY);
|
||||
Matrix_InsertZRotation_f(-view->curDistortionDirRot.z, MTXMODE_APPLY);
|
||||
Matrix_InsertYRotation_f(-view->curDistortionDirRot.y, MTXMODE_APPLY);
|
||||
Matrix_RotateStateAroundXAxis(-view->curDistortionDirRot.x);
|
||||
Matrix_RotateZF(-view->curDistortionDirRot.z, MTXMODE_APPLY);
|
||||
Matrix_RotateYF(-view->curDistortionDirRot.y, MTXMODE_APPLY);
|
||||
Matrix_RotateXFApply(-view->curDistortionDirRot.x);
|
||||
Matrix_ToMtx(projectionMtx);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
Mtx* sSkyboxDrawMatrix;
|
||||
|
||||
Mtx* SkyboxDraw_UpdateMatrix(SkyboxContext* skyboxCtx, f32 x, f32 y, f32 z) {
|
||||
Matrix_InsertTranslation(x, y, z, MTXMODE_NEW);
|
||||
Matrix_Translate(x, y, z, MTXMODE_NEW);
|
||||
Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY);
|
||||
Matrix_RotateStateAroundXAxis(skyboxCtx->rotX);
|
||||
Matrix_InsertYRotation_f(skyboxCtx->rotY, MTXMODE_APPLY);
|
||||
Matrix_InsertZRotation_f(skyboxCtx->rotZ, MTXMODE_APPLY);
|
||||
Matrix_RotateXFApply(skyboxCtx->rotX);
|
||||
Matrix_RotateYF(skyboxCtx->rotY, MTXMODE_APPLY);
|
||||
Matrix_RotateZF(skyboxCtx->rotZ, MTXMODE_APPLY);
|
||||
return Matrix_ToMtx(sSkyboxDrawMatrix);
|
||||
}
|
||||
|
||||
@@ -30,11 +30,11 @@ void SkyboxDraw_Draw(SkyboxContext* skyboxCtx, GraphicsContext* gfxCtx, s16 skyb
|
||||
|
||||
sSkyboxDrawMatrix = GRAPH_ALLOC(gfxCtx, sizeof(Mtx));
|
||||
|
||||
Matrix_InsertTranslation(x, y, z, MTXMODE_NEW);
|
||||
Matrix_Translate(x, y, z, MTXMODE_NEW);
|
||||
Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY);
|
||||
Matrix_RotateStateAroundXAxis(skyboxCtx->rotX);
|
||||
Matrix_InsertYRotation_f(skyboxCtx->rotY, MTXMODE_APPLY);
|
||||
Matrix_InsertZRotation_f(skyboxCtx->rotZ, MTXMODE_APPLY);
|
||||
Matrix_RotateXFApply(skyboxCtx->rotX);
|
||||
Matrix_RotateYF(skyboxCtx->rotY, MTXMODE_APPLY);
|
||||
Matrix_RotateZF(skyboxCtx->rotZ, MTXMODE_APPLY);
|
||||
Matrix_ToMtx(sSkyboxDrawMatrix);
|
||||
|
||||
gSPMatrix(POLY_OPA_DISP++, sSkyboxDrawMatrix, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
|
||||
Reference in New Issue
Block a user