mirror of
https://github.com/HarbourMasters/Starship.git
synced 2025-04-28 12:27:59 +03:00
Added frame interpolation markers
This commit is contained in:
parent
cd288a4c5b
commit
2cfbe01e50
13 changed files with 120 additions and 59 deletions
|
@ -66,6 +66,8 @@ extern Matrix* gGfxMatrix;
|
||||||
extern Matrix sGfxMatrixStack[];
|
extern Matrix sGfxMatrixStack[];
|
||||||
extern Matrix* gCalcMatrix;
|
extern Matrix* gCalcMatrix;
|
||||||
extern Matrix sCalcMatrixStack[];
|
extern Matrix sCalcMatrixStack[];
|
||||||
|
extern Matrix* gInterpolationMatrix;
|
||||||
|
extern Matrix sInterpolationMatrixStack[];
|
||||||
|
|
||||||
f32 Math_ModF(f32 value, f32 mod);
|
f32 Math_ModF(f32 value, f32 mod);
|
||||||
void Rand_Init(void);
|
void Rand_Init(void);
|
||||||
|
|
|
@ -1504,6 +1504,7 @@ void PlayerShot_DrawShot(PlayerShot* shot) {
|
||||||
|
|
||||||
void PlayerShot_Draw(PlayerShot* shot) {
|
void PlayerShot_Draw(PlayerShot* shot) {
|
||||||
FrameInterpolation_RecordOpenChild(shot, 0);
|
FrameInterpolation_RecordOpenChild(shot, 0);
|
||||||
|
FrameInterpolation_RecordMarker(__FILE__, __LINE__);
|
||||||
switch (shot->obj.status) {
|
switch (shot->obj.status) {
|
||||||
case SHOT_ACTIVE:
|
case SHOT_ACTIVE:
|
||||||
PlayerShot_DrawShot(shot);
|
PlayerShot_DrawShot(shot);
|
||||||
|
|
|
@ -258,6 +258,7 @@ void Background_DrawStarfield(void) {
|
||||||
if ((vx >= STAR_MARGIN) && (vx < currentScreenWidth - STAR_MARGIN) && (vy >= STAR_MARGIN) &&
|
if ((vx >= STAR_MARGIN) && (vx < currentScreenWidth - STAR_MARGIN) && (vy >= STAR_MARGIN) &&
|
||||||
(vy < currentScreenHeight - STAR_MARGIN)) {
|
(vy < currentScreenHeight - STAR_MARGIN)) {
|
||||||
FrameInterpolation_RecordOpenChild("Starfield", i);
|
FrameInterpolation_RecordOpenChild("Starfield", i);
|
||||||
|
FrameInterpolation_RecordMarker(__FILE__, __LINE__);
|
||||||
|
|
||||||
// Translate to (vx, vy) in ortho coordinates
|
// Translate to (vx, vy) in ortho coordinates
|
||||||
Matrix_Push(&gGfxMatrix);
|
Matrix_Push(&gGfxMatrix);
|
||||||
|
@ -368,6 +369,7 @@ void Background_DrawPartialStarfield(s32 yMin, s32 yMax) { // Stars that are in
|
||||||
if ((vx >= 0) && (vx < currentScreenWidth) && (yMin < vy) && (vy < yMax)) {
|
if ((vx >= 0) && (vx < currentScreenWidth) && (yMin < vy) && (vy < yMax)) {
|
||||||
// Tag the transform. Assuming TAG_STARFIELD is a defined base tag value
|
// Tag the transform. Assuming TAG_STARFIELD is a defined base tag value
|
||||||
FrameInterpolation_RecordOpenChild("SmallStarfield", i);
|
FrameInterpolation_RecordOpenChild("SmallStarfield", i);
|
||||||
|
FrameInterpolation_RecordMarker(__FILE__, __LINE__);
|
||||||
// Translate to (vx, vy) in ortho coordinates
|
// Translate to (vx, vy) in ortho coordinates
|
||||||
Matrix_Push(&gGfxMatrix);
|
Matrix_Push(&gGfxMatrix);
|
||||||
Matrix_Translate(gGfxMatrix, vx - (currentScreenWidth / 2.0f), -(vy - (currentScreenHeight / 2.0f)), 0.0f,
|
Matrix_Translate(gGfxMatrix, vx - (currentScreenWidth / 2.0f), -(vy - (currentScreenHeight / 2.0f)), 0.0f,
|
||||||
|
@ -460,6 +462,7 @@ void Background_DrawBackdrop(void) {
|
||||||
// Render the textures across the screen (left to right)
|
// Render the textures across the screen (left to right)
|
||||||
for (int i = 0; i < 6; i++) {
|
for (int i = 0; i < 6; i++) {
|
||||||
FrameInterpolation_RecordOpenChild("Backdrop", i);
|
FrameInterpolation_RecordOpenChild("Backdrop", i);
|
||||||
|
FrameInterpolation_RecordMarker(__FILE__, __LINE__);
|
||||||
|
|
||||||
switch (gCurrentLevel) {
|
switch (gCurrentLevel) {
|
||||||
case LEVEL_VERSUS:
|
case LEVEL_VERSUS:
|
||||||
|
@ -510,6 +513,7 @@ void Background_DrawBackdrop(void) {
|
||||||
// Render the textures across a wider range to cover the screen
|
// Render the textures across a wider range to cover the screen
|
||||||
for (int i = 0; i < 10; i++) {
|
for (int i = 0; i < 10; i++) {
|
||||||
FrameInterpolation_RecordOpenChild("Backdrop", i);
|
FrameInterpolation_RecordOpenChild("Backdrop", i);
|
||||||
|
FrameInterpolation_RecordMarker(__FILE__, __LINE__);
|
||||||
|
|
||||||
switch ((s32) gCurrentLevel) {
|
switch ((s32) gCurrentLevel) {
|
||||||
case LEVEL_CORNERIA:
|
case LEVEL_CORNERIA:
|
||||||
|
@ -533,6 +537,7 @@ void Background_DrawBackdrop(void) {
|
||||||
case LEVEL_VENOM_ANDROSS: // WIP
|
case LEVEL_VENOM_ANDROSS: // WIP
|
||||||
if (gDrawBackdrop != 6) {
|
if (gDrawBackdrop != 6) {
|
||||||
FrameInterpolation_RecordOpenChild("Backdrop", 0);
|
FrameInterpolation_RecordOpenChild("Backdrop", 0);
|
||||||
|
FrameInterpolation_RecordMarker(__FILE__, __LINE__);
|
||||||
if ((gDrawBackdrop == 2) || (gDrawBackdrop == 7)) {
|
if ((gDrawBackdrop == 2) || (gDrawBackdrop == 7)) {
|
||||||
Matrix_RotateZ(gGfxMatrix, gPlayer[gPlayerNum].camRoll * M_DTOR, MTXF_APPLY);
|
Matrix_RotateZ(gGfxMatrix, gPlayer[gPlayerNum].camRoll * M_DTOR, MTXF_APPLY);
|
||||||
Matrix_Translate(gGfxMatrix, 0.0f, -4000.0f, -7000.0f, MTXF_APPLY);
|
Matrix_Translate(gGfxMatrix, 0.0f, -4000.0f, -7000.0f, MTXF_APPLY);
|
||||||
|
@ -630,6 +635,7 @@ void Background_DrawBackdrop(void) {
|
||||||
// Render the textures across the screen (left to right)
|
// Render the textures across the screen (left to right)
|
||||||
for (int i = 0; i < 5; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
FrameInterpolation_RecordOpenChild("Backdrop", i);
|
FrameInterpolation_RecordOpenChild("Backdrop", i);
|
||||||
|
FrameInterpolation_RecordMarker(__FILE__, __LINE__);
|
||||||
if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_INTRO) {
|
if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_INTRO) {
|
||||||
gSPDisplayList(gMasterDisp++, D_AQ_601AFF0);
|
gSPDisplayList(gMasterDisp++, D_AQ_601AFF0);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -712,6 +712,7 @@ void Display_Reticle(Player* player) {
|
||||||
(gGameState == GSTATE_MENU))) {
|
(gGameState == GSTATE_MENU))) {
|
||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
FrameInterpolation_RecordOpenChild("Reticle", i);
|
FrameInterpolation_RecordOpenChild("Reticle", i);
|
||||||
|
FrameInterpolation_RecordMarker(__FILE__, __LINE__);
|
||||||
translate = &D_display_801613E0[i];
|
translate = &D_display_801613E0[i];
|
||||||
Matrix_Push(&gGfxMatrix);
|
Matrix_Push(&gGfxMatrix);
|
||||||
Matrix_Translate(gGfxMatrix, translate->x, translate->y, translate->z, MTXF_APPLY);
|
Matrix_Translate(gGfxMatrix, translate->x, translate->y, translate->z, MTXF_APPLY);
|
||||||
|
@ -1507,6 +1508,7 @@ void Display_ActorMarks(void) {
|
||||||
for (i = 0; i < ARRAY_COUNT(gTeamArrowsViewPos); i++) {
|
for (i = 0; i < ARRAY_COUNT(gTeamArrowsViewPos); i++) {
|
||||||
if (gTeamArrowsViewPos[i].z < 0.0f) {
|
if (gTeamArrowsViewPos[i].z < 0.0f) {
|
||||||
FrameInterpolation_RecordOpenChild(&gTeamArrowsViewPos[i], i);
|
FrameInterpolation_RecordOpenChild(&gTeamArrowsViewPos[i], i);
|
||||||
|
FrameInterpolation_RecordMarker(__FILE__, __LINE__);
|
||||||
var_fs0 = (VEC3F_MAG(&gTeamArrowsViewPos[i])) * 0.0015f;
|
var_fs0 = (VEC3F_MAG(&gTeamArrowsViewPos[i])) * 0.0015f;
|
||||||
if (var_fs0 > 100.0f) {
|
if (var_fs0 > 100.0f) {
|
||||||
var_fs0 = 100.0f;
|
var_fs0 = 100.0f;
|
||||||
|
@ -1552,6 +1554,7 @@ void Display_LockOnIndicator(void) {
|
||||||
var_fs0 = VEC3F_MAG(&gLockOnTargetViewPos[i]);
|
var_fs0 = VEC3F_MAG(&gLockOnTargetViewPos[i]);
|
||||||
if (var_fs0 < 20000.0f) {
|
if (var_fs0 < 20000.0f) {
|
||||||
FrameInterpolation_RecordOpenChild("LcckOnIndicator", 0);
|
FrameInterpolation_RecordOpenChild("LcckOnIndicator", 0);
|
||||||
|
FrameInterpolation_RecordMarker(__FILE__, __LINE__);
|
||||||
var_fs0 *= 0.0015f;
|
var_fs0 *= 0.0015f;
|
||||||
if (var_fs0 > 100.0f) {
|
if (var_fs0 > 100.0f) {
|
||||||
var_fs0 = 100.0f;
|
var_fs0 = 100.0f;
|
||||||
|
@ -1751,10 +1754,9 @@ void Display_Update(void) {
|
||||||
Background_DrawStarfield();
|
Background_DrawStarfield();
|
||||||
}
|
}
|
||||||
|
|
||||||
FrameInterpolation_RecordOpenChild("Backdrop", 0);
|
|
||||||
Background_DrawBackdrop();
|
Background_DrawBackdrop();
|
||||||
FrameInterpolation_RecordCloseChild();
|
|
||||||
FrameInterpolation_RecordOpenChild("Sun", 0);
|
FrameInterpolation_RecordOpenChild("Sun", 0);
|
||||||
|
FrameInterpolation_RecordMarker(__FILE__, __LINE__);
|
||||||
Background_DrawSun();
|
Background_DrawSun();
|
||||||
FrameInterpolation_RecordCloseChild();
|
FrameInterpolation_RecordCloseChild();
|
||||||
Matrix_Push(&gGfxMatrix);
|
Matrix_Push(&gGfxMatrix);
|
||||||
|
@ -1773,6 +1775,7 @@ void Display_Update(void) {
|
||||||
} else if (gGroundSurface != SURFACE_WATER) {
|
} else if (gGroundSurface != SURFACE_WATER) {
|
||||||
D_bg_8015F964 = false;
|
D_bg_8015F964 = false;
|
||||||
FrameInterpolation_RecordOpenChild("Ground", 0);
|
FrameInterpolation_RecordOpenChild("Ground", 0);
|
||||||
|
FrameInterpolation_RecordMarker(__FILE__, __LINE__);
|
||||||
Background_DrawGround();
|
Background_DrawGround();
|
||||||
FrameInterpolation_RecordCloseChild();
|
FrameInterpolation_RecordCloseChild();
|
||||||
}
|
}
|
||||||
|
@ -1839,6 +1842,7 @@ void Display_Update(void) {
|
||||||
D_bg_8015F964 = true;
|
D_bg_8015F964 = true;
|
||||||
Effect_Draw(1);
|
Effect_Draw(1);
|
||||||
FrameInterpolation_RecordOpenChild("Ground", 0);
|
FrameInterpolation_RecordOpenChild("Ground", 0);
|
||||||
|
FrameInterpolation_RecordMarker(__FILE__, __LINE__);
|
||||||
Background_DrawGround();
|
Background_DrawGround();
|
||||||
FrameInterpolation_RecordCloseChild();
|
FrameInterpolation_RecordCloseChild();
|
||||||
}
|
}
|
||||||
|
@ -1855,6 +1859,7 @@ void Display_Update(void) {
|
||||||
for (i = 0, player = &gPlayer[0]; i < gCamCount; i++, player++) {
|
for (i = 0, player = &gPlayer[0]; i < gCamCount; i++, player++) {
|
||||||
if (sPlayersVisible[i]) {
|
if (sPlayersVisible[i]) {
|
||||||
FrameInterpolation_RecordOpenChild(player, i);
|
FrameInterpolation_RecordOpenChild(player, i);
|
||||||
|
FrameInterpolation_RecordMarker(__FILE__, __LINE__);
|
||||||
Display_PlayerShadow_Update(player);
|
Display_PlayerShadow_Update(player);
|
||||||
Display_PlayerFeatures(player);
|
Display_PlayerFeatures(player);
|
||||||
Display_ArwingWingTrail_Update(player);
|
Display_ArwingWingTrail_Update(player);
|
||||||
|
|
|
@ -828,6 +828,7 @@ void ItemCheckpoint_Draw(ItemCheckpoint* this) {
|
||||||
|
|
||||||
if (((gGameFrameCount & 0x18) != 0) && (this->state == 0)) {
|
if (((gGameFrameCount & 0x18) != 0) && (this->state == 0)) {
|
||||||
FrameInterpolation_RecordOpenChild(this, 0);
|
FrameInterpolation_RecordOpenChild(this, 0);
|
||||||
|
FrameInterpolation_RecordMarker(__FILE__, __LINE__);
|
||||||
Matrix_Push(&gGfxMatrix);
|
Matrix_Push(&gGfxMatrix);
|
||||||
RCP_SetupDL(&gMasterDisp, SETUPDL_64);
|
RCP_SetupDL(&gMasterDisp, SETUPDL_64);
|
||||||
gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 255, 0, 255);
|
gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 255, 0, 255);
|
||||||
|
@ -840,6 +841,7 @@ void ItemCheckpoint_Draw(ItemCheckpoint* this) {
|
||||||
FrameInterpolation_RecordCloseChild();
|
FrameInterpolation_RecordCloseChild();
|
||||||
}
|
}
|
||||||
FrameInterpolation_RecordOpenChild(this, 1);
|
FrameInterpolation_RecordOpenChild(this, 1);
|
||||||
|
FrameInterpolation_RecordMarker(__FILE__, __LINE__);
|
||||||
RCP_SetupDL(&gMasterDisp, SETUPDL_29);
|
RCP_SetupDL(&gMasterDisp, SETUPDL_29);
|
||||||
gSPTexture(gMasterDisp++, 2000, 2000, 0, G_TX_RENDERTILE, G_ON);
|
gSPTexture(gMasterDisp++, 2000, 2000, 0, G_TX_RENDERTILE, G_ON);
|
||||||
gSPSetGeometryMode(gMasterDisp++, G_TEXTURE_GEN);
|
gSPSetGeometryMode(gMasterDisp++, G_TEXTURE_GEN);
|
||||||
|
@ -1705,6 +1707,7 @@ void Object_DrawAll(s32 arg0) {
|
||||||
|
|
||||||
for (i = 0, scenery360 = gScenery360; i < 200; i++, scenery360++) {
|
for (i = 0, scenery360 = gScenery360; i < 200; i++, scenery360++) {
|
||||||
FrameInterpolation_RecordOpenChild(scenery360, i);
|
FrameInterpolation_RecordOpenChild(scenery360, i);
|
||||||
|
FrameInterpolation_RecordMarker(__FILE__, __LINE__);
|
||||||
if ((scenery360->obj.status == OBJ_ACTIVE) && (scenery360->obj.id != OBJ_SCENERY_LEVEL_OBJECTS)) {
|
if ((scenery360->obj.status == OBJ_ACTIVE) && (scenery360->obj.id != OBJ_SCENERY_LEVEL_OBJECTS)) {
|
||||||
if (gCurrentLevel == LEVEL_BOLSE) {
|
if (gCurrentLevel == LEVEL_BOLSE) {
|
||||||
spAC.x = scenery360->sfxSource[0];
|
spAC.x = scenery360->sfxSource[0];
|
||||||
|
@ -1723,15 +1726,16 @@ void Object_DrawAll(s32 arg0) {
|
||||||
RCP_SetupDL_29(gFogRed, gFogGreen, gFogBlue, gFogAlpha, gFogNear, gFogFar);
|
RCP_SetupDL_29(gFogRed, gFogGreen, gFogBlue, gFogAlpha, gFogNear, gFogFar);
|
||||||
for (i = 0, scenery = gScenery; i < ARRAY_COUNT(gScenery); i++, scenery++) {
|
for (i = 0, scenery = gScenery; i < ARRAY_COUNT(gScenery); i++, scenery++) {
|
||||||
if (scenery->obj.status >= OBJ_ACTIVE) {
|
if (scenery->obj.status >= OBJ_ACTIVE) {
|
||||||
|
FrameInterpolation_RecordOpenChild(scenery, i);
|
||||||
|
FrameInterpolation_RecordMarker(__FILE__, __LINE__);
|
||||||
if (arg0 > 0) {
|
if (arg0 > 0) {
|
||||||
Display_SetSecondLight(&scenery->obj.pos);
|
Display_SetSecondLight(&scenery->obj.pos);
|
||||||
}
|
}
|
||||||
Matrix_Push(&gGfxMatrix);
|
Matrix_Push(&gGfxMatrix);
|
||||||
FrameInterpolation_RecordOpenChild(scenery, i);
|
|
||||||
Scenery_Draw(scenery, arg0);
|
Scenery_Draw(scenery, arg0);
|
||||||
FrameInterpolation_RecordCloseChild();
|
|
||||||
Matrix_Pop(&gGfxMatrix);
|
Matrix_Pop(&gGfxMatrix);
|
||||||
Object_UpdateSfxSource(scenery->sfxSource);
|
Object_UpdateSfxSource(scenery->sfxSource);
|
||||||
|
FrameInterpolation_RecordCloseChild();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1739,6 +1743,7 @@ void Object_DrawAll(s32 arg0) {
|
||||||
for (i = 0, boss = gBosses; i < ARRAY_COUNT(gBosses); i++, boss++) {
|
for (i = 0, boss = gBosses; i < ARRAY_COUNT(gBosses); i++, boss++) {
|
||||||
if ((boss->obj.status >= OBJ_ACTIVE) && (boss->obj.id != OBJ_BOSS_BO_BASE_SHIELD)) {
|
if ((boss->obj.status >= OBJ_ACTIVE) && (boss->obj.id != OBJ_BOSS_BO_BASE_SHIELD)) {
|
||||||
FrameInterpolation_RecordOpenChild(boss, i);
|
FrameInterpolation_RecordOpenChild(boss, i);
|
||||||
|
FrameInterpolation_RecordMarker(__FILE__, __LINE__);
|
||||||
if ((boss->timer_05C % 2) == 0) {
|
if ((boss->timer_05C % 2) == 0) {
|
||||||
RCP_SetupDL_29(gFogRed, gFogGreen, gFogBlue, gFogAlpha, gFogNear, gFogFar);
|
RCP_SetupDL_29(gFogRed, gFogGreen, gFogBlue, gFogAlpha, gFogNear, gFogFar);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1764,6 +1769,7 @@ void Object_DrawAll(s32 arg0) {
|
||||||
for (i = 0, sprite = gSprites; i < ARRAY_COUNT(gSprites); i++, sprite++) {
|
for (i = 0, sprite = gSprites; i < ARRAY_COUNT(gSprites); i++, sprite++) {
|
||||||
if ((sprite->obj.status >= OBJ_ACTIVE) && func_enmy_80060FE4(&sprite->obj.pos, -12000.0f)) {
|
if ((sprite->obj.status >= OBJ_ACTIVE) && func_enmy_80060FE4(&sprite->obj.pos, -12000.0f)) {
|
||||||
FrameInterpolation_RecordOpenChild(sprite, i);
|
FrameInterpolation_RecordOpenChild(sprite, i);
|
||||||
|
FrameInterpolation_RecordMarker(__FILE__, __LINE__);
|
||||||
Matrix_Push(&gGfxMatrix);
|
Matrix_Push(&gGfxMatrix);
|
||||||
|
|
||||||
if ((sprite->obj.id == OBJ_SPRITE_CO_RUIN1) || (sprite->obj.id == OBJ_SPRITE_CO_RUIN2)) {
|
if ((sprite->obj.id == OBJ_SPRITE_CO_RUIN1) || (sprite->obj.id == OBJ_SPRITE_CO_RUIN2)) {
|
||||||
|
@ -1781,6 +1787,7 @@ void Object_DrawAll(s32 arg0) {
|
||||||
for (i = 0, actor = &gActors[0]; i < ARRAY_COUNT(gActors); i++, actor++) {
|
for (i = 0, actor = &gActors[0]; i < ARRAY_COUNT(gActors); i++, actor++) {
|
||||||
if (actor->obj.status >= OBJ_ACTIVE) {
|
if (actor->obj.status >= OBJ_ACTIVE) {
|
||||||
FrameInterpolation_RecordOpenChild(actor, i);
|
FrameInterpolation_RecordOpenChild(actor, i);
|
||||||
|
FrameInterpolation_RecordMarker(__FILE__, __LINE__);
|
||||||
if ((actor->timer_0C6 % 2) == 0) {
|
if ((actor->timer_0C6 % 2) == 0) {
|
||||||
if (gCurrentLevel == LEVEL_UNK_15) {
|
if (gCurrentLevel == LEVEL_UNK_15) {
|
||||||
RCP_SetupDL_23();
|
RCP_SetupDL_23();
|
||||||
|
@ -1829,7 +1836,7 @@ void Object_DrawAll(s32 arg0) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
FrameInterpolation_RecordCloseChild();
|
FrameInterpolation_RecordCloseChild();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1841,6 +1848,7 @@ void Object_DrawAll(s32 arg0) {
|
||||||
for (i = 0, item = &gItems[0]; i < ARRAY_COUNT(gItems); i++, item++) {
|
for (i = 0, item = &gItems[0]; i < ARRAY_COUNT(gItems); i++, item++) {
|
||||||
if (item->obj.status >= OBJ_ACTIVE) {
|
if (item->obj.status >= OBJ_ACTIVE) {
|
||||||
FrameInterpolation_RecordOpenChild(item, i);
|
FrameInterpolation_RecordOpenChild(item, i);
|
||||||
|
FrameInterpolation_RecordMarker(__FILE__, __LINE__);
|
||||||
Matrix_Push(&gGfxMatrix);
|
Matrix_Push(&gGfxMatrix);
|
||||||
RCP_SetupDL(&gMasterDisp, SETUPDL_29);
|
RCP_SetupDL(&gMasterDisp, SETUPDL_29);
|
||||||
Object_SetCullDirection(arg0);
|
Object_SetCullDirection(arg0);
|
||||||
|
@ -1864,6 +1872,7 @@ void Effect_DrawAll(s32 arg0) {
|
||||||
for (i = 0, effect = &gEffects[0]; i < ARRAY_COUNT(gEffects); i++, effect++) {
|
for (i = 0, effect = &gEffects[0]; i < ARRAY_COUNT(gEffects); i++, effect++) {
|
||||||
if (effect->obj.status >= OBJ_ACTIVE) {
|
if (effect->obj.status >= OBJ_ACTIVE) {
|
||||||
FrameInterpolation_RecordOpenChild(effect, i);
|
FrameInterpolation_RecordOpenChild(effect, i);
|
||||||
|
FrameInterpolation_RecordMarker(__FILE__, __LINE__);
|
||||||
if (effect->info.unk_14 == 1) {
|
if (effect->info.unk_14 == 1) {
|
||||||
effect->obj.rot.y = RAD_TO_DEG(-gPlayer[gPlayerNum].camYaw);
|
effect->obj.rot.y = RAD_TO_DEG(-gPlayer[gPlayerNum].camYaw);
|
||||||
effect->obj.rot.x = RAD_TO_DEG(gPlayer[gPlayerNum].camPitch);
|
effect->obj.rot.x = RAD_TO_DEG(gPlayer[gPlayerNum].camPitch);
|
||||||
|
@ -1891,6 +1900,7 @@ void Effect_DrawAll(s32 arg0) {
|
||||||
for (i = 0, boss = &gBosses[0]; i < ARRAY_COUNT(gBosses); i++, boss++) {
|
for (i = 0, boss = &gBosses[0]; i < ARRAY_COUNT(gBosses); i++, boss++) {
|
||||||
if ((boss->obj.status >= OBJ_ACTIVE) && (boss->obj.id == OBJ_BOSS_BO_BASE_SHIELD)) {
|
if ((boss->obj.status >= OBJ_ACTIVE) && (boss->obj.id == OBJ_BOSS_BO_BASE_SHIELD)) {
|
||||||
FrameInterpolation_RecordOpenChild(boss, i);
|
FrameInterpolation_RecordOpenChild(boss, i);
|
||||||
|
FrameInterpolation_RecordMarker(__FILE__, __LINE__);
|
||||||
if ((boss->timer_05C % 2) == 0) {
|
if ((boss->timer_05C % 2) == 0) {
|
||||||
RCP_SetupDL_29(gFogRed, gFogGreen, gFogBlue, gFogAlpha, gFogNear, gFogFar);
|
RCP_SetupDL_29(gFogRed, gFogGreen, gFogBlue, gFogAlpha, gFogNear, gFogFar);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1962,6 +1972,7 @@ void TexturedLine_Draw(void) {
|
||||||
for (i = 0; i < ARRAY_COUNT(gTexturedLines); i++) {
|
for (i = 0; i < ARRAY_COUNT(gTexturedLines); i++) {
|
||||||
TexturedLine* texLine = &gTexturedLines[i];
|
TexturedLine* texLine = &gTexturedLines[i];
|
||||||
FrameInterpolation_RecordOpenChild(texLine, i);
|
FrameInterpolation_RecordOpenChild(texLine, i);
|
||||||
|
FrameInterpolation_RecordMarker(__FILE__, __LINE__);
|
||||||
|
|
||||||
if (gTexturedLines[i].mode != 0) {
|
if (gTexturedLines[i].mode != 0) {
|
||||||
Matrix_Push(&gGfxMatrix);
|
Matrix_Push(&gGfxMatrix);
|
||||||
|
|
|
@ -140,6 +140,7 @@ void BonusText_DrawAll(void) {
|
||||||
for (i = 0, bonus = gBonusText; i < ARRAY_COUNT(gBonusText); i++, bonus++) {
|
for (i = 0, bonus = gBonusText; i < ARRAY_COUNT(gBonusText); i++, bonus++) {
|
||||||
if (bonus->hits != 0) {
|
if (bonus->hits != 0) {
|
||||||
FrameInterpolation_RecordOpenChild(bonus, i);
|
FrameInterpolation_RecordOpenChild(bonus, i);
|
||||||
|
FrameInterpolation_RecordMarker(__FILE__, __LINE__);
|
||||||
Matrix_Push(&gGfxMatrix);
|
Matrix_Push(&gGfxMatrix);
|
||||||
BonusText_Draw(bonus);
|
BonusText_Draw(bonus);
|
||||||
Matrix_Pop(&gGfxMatrix);
|
Matrix_Pop(&gGfxMatrix);
|
||||||
|
|
|
@ -31,7 +31,7 @@ void Lib_Texture_Scroll(u16* texture, s32 width, s32 height, u8 mode) {
|
||||||
u16 tempPxl;
|
u16 tempPxl;
|
||||||
s32 u;
|
s32 u;
|
||||||
s32 v;
|
s32 v;
|
||||||
// return;
|
return;
|
||||||
// LTodo: [HD-Textures] This is broken
|
// LTodo: [HD-Textures] This is broken
|
||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
|
|
|
@ -32,6 +32,7 @@ void OvlMenu_CallFunction(u32 mode, void* ptr) {
|
||||||
|
|
||||||
case OVLCALL_MAP_DRAW:
|
case OVLCALL_MAP_DRAW:
|
||||||
FrameInterpolation_RecordOpenChild("MapDraw", 0);
|
FrameInterpolation_RecordOpenChild("MapDraw", 0);
|
||||||
|
FrameInterpolation_RecordMarker(__FILE__, __LINE__);
|
||||||
Map_Draw();
|
Map_Draw();
|
||||||
FrameInterpolation_RecordCloseChild();
|
FrameInterpolation_RecordCloseChild();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -47,6 +47,7 @@ using namespace std;
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
enum class Op {
|
enum class Op {
|
||||||
|
Marker,
|
||||||
OpenChild,
|
OpenChild,
|
||||||
CloseChild,
|
CloseChild,
|
||||||
|
|
||||||
|
@ -72,41 +73,53 @@ union Data {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
MtxF src;
|
Matrix** matrix;
|
||||||
} matrix_put;
|
} matrix_ptr;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
const char* file;
|
||||||
|
int line;
|
||||||
|
} marker;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
Matrix* matrix;
|
||||||
MtxF mf;
|
MtxF mf;
|
||||||
u8 mode;
|
u8 mode;
|
||||||
} matrix_mult;
|
} matrix_mult;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
Matrix* matrix;
|
||||||
f32 x, y, z;
|
f32 x, y, z;
|
||||||
u8 mode;
|
u8 mode;
|
||||||
} matrix_translate, matrix_scale;
|
} matrix_translate, matrix_scale;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
Matrix* matrix;
|
||||||
u32 coord;
|
u32 coord;
|
||||||
f32 value;
|
f32 value;
|
||||||
u8 mode;
|
u8 mode;
|
||||||
} matrix_rotate_1_coord;
|
} matrix_rotate_1_coord;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
Matrix* matrix;
|
||||||
Vec3f src;
|
Vec3f src;
|
||||||
Vec3f dest;
|
Vec3f dest;
|
||||||
} matrix_vec_translate;
|
} matrix_vec_translate;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
Matrix* matrix;
|
||||||
Vec3f src;
|
Vec3f src;
|
||||||
Vec3f dest;
|
Vec3f dest;
|
||||||
} matrix_vec_no_translate;
|
} matrix_vec_no_translate;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
Matrix* matrix;
|
||||||
Vec3f translation;
|
Vec3f translation;
|
||||||
Vec3s rotation;
|
Vec3s rotation;
|
||||||
} matrix_translate_rotate_zyx;
|
} matrix_translate_rotate_zyx;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
Matrix* matrix;
|
||||||
f32 translateX, translateY, translateZ;
|
f32 translateX, translateY, translateZ;
|
||||||
Vec3s rot;
|
Vec3s rot;
|
||||||
// MtxF mtx;
|
// MtxF mtx;
|
||||||
|
@ -169,7 +182,7 @@ Data& append(Op op) {
|
||||||
}
|
}
|
||||||
|
|
||||||
MtxF* Matrix_GetCurrent(){
|
MtxF* Matrix_GetCurrent(){
|
||||||
return (MtxF*) gGfxMatrix;
|
return (MtxF*) gInterpolationMatrix;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct InterpolateCtx {
|
struct InterpolateCtx {
|
||||||
|
@ -290,16 +303,16 @@ struct InterpolateCtx {
|
||||||
Data& old_op = it->second[item.second];
|
Data& old_op = it->second[item.second];
|
||||||
switch (item.first) {
|
switch (item.first) {
|
||||||
case Op::OpenChild:
|
case Op::OpenChild:
|
||||||
break;
|
|
||||||
case Op::CloseChild:
|
case Op::CloseChild:
|
||||||
|
case Op::Marker:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Op::MatrixPush:
|
case Op::MatrixPush:
|
||||||
Matrix_Push(&gGfxMatrix);
|
Matrix_Push(&gInterpolationMatrix);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Op::MatrixPop:
|
case Op::MatrixPop:
|
||||||
Matrix_Pop(&gGfxMatrix);
|
Matrix_Pop(&gInterpolationMatrix);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Unused on SF64
|
// Unused on SF64
|
||||||
|
@ -310,18 +323,18 @@ struct InterpolateCtx {
|
||||||
|
|
||||||
case Op::MatrixMult:
|
case Op::MatrixMult:
|
||||||
interpolate_mtxf(&tmp_mtxf, &old_op.matrix_mult.mf, &new_op.matrix_mult.mf);
|
interpolate_mtxf(&tmp_mtxf, &old_op.matrix_mult.mf, &new_op.matrix_mult.mf);
|
||||||
Matrix_Mult(gGfxMatrix, (Matrix*) &tmp_mtxf, new_op.matrix_mult.mode);
|
Matrix_Mult(gInterpolationMatrix, (Matrix*) &tmp_mtxf, new_op.matrix_mult.mode);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Op::MatrixTranslate:
|
case Op::MatrixTranslate:
|
||||||
Matrix_Translate(gGfxMatrix, lerp(old_op.matrix_translate.x, new_op.matrix_translate.x),
|
Matrix_Translate(gInterpolationMatrix, lerp(old_op.matrix_translate.x, new_op.matrix_translate.x),
|
||||||
lerp(old_op.matrix_translate.y, new_op.matrix_translate.y),
|
lerp(old_op.matrix_translate.y, new_op.matrix_translate.y),
|
||||||
lerp(old_op.matrix_translate.z, new_op.matrix_translate.z),
|
lerp(old_op.matrix_translate.z, new_op.matrix_translate.z),
|
||||||
new_op.matrix_translate.mode);
|
new_op.matrix_translate.mode);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Op::MatrixScale:
|
case Op::MatrixScale:
|
||||||
Matrix_Scale(gGfxMatrix, lerp(old_op.matrix_scale.x, new_op.matrix_scale.x),
|
Matrix_Scale(gInterpolationMatrix, lerp(old_op.matrix_scale.x, new_op.matrix_scale.x),
|
||||||
lerp(old_op.matrix_scale.y, new_op.matrix_scale.y),
|
lerp(old_op.matrix_scale.y, new_op.matrix_scale.y),
|
||||||
lerp(old_op.matrix_scale.z, new_op.matrix_scale.z), new_op.matrix_scale.mode);
|
lerp(old_op.matrix_scale.z, new_op.matrix_scale.z), new_op.matrix_scale.mode);
|
||||||
break;
|
break;
|
||||||
|
@ -332,15 +345,15 @@ struct InterpolateCtx {
|
||||||
u8 mode = new_op.matrix_rotate_1_coord.mode;
|
u8 mode = new_op.matrix_rotate_1_coord.mode;
|
||||||
switch (new_op.matrix_rotate_1_coord.coord) {
|
switch (new_op.matrix_rotate_1_coord.coord) {
|
||||||
case 0:
|
case 0:
|
||||||
Matrix_RotateX(gGfxMatrix, v, mode);
|
Matrix_RotateX(gInterpolationMatrix, v, mode);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
Matrix_RotateY(gGfxMatrix, v, mode);
|
Matrix_RotateY(gInterpolationMatrix, v, mode);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
Matrix_RotateZ(gGfxMatrix, v, mode);
|
Matrix_RotateZ(gInterpolationMatrix, v, mode);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -348,13 +361,13 @@ struct InterpolateCtx {
|
||||||
case Op::MatrixMultVec3fNoTranslate: {
|
case Op::MatrixMultVec3fNoTranslate: {
|
||||||
interpolate_vecs(&tmp_vec3f, &old_op.matrix_vec_no_translate.src, &new_op.matrix_vec_no_translate.src);
|
interpolate_vecs(&tmp_vec3f, &old_op.matrix_vec_no_translate.src, &new_op.matrix_vec_no_translate.src);
|
||||||
interpolate_vecs(&tmp_vec3f2, &old_op.matrix_vec_no_translate.dest, &new_op.matrix_vec_no_translate.dest);
|
interpolate_vecs(&tmp_vec3f2, &old_op.matrix_vec_no_translate.dest, &new_op.matrix_vec_no_translate.dest);
|
||||||
Matrix_MultVec3fNoTranslate(gCalcMatrix, &tmp_vec3f, &tmp_vec3f2);
|
Matrix_MultVec3fNoTranslate(gInterpolationMatrix, &tmp_vec3f, &tmp_vec3f2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Op::MatrixMultVec3f: {
|
case Op::MatrixMultVec3f: {
|
||||||
interpolate_vecs(&tmp_vec3f, &old_op.matrix_vec_no_translate.src, &new_op.matrix_vec_no_translate.src);
|
interpolate_vecs(&tmp_vec3f, &old_op.matrix_vec_translate.src, &new_op.matrix_vec_translate.src);
|
||||||
interpolate_vecs(&tmp_vec3f2, &old_op.matrix_vec_no_translate.dest, &new_op.matrix_vec_no_translate.dest);
|
interpolate_vecs(&tmp_vec3f2, &old_op.matrix_vec_translate.dest, &new_op.matrix_vec_translate.dest);
|
||||||
Matrix_MultVec3f(gCalcMatrix, &tmp_vec3f, &tmp_vec3f2);
|
Matrix_MultVec3f(gInterpolationMatrix, &tmp_vec3f, &tmp_vec3f2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -460,58 +473,66 @@ void FrameInterpolation_RecordActorPosRotMatrix(void) {
|
||||||
next_is_actor_pos_rot_matrix = true;
|
next_is_actor_pos_rot_matrix = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrameInterpolation_RecordMatrixPush(void) {
|
void FrameInterpolation_RecordMatrixPush(Matrix** matrix) {
|
||||||
if (!is_recording)
|
if (!is_recording)
|
||||||
return;
|
return;
|
||||||
append(Op::MatrixPush);
|
|
||||||
|
append(Op::MatrixPush).matrix_ptr = { matrix };
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrameInterpolation_RecordMatrixPop(void) {
|
void FrameInterpolation_RecordMarker(const char* file, int line) {
|
||||||
if (!is_recording)
|
if (!is_recording)
|
||||||
return;
|
return;
|
||||||
append(Op::MatrixPop);
|
|
||||||
|
append(Op::Marker).marker = { file, line };
|
||||||
|
}
|
||||||
|
|
||||||
|
void FrameInterpolation_RecordMatrixPop(Matrix** matrix) {
|
||||||
|
if (!is_recording)
|
||||||
|
return;
|
||||||
|
append(Op::MatrixPop).matrix_ptr = { matrix };
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrameInterpolation_RecordMatrixPut(MtxF* src) {
|
void FrameInterpolation_RecordMatrixPut(MtxF* src) {
|
||||||
if (!is_recording)
|
if (!is_recording)
|
||||||
return;
|
return;
|
||||||
append(Op::MatrixPut).matrix_put = { *src };
|
// append(Op::MatrixPut).matrix_put = { matrix, *src };
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrameInterpolation_RecordMatrixMult(MtxF* mf, u8 mode) {
|
void FrameInterpolation_RecordMatrixMult(Matrix* matrix, MtxF* mf, u8 mode) {
|
||||||
if (!is_recording)
|
if (!is_recording)
|
||||||
return;
|
return;
|
||||||
append(Op::MatrixMult).matrix_mult = { *mf, mode };
|
append(Op::MatrixMult).matrix_mult = { matrix, *mf, mode };
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrameInterpolation_RecordMatrixTranslate(f32 x, f32 y, f32 z, u8 mode) {
|
void FrameInterpolation_RecordMatrixTranslate(Matrix* matrix, f32 x, f32 y, f32 z, u8 mode) {
|
||||||
if (!is_recording)
|
if (!is_recording)
|
||||||
return;
|
return;
|
||||||
append(Op::MatrixTranslate).matrix_translate = { x, y, z, mode };
|
append(Op::MatrixTranslate).matrix_translate = { matrix, x, y, z, mode };
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrameInterpolation_RecordMatrixScale(f32 x, f32 y, f32 z, u8 mode) {
|
void FrameInterpolation_RecordMatrixScale(Matrix* matrix, f32 x, f32 y, f32 z, u8 mode) {
|
||||||
if (!is_recording)
|
if (!is_recording)
|
||||||
return;
|
return;
|
||||||
append(Op::MatrixScale).matrix_scale = { x, y, z, mode };
|
append(Op::MatrixScale).matrix_scale = { matrix, x, y, z, mode };
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrameInterpolation_RecordMatrixMultVec3fNoTranslate(Vec3f src, Vec3f dest){
|
void FrameInterpolation_RecordMatrixMultVec3fNoTranslate(Matrix* matrix, Vec3f src, Vec3f dest){
|
||||||
if (!is_recording)
|
if (!is_recording)
|
||||||
return;
|
return;
|
||||||
append(Op::MatrixMultVec3fNoTranslate).matrix_vec_no_translate = { src, dest };
|
append(Op::MatrixMultVec3fNoTranslate).matrix_vec_no_translate = { matrix, src, dest };
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrameInterpolation_RecordMatrixMultVec3f(Vec3f src, Vec3f dest){
|
void FrameInterpolation_RecordMatrixMultVec3f(Matrix* matrix, Vec3f src, Vec3f dest){
|
||||||
if (!is_recording)
|
if (!is_recording)
|
||||||
return;
|
return;
|
||||||
append(Op::MatrixMultVec3f).matrix_vec_translate = { src, dest };
|
append(Op::MatrixMultVec3f).matrix_vec_translate = { matrix, src, dest };
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrameInterpolation_RecordMatrixRotate1Coord(u32 coord, f32 value, u8 mode) {
|
void FrameInterpolation_RecordMatrixRotate1Coord(Matrix* matrix, u32 coord, f32 value, u8 mode) {
|
||||||
if (!is_recording)
|
if (!is_recording)
|
||||||
return;
|
return;
|
||||||
append(Op::MatrixRotate1Coord).matrix_rotate_1_coord = { coord, value, mode };
|
append(Op::MatrixRotate1Coord).matrix_rotate_1_coord = { matrix, coord, value, mode };
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrameInterpolation_RecordMatrixMtxFToMtx(MtxF* src, Mtx* dest) {
|
void FrameInterpolation_RecordMatrixMtxFToMtx(MtxF* src, Mtx* dest) {
|
||||||
|
|
|
@ -19,6 +19,8 @@ void FrameInterpolation_StartRecord(void);
|
||||||
|
|
||||||
void FrameInterpolation_StopRecord(void);
|
void FrameInterpolation_StopRecord(void);
|
||||||
|
|
||||||
|
void FrameInterpolation_RecordMarker(const char* file, int line);
|
||||||
|
|
||||||
void FrameInterpolation_RecordOpenChild(const void* a, int b);
|
void FrameInterpolation_RecordOpenChild(const void* a, int b);
|
||||||
|
|
||||||
void FrameInterpolation_RecordCloseChild(void);
|
void FrameInterpolation_RecordCloseChild(void);
|
||||||
|
@ -29,17 +31,17 @@ int FrameInterpolation_GetCameraEpoch(void);
|
||||||
|
|
||||||
void FrameInterpolation_RecordActorPosRotMatrix(void);
|
void FrameInterpolation_RecordActorPosRotMatrix(void);
|
||||||
|
|
||||||
void FrameInterpolation_RecordMatrixPush(void);
|
void FrameInterpolation_RecordMatrixPush(Matrix** mtx);
|
||||||
|
|
||||||
void FrameInterpolation_RecordMatrixPop(void);
|
void FrameInterpolation_RecordMatrixPop(Matrix** mtx);
|
||||||
|
|
||||||
void FrameInterpolation_RecordMatrixMult(MtxF* mf, u8 mode);
|
void FrameInterpolation_RecordMatrixMult(Matrix* matrix, MtxF* mf, u8 mode);
|
||||||
|
|
||||||
void FrameInterpolation_RecordMatrixTranslate(f32 x, f32 y, f32 z, u8 mode);
|
void FrameInterpolation_RecordMatrixTranslate(Matrix* matrix, f32 x, f32 y, f32 z, u8 mode);
|
||||||
|
|
||||||
void FrameInterpolation_RecordMatrixScale(f32 x, f32 y, f32 z, u8 mode);
|
void FrameInterpolation_RecordMatrixScale(Matrix* matrix, f32 x, f32 y, f32 z, u8 mode);
|
||||||
|
|
||||||
void FrameInterpolation_RecordMatrixRotate1Coord(u32 coord, f32 value, u8 mode);
|
void FrameInterpolation_RecordMatrixRotate1Coord(Matrix* matrix, u32 coord, f32 value, u8 mode);
|
||||||
|
|
||||||
void FrameInterpolation_RecordMatrixMtxFToMtx(MtxF* src, Mtx* dest);
|
void FrameInterpolation_RecordMatrixMtxFToMtx(MtxF* src, Mtx* dest);
|
||||||
|
|
||||||
|
@ -51,8 +53,9 @@ void FrameInterpolation_RecordMatrixRotateAxis(f32 angle, Vec3f* axis, u8 mode);
|
||||||
|
|
||||||
void FrameInterpolation_RecordSkinMatrixMtxFToMtx(MtxF* src, Mtx* dest);
|
void FrameInterpolation_RecordSkinMatrixMtxFToMtx(MtxF* src, Mtx* dest);
|
||||||
|
|
||||||
void FrameInterpolation_RecordMatrixMultVec3f(Vec3f src, Vec3f dest);
|
void FrameInterpolation_RecordMatrixMultVec3f(Matrix* matrix, Vec3f src, Vec3f dest);
|
||||||
void FrameInterpolation_RecordMatrixMultVec3fNoTranslate(Vec3f src, Vec3f dest);
|
|
||||||
|
void FrameInterpolation_RecordMatrixMultVec3fNoTranslate(Matrix* matrix, Vec3f src, Vec3f dest);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,6 +86,7 @@ void Lib_InitPerspective(Gfx** dList) {
|
||||||
u16 norm;
|
u16 norm;
|
||||||
|
|
||||||
FrameInterpolation_RecordOpenChild("perspective", 0);
|
FrameInterpolation_RecordOpenChild("perspective", 0);
|
||||||
|
FrameInterpolation_RecordMarker(__FILE__, __LINE__);
|
||||||
guPerspective(gGfxMtx, &norm, gFovY, (f32) SCREEN_WIDTH / SCREEN_HEIGHT, gProjectNear, gProjectFar, 1.0f);
|
guPerspective(gGfxMtx, &norm, gFovY, (f32) SCREEN_WIDTH / SCREEN_HEIGHT, gProjectNear, gProjectFar, 1.0f);
|
||||||
gSPPerspNormalize((*dList)++, norm);
|
gSPPerspNormalize((*dList)++, norm);
|
||||||
gSPMatrix((*dList)++, gGfxMtx++, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
|
gSPMatrix((*dList)++, gGfxMtx++, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
|
||||||
|
@ -97,6 +98,7 @@ void Lib_InitPerspective(Gfx** dList) {
|
||||||
|
|
||||||
void Lib_InitOrtho(Gfx** dList) {
|
void Lib_InitOrtho(Gfx** dList) {
|
||||||
FrameInterpolation_RecordOpenChild("ortho", 0);
|
FrameInterpolation_RecordOpenChild("ortho", 0);
|
||||||
|
FrameInterpolation_RecordMarker(__FILE__, __LINE__);
|
||||||
guOrtho(gGfxMtx, -SCREEN_WIDTH / 2, SCREEN_WIDTH / 2, -SCREEN_HEIGHT / 2, SCREEN_HEIGHT / 2, gProjectNear,
|
guOrtho(gGfxMtx, -SCREEN_WIDTH / 2, SCREEN_WIDTH / 2, -SCREEN_HEIGHT / 2, SCREEN_HEIGHT / 2, gProjectNear,
|
||||||
gProjectFar, 1.0f);
|
gProjectFar, 1.0f);
|
||||||
gSPMatrix((*dList)++, gGfxMtx++, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
|
gSPMatrix((*dList)++, gGfxMtx++, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
|
||||||
|
|
|
@ -168,6 +168,7 @@ void Graphics_InitializeTask(u32 frameCount) {
|
||||||
|
|
||||||
gGfxMatrix = &sGfxMatrixStack[0];
|
gGfxMatrix = &sGfxMatrixStack[0];
|
||||||
gCalcMatrix = &sCalcMatrixStack[0];
|
gCalcMatrix = &sCalcMatrixStack[0];
|
||||||
|
gInterpolationMatrix = &sInterpolationMatrixStack[0];
|
||||||
|
|
||||||
D_80178710 = &D_80178580[0];
|
D_80178710 = &D_80178580[0];
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,9 +29,11 @@ Matrix gIdentityMatrix = { {
|
||||||
} };
|
} };
|
||||||
|
|
||||||
Matrix* gGfxMatrix;
|
Matrix* gGfxMatrix;
|
||||||
Matrix sGfxMatrixStack[0x20];
|
Matrix sGfxMatrixStack[0x1000];
|
||||||
Matrix* gCalcMatrix;
|
Matrix* gCalcMatrix;
|
||||||
Matrix sCalcMatrixStack[0x20];
|
Matrix sCalcMatrixStack[0x1000];
|
||||||
|
Matrix* gInterpolationMatrix;
|
||||||
|
Matrix sInterpolationMatrixStack[0x1000];
|
||||||
|
|
||||||
// Copies src Matrix into dst
|
// Copies src Matrix into dst
|
||||||
void Matrix_Copy(Matrix* dst, Matrix* src) {
|
void Matrix_Copy(Matrix* dst, Matrix* src) {
|
||||||
|
@ -47,14 +49,19 @@ void Matrix_Copy(Matrix* dst, Matrix* src) {
|
||||||
|
|
||||||
// Makes a copy of the stack's current matrix and puts it on the top of the stack
|
// Makes a copy of the stack's current matrix and puts it on the top of the stack
|
||||||
void Matrix_Push(Matrix** mtxStack) {
|
void Matrix_Push(Matrix** mtxStack) {
|
||||||
FrameInterpolation_RecordMatrixPush();
|
FrameInterpolation_RecordMatrixPush(mtxStack);
|
||||||
|
|
||||||
|
if(mtxStack == NULL || *mtxStack == NULL){
|
||||||
|
int bp = 0;
|
||||||
|
}
|
||||||
|
|
||||||
Matrix_Copy(*mtxStack + 1, *mtxStack);
|
Matrix_Copy(*mtxStack + 1, *mtxStack);
|
||||||
(*mtxStack)++;
|
(*mtxStack)++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Removes the top matrix of the stack
|
// Removes the top matrix of the stack
|
||||||
void Matrix_Pop(Matrix** mtxStack) {
|
void Matrix_Pop(Matrix** mtxStack) {
|
||||||
FrameInterpolation_RecordMatrixPop();
|
FrameInterpolation_RecordMatrixPop(mtxStack);
|
||||||
(*mtxStack)--;
|
(*mtxStack)--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,7 +199,7 @@ void Matrix_MtxFMtxFMult(MtxF* mfB, MtxF* mfA, MtxF* dest) {
|
||||||
|
|
||||||
// Copies tf into mtx (MTXF_NEW) or applies it to mtx (MTXF_APPLY)
|
// Copies tf into mtx (MTXF_NEW) or applies it to mtx (MTXF_APPLY)
|
||||||
void Matrix_Mult(Matrix* mtx, Matrix* tf, u8 mode) {
|
void Matrix_Mult(Matrix* mtx, Matrix* tf, u8 mode) {
|
||||||
FrameInterpolation_RecordMatrixMult(tf, mode);
|
FrameInterpolation_RecordMatrixMult(mtx, tf, mode);
|
||||||
f32 rx;
|
f32 rx;
|
||||||
f32 ry;
|
f32 ry;
|
||||||
f32 rz;
|
f32 rz;
|
||||||
|
@ -245,7 +252,7 @@ void Matrix_Mult(Matrix* mtx, Matrix* tf, u8 mode) {
|
||||||
|
|
||||||
// Creates a translation matrix in mtx (MTXF_NEW) or applies one to mtx (MTXF_APPLY)
|
// Creates a translation matrix in mtx (MTXF_NEW) or applies one to mtx (MTXF_APPLY)
|
||||||
void Matrix_Translate(Matrix* mtx, f32 x, f32 y, f32 z, u8 mode) {
|
void Matrix_Translate(Matrix* mtx, f32 x, f32 y, f32 z, u8 mode) {
|
||||||
FrameInterpolation_RecordMatrixTranslate(x, y, z, mode);
|
FrameInterpolation_RecordMatrixTranslate(mtx, x, y, z, mode);
|
||||||
f32 rx;
|
f32 rx;
|
||||||
f32 ry;
|
f32 ry;
|
||||||
s32 i;
|
s32 i;
|
||||||
|
@ -269,7 +276,7 @@ void Matrix_Translate(Matrix* mtx, f32 x, f32 y, f32 z, u8 mode) {
|
||||||
|
|
||||||
// Creates a scale matrix in mtx (MTXF_NEW) or applies one to mtx (MTXF_APPLY)
|
// Creates a scale matrix in mtx (MTXF_NEW) or applies one to mtx (MTXF_APPLY)
|
||||||
void Matrix_Scale(Matrix* mtx, f32 xScale, f32 yScale, f32 zScale, u8 mode) {
|
void Matrix_Scale(Matrix* mtx, f32 xScale, f32 yScale, f32 zScale, u8 mode) {
|
||||||
FrameInterpolation_RecordMatrixScale(xScale, yScale, zScale, mode);
|
FrameInterpolation_RecordMatrixScale(mtx, xScale, yScale, zScale, mode);
|
||||||
f32 rx;
|
f32 rx;
|
||||||
f32 ry;
|
f32 ry;
|
||||||
s32 i;
|
s32 i;
|
||||||
|
@ -295,7 +302,7 @@ void Matrix_Scale(Matrix* mtx, f32 xScale, f32 yScale, f32 zScale, u8 mode) {
|
||||||
|
|
||||||
// Creates rotation matrix about the X axis in mtx (MTXF_NEW) or applies one to mtx (MTXF_APPLY)
|
// Creates rotation matrix about the X axis in mtx (MTXF_NEW) or applies one to mtx (MTXF_APPLY)
|
||||||
void Matrix_RotateX(Matrix* mtx, f32 angle, u8 mode) {
|
void Matrix_RotateX(Matrix* mtx, f32 angle, u8 mode) {
|
||||||
FrameInterpolation_RecordMatrixRotate1Coord(0, angle, mode);
|
FrameInterpolation_RecordMatrixRotate1Coord(mtx, 0, angle, mode);
|
||||||
f32 cs;
|
f32 cs;
|
||||||
f32 sn;
|
f32 sn;
|
||||||
f32 ry;
|
f32 ry;
|
||||||
|
@ -324,7 +331,7 @@ void Matrix_RotateX(Matrix* mtx, f32 angle, u8 mode) {
|
||||||
|
|
||||||
// Creates rotation matrix about the Y axis in mtx (MTXF_NEW) or applies one to mtx (MTXF_APPLY)
|
// Creates rotation matrix about the Y axis in mtx (MTXF_NEW) or applies one to mtx (MTXF_APPLY)
|
||||||
void Matrix_RotateY(Matrix* mtx, f32 angle, u8 mode) {
|
void Matrix_RotateY(Matrix* mtx, f32 angle, u8 mode) {
|
||||||
FrameInterpolation_RecordMatrixRotate1Coord(1, angle, mode);
|
FrameInterpolation_RecordMatrixRotate1Coord(mtx, 1, angle, mode);
|
||||||
f32 cs;
|
f32 cs;
|
||||||
f32 sn;
|
f32 sn;
|
||||||
f32 rx;
|
f32 rx;
|
||||||
|
@ -353,7 +360,7 @@ void Matrix_RotateY(Matrix* mtx, f32 angle, u8 mode) {
|
||||||
|
|
||||||
// Creates rotation matrix about the Z axis in mtx (MTXF_NEW) or applies one to mtx (MTXF_APPLY)
|
// Creates rotation matrix about the Z axis in mtx (MTXF_NEW) or applies one to mtx (MTXF_APPLY)
|
||||||
void Matrix_RotateZ(Matrix* mtx, f32 angle, u8 mode) {
|
void Matrix_RotateZ(Matrix* mtx, f32 angle, u8 mode) {
|
||||||
FrameInterpolation_RecordMatrixRotate1Coord(2, angle, mode);
|
FrameInterpolation_RecordMatrixRotate1Coord(mtx, 2, angle, mode);
|
||||||
f32 cs;
|
f32 cs;
|
||||||
f32 sn;
|
f32 sn;
|
||||||
f32 rx;
|
f32 rx;
|
||||||
|
@ -491,7 +498,7 @@ void Matrix_FromMtx(Mtx* src, Matrix* dest) {
|
||||||
|
|
||||||
// Applies the transform matrix mtx to the vector src, putting the result in dest
|
// Applies the transform matrix mtx to the vector src, putting the result in dest
|
||||||
void Matrix_MultVec3f(Matrix* mtx, Vec3f* src, Vec3f* dest) {
|
void Matrix_MultVec3f(Matrix* mtx, Vec3f* src, Vec3f* dest) {
|
||||||
FrameInterpolation_RecordMatrixMultVec3f(*src, *dest);
|
FrameInterpolation_RecordMatrixMultVec3f(mtx, *src, *dest);
|
||||||
dest->x = (mtx->m[0][0] * src->x) + (mtx->m[1][0] * src->y) + (mtx->m[2][0] * src->z) + mtx->m[3][0];
|
dest->x = (mtx->m[0][0] * src->x) + (mtx->m[1][0] * src->y) + (mtx->m[2][0] * src->z) + mtx->m[3][0];
|
||||||
dest->y = (mtx->m[0][1] * src->x) + (mtx->m[1][1] * src->y) + (mtx->m[2][1] * src->z) + mtx->m[3][1];
|
dest->y = (mtx->m[0][1] * src->x) + (mtx->m[1][1] * src->y) + (mtx->m[2][1] * src->z) + mtx->m[3][1];
|
||||||
dest->z = (mtx->m[0][2] * src->x) + (mtx->m[1][2] * src->y) + (mtx->m[2][2] * src->z) + mtx->m[3][2];
|
dest->z = (mtx->m[0][2] * src->x) + (mtx->m[1][2] * src->y) + (mtx->m[2][2] * src->z) + mtx->m[3][2];
|
||||||
|
@ -500,7 +507,7 @@ void Matrix_MultVec3f(Matrix* mtx, Vec3f* src, Vec3f* dest) {
|
||||||
// Applies the linear part of the transformation matrix mtx to the vector src, ignoring any translation that mtx might
|
// Applies the linear part of the transformation matrix mtx to the vector src, ignoring any translation that mtx might
|
||||||
// have. Puts the result in dest.
|
// have. Puts the result in dest.
|
||||||
void Matrix_MultVec3fNoTranslate(Matrix* mtx, Vec3f* src, Vec3f* dest) {
|
void Matrix_MultVec3fNoTranslate(Matrix* mtx, Vec3f* src, Vec3f* dest) {
|
||||||
FrameInterpolation_RecordMatrixMultVec3fNoTranslate(*src, *dest);
|
FrameInterpolation_RecordMatrixMultVec3fNoTranslate(mtx, *src, *dest);
|
||||||
dest->x = (mtx->m[0][0] * src->x) + (mtx->m[1][0] * src->y) + (mtx->m[2][0] * src->z);
|
dest->x = (mtx->m[0][0] * src->x) + (mtx->m[1][0] * src->y) + (mtx->m[2][0] * src->z);
|
||||||
dest->y = (mtx->m[0][1] * src->x) + (mtx->m[1][1] * src->y) + (mtx->m[2][1] * src->z);
|
dest->y = (mtx->m[0][1] * src->x) + (mtx->m[1][1] * src->y) + (mtx->m[2][1] * src->z);
|
||||||
dest->z = (mtx->m[0][2] * src->x) + (mtx->m[1][2] * src->y) + (mtx->m[2][2] * src->z);
|
dest->z = (mtx->m[0][2] * src->x) + (mtx->m[1][2] * src->y) + (mtx->m[2][2] * src->z);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue