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
|
|
|
|
2020-05-15 09:14:07 +00:00
|
|
|
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);
|
|
|
|
return Matrix_ToMtx(sSkyboxDrawMatrix, "../z_vr_box_draw.c", 42);
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-05-15 09:14:07 +00:00
|
|
|
void SkyboxDraw_Draw(SkyboxContext* skyboxCtx, GraphicsContext* gfxCtx, s16 skyboxId, s16 alpha, 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
|
|
|
|
|
|
|
func_800945A0(gfxCtx);
|
|
|
|
|
2020-08-29 23:00:17 +00:00
|
|
|
gSPSegment(oGfxCtx->polyOpa.p++, 7, skyboxCtx->staticSegments[0]);
|
|
|
|
gSPSegment(oGfxCtx->polyOpa.p++, 8, skyboxCtx->staticSegments[1]);
|
|
|
|
gSPSegment(oGfxCtx->polyOpa.p++, 9, skyboxCtx->staticSegments[2]);
|
2020-05-15 09:14:07 +00:00
|
|
|
|
2020-08-29 23:00:17 +00:00
|
|
|
gDPSetPrimColor(oGfxCtx->polyOpa.p++, 0x00, 0x00, 0, 0, 0, alpha);
|
|
|
|
gSPTexture(oGfxCtx->polyOpa.p++, 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-08-29 23:00:17 +00:00
|
|
|
gSPMatrix(oGfxCtx->polyOpa.p++, sSkyboxDrawMatrix, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
2020-05-15 09:14:07 +00:00
|
|
|
|
2020-08-29 23:00:17 +00:00
|
|
|
gDPSetColorDither(oGfxCtx->polyOpa.p++, G_CD_MAGICSQ);
|
|
|
|
gDPSetTextureFilter(oGfxCtx->polyOpa.p++, G_TF_BILERP);
|
2020-05-15 09:14:07 +00:00
|
|
|
|
2020-08-29 23:00:17 +00:00
|
|
|
gDPLoadTLUT_pal256(oGfxCtx->polyOpa.p++, skyboxCtx->staticSegments[2]);
|
|
|
|
gDPSetTextureLUT(oGfxCtx->polyOpa.p++, G_TT_RGBA16);
|
|
|
|
gDPSetTextureConvert(oGfxCtx->polyOpa.p++, G_TC_FILT);
|
2020-05-15 09:14:07 +00:00
|
|
|
|
|
|
|
if (skyboxCtx->unk_140) {
|
2020-08-29 23:00:17 +00:00
|
|
|
gSPDisplayList(oGfxCtx->polyOpa.p++, skyboxCtx->dpList);
|
|
|
|
gSPDisplayList(oGfxCtx->polyOpa.p++, skyboxCtx->dpList + 150 * 1);
|
2020-05-15 09:14:07 +00:00
|
|
|
|
2020-08-29 23:00:17 +00:00
|
|
|
gDPPipeSync(oGfxCtx->polyOpa.p++);
|
2020-05-15 09:14:07 +00:00
|
|
|
|
2020-08-29 23:00:17 +00:00
|
|
|
gDPLoadTLUT_pal256(oGfxCtx->polyOpa.p++, (u16*)skyboxCtx->staticSegments[2] + 256 * 1);
|
2020-05-15 09:14:07 +00:00
|
|
|
|
2020-08-29 23:00:17 +00:00
|
|
|
gSPDisplayList(oGfxCtx->polyOpa.p++, skyboxCtx->dpList + 150 * 2);
|
|
|
|
gSPDisplayList(oGfxCtx->polyOpa.p++, skyboxCtx->dpList + 150 * 3);
|
2020-05-15 09:14:07 +00:00
|
|
|
|
|
|
|
if (skyboxId != 2) {
|
|
|
|
if (skyboxId <= 0x10 || skyboxId >= 0x19) {
|
2020-08-29 23:00:17 +00:00
|
|
|
gDPPipeSync(oGfxCtx->polyOpa.p++);
|
|
|
|
gDPLoadTLUT_pal256(oGfxCtx->polyOpa.p++, (u16*)skyboxCtx->staticSegments[2] + 256 * 2);
|
|
|
|
gSPDisplayList(oGfxCtx->polyOpa.p++, skyboxCtx->dpList + 150 * 4);
|
|
|
|
gSPDisplayList(oGfxCtx->polyOpa.p++, skyboxCtx->dpList + 150 * 5);
|
|
|
|
gDPPipeSync(oGfxCtx->polyOpa.p++);
|
2020-05-15 09:14:07 +00:00
|
|
|
|
|
|
|
if (skyboxCtx->unk_140 != 2) {
|
2020-08-29 23:00:17 +00:00
|
|
|
gDPLoadTLUT_pal256(oGfxCtx->polyOpa.p++, (u16*)skyboxCtx->staticSegments[2] + 256 * 3);
|
|
|
|
gSPDisplayList(oGfxCtx->polyOpa.p++, skyboxCtx->dpList + 150 * 6);
|
|
|
|
gSPDisplayList(oGfxCtx->polyOpa.p++, skyboxCtx->dpList + 150 * 7);
|
2020-05-15 09:14:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
2020-08-29 23:00:17 +00:00
|
|
|
gSPDisplayList(oGfxCtx->polyOpa.p++, skyboxCtx->dpList);
|
|
|
|
gSPDisplayList(oGfxCtx->polyOpa.p++, skyboxCtx->dpList + 150 * 2);
|
|
|
|
gSPDisplayList(oGfxCtx->polyOpa.p++, skyboxCtx->dpList + 150 * 4);
|
|
|
|
gSPDisplayList(oGfxCtx->polyOpa.p++, skyboxCtx->dpList + 150 * 6);
|
|
|
|
gSPDisplayList(oGfxCtx->polyOpa.p++, skyboxCtx->dpList + 150 * 8);
|
2020-05-15 09:14:07 +00:00
|
|
|
if (skyboxId == 5) {
|
2020-08-29 23:00:17 +00:00
|
|
|
gSPDisplayList(oGfxCtx->polyOpa.p++, skyboxCtx->dpList + 150 * 10);
|
2020-05-15 09:14:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-29 23:00:17 +00:00
|
|
|
gDPPipeSync(oGfxCtx->polyOpa.p++);
|
|
|
|
|
|
|
|
CLOSE_DISPS(gfxCtx, "../z_vr_box_draw.c", 125);
|
2020-05-15 09:14:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SkyboxDraw_Update(SkyboxContext* skyboxCtx) {
|
|
|
|
}
|