2022-03-21 21:51:23 -04:00
|
|
|
#include "global.h"
|
|
|
|
|
2022-05-13 18:43:55 -04:00
|
|
|
#include "soh/frame_interpolation.h"
|
|
|
|
|
2022-03-21 21:51:23 -04:00
|
|
|
Mtx* sSkyboxDrawMatrix;
|
|
|
|
|
|
|
|
Mtx* SkyboxDraw_UpdateMatrix(SkyboxContext* skyboxCtx, f32 x, f32 y, f32 z) {
|
|
|
|
Matrix_Translate(x, y, z, MTXMODE_NEW);
|
|
|
|
Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY);
|
|
|
|
Matrix_RotateX(skyboxCtx->rot.x, MTXMODE_APPLY);
|
|
|
|
Matrix_RotateY(skyboxCtx->rot.y, MTXMODE_APPLY);
|
|
|
|
Matrix_RotateZ(skyboxCtx->rot.z, MTXMODE_APPLY);
|
2022-07-05 19:29:34 -04:00
|
|
|
return MATRIX_TOMTX(sSkyboxDrawMatrix);
|
2022-03-21 21:51:23 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void SkyboxDraw_Draw(SkyboxContext* skyboxCtx, GraphicsContext* gfxCtx, s16 skyboxId, s16 blend, f32 x, f32 y, f32 z) {
|
2022-07-05 19:29:34 -04:00
|
|
|
OPEN_DISPS(gfxCtx);
|
2022-05-13 18:43:55 -04:00
|
|
|
FrameInterpolation_RecordOpenChild(NULL, FrameInterpolation_GetCameraEpoch());
|
2022-03-21 21:51:23 -04:00
|
|
|
|
2022-11-29 18:29:36 -05:00
|
|
|
Gfx_SetupDL_40Opa(gfxCtx);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
|
|
|
//gsSPShaderTest(POLY_OPA_DISP++);
|
|
|
|
|
2022-04-02 13:57:20 -04:00
|
|
|
/*gSPSegment(POLY_OPA_DISP++, 0x7, skyboxCtx->staticSegments[0]);
|
2022-03-21 21:51:23 -04:00
|
|
|
gSPSegment(POLY_OPA_DISP++, 0x8, skyboxCtx->staticSegments[1]);
|
2022-04-02 13:57:20 -04:00
|
|
|
gSPSegment(POLY_OPA_DISP++, 0x9, skyboxCtx->palettes);*/
|
2022-03-21 21:51:23 -04:00
|
|
|
|
|
|
|
gDPSetPrimColor(POLY_OPA_DISP++, 0x00, 0x00, 0, 0, 0, blend);
|
|
|
|
gSPTexture(POLY_OPA_DISP++, 0x8000, 0x8000, 0, G_TX_RENDERTILE, G_ON);
|
|
|
|
|
|
|
|
sSkyboxDrawMatrix = Graph_Alloc(gfxCtx, sizeof(Mtx));
|
|
|
|
|
|
|
|
Matrix_Translate(x, y, z, MTXMODE_NEW);
|
|
|
|
Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY);
|
|
|
|
Matrix_RotateX(skyboxCtx->rot.x, MTXMODE_APPLY);
|
|
|
|
Matrix_RotateY(skyboxCtx->rot.y, MTXMODE_APPLY);
|
|
|
|
Matrix_RotateZ(skyboxCtx->rot.z, MTXMODE_APPLY);
|
2022-07-05 19:29:34 -04:00
|
|
|
MATRIX_TOMTX(sSkyboxDrawMatrix);
|
2022-03-21 21:51:23 -04:00
|
|
|
gSPMatrix(POLY_OPA_DISP++, sSkyboxDrawMatrix, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
|
|
|
|
|
|
|
gDPSetColorDither(POLY_OPA_DISP++, G_CD_MAGICSQ);
|
|
|
|
gDPSetTextureFilter(POLY_OPA_DISP++, G_TF_BILERP);
|
|
|
|
|
2022-04-02 13:57:20 -04:00
|
|
|
if (skyboxCtx->palette_size == 256) {
|
|
|
|
gDPLoadTLUT_pal256(POLY_OPA_DISP++, skyboxCtx->palettes[0]);
|
|
|
|
} else {
|
|
|
|
gDPLoadTLUT_pal128(POLY_OPA_DISP++, 0, skyboxCtx->palettes[0]);
|
|
|
|
gDPLoadTLUT_pal128(POLY_OPA_DISP++, 1, skyboxCtx->palettes[1]);
|
|
|
|
}
|
2022-03-21 21:51:23 -04:00
|
|
|
gDPSetTextureLUT(POLY_OPA_DISP++, G_TT_RGBA16);
|
|
|
|
gDPSetTextureConvert(POLY_OPA_DISP++, G_TC_FILT);
|
|
|
|
|
|
|
|
if (skyboxCtx->unk_140) {
|
|
|
|
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf[0]);
|
|
|
|
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf[1]);
|
|
|
|
|
|
|
|
gDPPipeSync(POLY_OPA_DISP++);
|
|
|
|
gDPLoadTLUT_pal256(POLY_OPA_DISP++, skyboxCtx->palettes[1]);
|
|
|
|
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf[2]);
|
|
|
|
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf[3]);
|
|
|
|
|
|
|
|
if (skyboxId != SKYBOX_BAZAAR) {
|
|
|
|
if (skyboxId <= SKYBOX_HOUSE_KAKARIKO || skyboxId > SKYBOX_BOMBCHU_SHOP) {
|
|
|
|
gDPPipeSync(POLY_OPA_DISP++);
|
|
|
|
gDPLoadTLUT_pal256(POLY_OPA_DISP++, skyboxCtx->palettes[2]);
|
|
|
|
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf[4]);
|
|
|
|
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf[5]);
|
|
|
|
|
|
|
|
gDPPipeSync(POLY_OPA_DISP++);
|
|
|
|
if (skyboxCtx->unk_140 != 2) {
|
|
|
|
gDPLoadTLUT_pal256(POLY_OPA_DISP++, skyboxCtx->palettes[3]);
|
|
|
|
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf[6]);
|
|
|
|
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf[7]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf[0]);
|
|
|
|
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf[2]);
|
|
|
|
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf[4]);
|
|
|
|
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf[6]);
|
|
|
|
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf[8]);
|
|
|
|
if (skyboxId == SKYBOX_CUTSCENE_MAP) {
|
|
|
|
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf[10]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gDPPipeSync(POLY_OPA_DISP++);
|
|
|
|
//gsSPShaderTest2(POLY_OPA_DISP++);
|
|
|
|
|
2022-05-13 18:43:55 -04:00
|
|
|
FrameInterpolation_RecordCloseChild();
|
2022-07-05 19:29:34 -04:00
|
|
|
CLOSE_DISPS(gfxCtx);
|
2022-03-21 21:51:23 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void SkyboxDraw_Update(SkyboxContext* skyboxCtx) {
|
|
|
|
}
|