2020-10-03 15:22:44 +00:00
|
|
|
#include "global.h"
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-05-15 09:14:07 +00:00
|
|
|
Mtx* sSkyboxDrawMatrix;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2022-11-26 22:53:41 +00:00
|
|
|
Mtx* Skybox_UpdateMatrix(SkyboxContext* skyboxCtx, f32 x, f32 y, f32 z) {
|
2020-05-15 09:14:07 +00:00
|
|
|
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);
|
|
|
|
return Matrix_ToMtx(sSkyboxDrawMatrix, "../z_vr_box_draw.c", 42);
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2022-11-26 22:53:41 +00:00
|
|
|
void Skybox_Draw(SkyboxContext* skyboxCtx, GraphicsContext* gfxCtx, s16 skyboxId, s16 blend, f32 x, f32 y, f32 z) {
|
2020-08-29 23:00:17 +00:00
|
|
|
OPEN_DISPS(gfxCtx, "../z_vr_box_draw.c", 52);
|
2020-05-15 09:14:07 +00:00
|
|
|
|
2022-06-03 22:25:48 +00:00
|
|
|
Gfx_SetupDL_40Opa(gfxCtx);
|
2020-05-15 09:14:07 +00:00
|
|
|
|
2020-12-06 18:48:51 +00:00
|
|
|
gSPSegment(POLY_OPA_DISP++, 0x7, skyboxCtx->staticSegments[0]);
|
|
|
|
gSPSegment(POLY_OPA_DISP++, 0x8, skyboxCtx->staticSegments[1]);
|
2021-09-21 08:48:43 +00:00
|
|
|
gSPSegment(POLY_OPA_DISP++, 0x9, skyboxCtx->palettes);
|
2020-05-15 09:14:07 +00:00
|
|
|
|
2021-09-20 16:51:35 +00:00
|
|
|
gDPSetPrimColor(POLY_OPA_DISP++, 0x00, 0x00, 0, 0, 0, blend);
|
2020-10-29 21:31:09 +00:00
|
|
|
gSPTexture(POLY_OPA_DISP++, 0x8000, 0x8000, 0, G_TX_RENDERTILE, G_ON);
|
2020-05-15 09:14:07 +00:00
|
|
|
|
2020-08-29 23:00:17 +00:00
|
|
|
sSkyboxDrawMatrix = Graph_Alloc(gfxCtx, sizeof(Mtx));
|
2020-05-15 09:14:07 +00:00
|
|
|
|
|
|
|
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);
|
|
|
|
Matrix_ToMtx(sSkyboxDrawMatrix, "../z_vr_box_draw.c", 76);
|
2020-10-29 21:31:09 +00:00
|
|
|
gSPMatrix(POLY_OPA_DISP++, sSkyboxDrawMatrix, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
2020-05-15 09:14:07 +00:00
|
|
|
|
2020-10-29 21:31:09 +00:00
|
|
|
gDPSetColorDither(POLY_OPA_DISP++, G_CD_MAGICSQ);
|
|
|
|
gDPSetTextureFilter(POLY_OPA_DISP++, G_TF_BILERP);
|
2020-05-15 09:14:07 +00:00
|
|
|
|
2021-09-21 08:48:43 +00:00
|
|
|
gDPLoadTLUT_pal256(POLY_OPA_DISP++, skyboxCtx->palettes[0]);
|
2020-10-29 21:31:09 +00:00
|
|
|
gDPSetTextureLUT(POLY_OPA_DISP++, G_TT_RGBA16);
|
|
|
|
gDPSetTextureConvert(POLY_OPA_DISP++, G_TC_FILT);
|
2020-05-15 09:14:07 +00:00
|
|
|
|
|
|
|
if (skyboxCtx->unk_140) {
|
2021-09-21 08:48:43 +00:00
|
|
|
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf[0]);
|
|
|
|
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf[1]);
|
2020-05-15 09:14:07 +00:00
|
|
|
|
2020-10-29 21:31:09 +00:00
|
|
|
gDPPipeSync(POLY_OPA_DISP++);
|
2021-09-21 08:48:43 +00:00
|
|
|
gDPLoadTLUT_pal256(POLY_OPA_DISP++, skyboxCtx->palettes[1]);
|
|
|
|
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf[2]);
|
|
|
|
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf[3]);
|
2020-05-15 09:14:07 +00:00
|
|
|
|
2021-07-04 15:43:04 +00:00
|
|
|
if (skyboxId != SKYBOX_BAZAAR) {
|
|
|
|
if (skyboxId <= SKYBOX_HOUSE_KAKARIKO || skyboxId > SKYBOX_BOMBCHU_SHOP) {
|
2020-10-29 21:31:09 +00:00
|
|
|
gDPPipeSync(POLY_OPA_DISP++);
|
2021-09-21 08:48:43 +00:00
|
|
|
gDPLoadTLUT_pal256(POLY_OPA_DISP++, skyboxCtx->palettes[2]);
|
|
|
|
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf[4]);
|
|
|
|
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf[5]);
|
2020-05-15 09:14:07 +00:00
|
|
|
|
2021-09-21 08:48:43 +00:00
|
|
|
gDPPipeSync(POLY_OPA_DISP++);
|
2020-05-15 09:14:07 +00:00
|
|
|
if (skyboxCtx->unk_140 != 2) {
|
2021-09-21 08:48:43 +00:00
|
|
|
gDPLoadTLUT_pal256(POLY_OPA_DISP++, skyboxCtx->palettes[3]);
|
|
|
|
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf[6]);
|
|
|
|
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf[7]);
|
2020-05-15 09:14:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
2021-09-21 08:48:43 +00:00
|
|
|
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]);
|
2021-07-04 15:43:04 +00:00
|
|
|
if (skyboxId == SKYBOX_CUTSCENE_MAP) {
|
2021-09-21 08:48:43 +00:00
|
|
|
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf[10]);
|
2020-05-15 09:14:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-29 21:31:09 +00:00
|
|
|
gDPPipeSync(POLY_OPA_DISP++);
|
2020-08-29 23:00:17 +00:00
|
|
|
|
|
|
|
CLOSE_DISPS(gfxCtx, "../z_vr_box_draw.c", 125);
|
2020-05-15 09:14:07 +00:00
|
|
|
}
|
|
|
|
|
2022-11-26 22:53:41 +00:00
|
|
|
void Skybox_Update(SkyboxContext* skyboxCtx) {
|
2020-05-15 09:14:07 +00:00
|
|
|
}
|