Fix layering a bit more.

This commit is contained in:
Fazana
2021-09-14 22:41:47 +01:00
parent 2a4dec1890
commit 35c5adafbe

View File

@@ -139,28 +139,20 @@ LookAt lookAt;
/**
* Process a master list node. This has been modified, so now it runs twice, for each microcode.
It iterates through the first 5 layers of if the first index using F3DZEX, then it switches
to F3DLX2.Rej and iterates through all layers, then switches back to F3DZEX and finishes the last
It iterates through the first 5 layers of if the first index using F3DLX2.Rej, then it switches
to F3DZEX and iterates through all layers, then switches back to F3DLX2.Rej and finishes the last
3. It does this, because layers 5-7 are non zbuffered, and just doing 0-7 of ZEX, then 0-7 of REJ
would make the rej 0-4 render on top of ZEX's 5-7.
would make the ZEX 0-4 render on top of Rej's 5-7.
*/
static void geo_process_master_list_sub(struct GraphNodeMasterList *node) {
struct DisplayListNode *currList;
s32 i = 0;
s32 j = 0;
s32 j = 1;
s32 renderPhase = 0;
s32 enableZBuffer = (node->node.flags & GRAPH_RENDER_Z_BUFFER) != 0;
struct RenderModeContainer *modeList = &renderModeTable_1Cycle[enableZBuffer];
struct RenderModeContainer *mode2List = &renderModeTable_2Cycle[enableZBuffer];
// @bug This is where the LookAt values should be calculated but aren't.
// As a result, environment mapping is broken on Fast3DEX2 without the
// changes below.
#ifdef F3DEX_GBI_2
Mtx lMtx;
guLookAtReflect(&lMtx, &lookAt, 0, 0, 0, /* eye */ 0, 0, 1, /* at */ 1, 0, 0 /* up */);
#endif
if (enableZBuffer != 0)
{
gDPPipeSync(gDisplayListHead++);
@@ -169,32 +161,36 @@ static void geo_process_master_list_sub(struct GraphNodeMasterList *node) {
#ifdef F3DZEX_GBI_2
loopBegin:
//Load rejection on pass 2. ZEX is loaded afterwards.
if (renderPhase > 0)
if (renderPhase == 2)
{
if (j == 1)
{
gSPLoadUcodeL(gDisplayListHead++, gspF3DLX2_Rej_fifo);
init_rcp(0);
gSPClipRatio(gDisplayListHead++, FRUSTRATIO_2);
}
else
{
gSPLoadUcodeL(gDisplayListHead++, gspF3DZEX2_PosLight_fifo);
init_rcp(0);
gSPClipRatio(gDisplayListHead++, FRUSTRATIO_1);
}
if (enableZBuffer != 0)
{
gDPPipeSync(gDisplayListHead++);
gSPSetGeometryMode(gDisplayListHead++, G_ZBUFFER);
}
guLookAtReflect(&lMtx, &lookAt, 0, 0, 0, /* eye */ 0, 0, 1, /* at */ 1, 0, 0 /* up */);
gSPLoadUcodeL(gDisplayListHead++, gspF3DLX2_Rej_fifo);
init_rcp(0);
gSPClipRatio(gDisplayListHead++, FRUSTRATIO_2);
}
else
if (renderPhase == 1)
{
gSPLoadUcodeL(gDisplayListHead++, gspF3DZEX2_PosLight_fifo);
init_rcp(0);
gSPClipRatio(gDisplayListHead++, FRUSTRATIO_1);
}
if (enableZBuffer != 0)
{
gDPPipeSync(gDisplayListHead++);
gSPSetGeometryMode(gDisplayListHead++, G_ZBUFFER);
}
#endif
// @bug This is where the LookAt values should be calculated but aren't.
// As a result, environment mapping is broken on Fast3DEX2 without the
// changes below.
#ifdef F3DEX_GBI_2
Mtx lMtx;
guLookAtReflect(&lMtx, &lookAt, 0, 0, 0, /* eye */ 0, 0, 1, /* at */ 1, 0, 0 /* up */);
#endif
for (; i < GFX_NUM_MASTER_LISTS; i++)
{
#ifdef F3DZEX_GBI_2
if (i == 5 && (renderPhase == 0 || renderPhase == 2))
if (i == 5 && renderPhase == 0)
break;
#endif
if ((currList = node->listHeads[j][i]) != NULL)
@@ -211,10 +207,12 @@ static void geo_process_master_list_sub(struct GraphNodeMasterList *node) {
#ifdef F3DZEX_GBI_2
switch (renderPhase)
{
case 0: renderPhase++; j = 1; i = 0; goto loopBegin;
case 1: renderPhase++; i = 5; goto loopBegin;
case 2: renderPhase++; j = 0; i = 5; goto loopBegin;
case 0: renderPhase++; j = 0; i = 0; goto loopBegin;
case 1: renderPhase++; j = 1; i = 5; goto loopBegin;
}
gSPLoadUcodeL(gDisplayListHead++, gspF3DZEX2_PosLight_fifo);
init_rcp(0);
gSPClipRatio(gDisplayListHead++, FRUSTRATIO_1);
#endif
if (enableZBuffer != 0)
{