diff --git a/port/fast3d/gfx_pc.cpp b/port/fast3d/gfx_pc.cpp index ff93f9163..a1ebe4ec1 100644 --- a/port/fast3d/gfx_pc.cpp +++ b/port/fast3d/gfx_pc.cpp @@ -1183,9 +1183,11 @@ static void gfx_sp_tri1(uint8_t vtx1_idx, uint8_t vtx2_idx, uint8_t vtx3_idx, bo // if (rand()%2) return; - if (v1->clip_rej & v2->clip_rej & v3->clip_rej) { - // The whole triangle lies outside the visible area - return; + if ((rsp.extra_geometry_mode & G_NO_CLIPPING_EXT) == 0) { + if (v1->clip_rej & v2->clip_rej & v3->clip_rej) { + // The whole triangle lies outside the visible area + return; + } } if ((rsp.geometry_mode & G_CULL_BOTH) != 0) { diff --git a/src/game/sky.c b/src/game/sky.c index 588c7209c..e65e9eccc 100644 --- a/src/game/sky.c +++ b/src/game/sky.c @@ -855,6 +855,7 @@ Gfx *skyRender(Gfx *gdl) mtx4MultMtx4(camGetWorldToScreenMtxf(), &g_SkyMtx, mtx); mtxF2L(mtx, mtx); + gSPSetExtraGeometryModeEXT(gdl++, G_NO_CLIPPING_EXT); gSPMatrix(gdl++, osVirtualToPhysical(mtx), G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_PUSH); gSPColor(gdl++, osVirtualToPhysical(cols), numvertices); gSPVertex(gdl++, osVirtualToPhysical(verts), numvertices, 0); @@ -863,8 +864,8 @@ Gfx *skyRender(Gfx *gdl) verts[i].x = watervertices3d[i].x; verts[i].y = watervertices3d[i].y; verts[i].z = watervertices3d[i].z; - verts[i].s = watervertices3d[i].s; - verts[i].t = watervertices3d[i].t; + verts[i].s = skyClamp(watervertices3d[i].s, -32768.f, 32767.f); + verts[i].t = skyClamp(watervertices3d[i].t, -32768.f, 32767.f); verts[i].colour = i * 4; cols[i].r = watervertices3d[i].r; cols[i].g = watervertices3d[i].g; @@ -881,6 +882,7 @@ Gfx *skyRender(Gfx *gdl) } gSPPopMatrix(gdl++, G_MTX_MODELVIEW); + gSPClearExtraGeometryModeEXT(gdl++, G_NO_CLIPPING_EXT); #endif } } @@ -1336,17 +1338,17 @@ Gfx *skyRender(Gfx *gdl) mtx4MultMtx4(camGetWorldToScreenMtxf(), &g_SkyMtx, mtx); mtxF2L(mtx, mtx); + gSPSetExtraGeometryModeEXT(gdl++, G_NO_CLIPPING_EXT); gSPMatrix(gdl++, osVirtualToPhysical(mtx), G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_PUSH); gSPColor(gdl++, osVirtualToPhysical(cols), numvertices); gSPVertex(gdl++, osVirtualToPhysical(verts), numvertices, 0); - const f32 iscale = 1.f / scale; for (s32 i = 0; i < numvertices; ++i) { verts[i].x = skyvertices3d[i].x; verts[i].y = skyvertices3d[i].y; verts[i].z = skyvertices3d[i].z; - verts[i].s = skyvertices3d[i].s; - verts[i].t = skyvertices3d[i].t; + verts[i].s = skyClamp(skyvertices3d[i].s, -32768.f, 32767.f); + verts[i].t = skyClamp(skyvertices3d[i].t, -32768.f, 32767.f); verts[i].colour = i * 4; cols[i].r = skyvertices3d[i].r; cols[i].g = skyvertices3d[i].g; @@ -1363,6 +1365,7 @@ Gfx *skyRender(Gfx *gdl) } gSPPopMatrix(gdl++, G_MTX_MODELVIEW); + gSPClearExtraGeometryModeEXT(gdl++, G_NO_CLIPPING_EXT); #endif } diff --git a/src/include/gbiex.h b/src/include/gbiex.h index 1bbef5a8b..574850299 100644 --- a/src/include/gbiex.h +++ b/src/include/gbiex.h @@ -201,6 +201,7 @@ #define G_ASPECT_RIGHT_EXT 0x00000020 #define G_ASPECT_CENTER_EXT (G_ASPECT_LEFT_EXT | G_ASPECT_RIGHT_EXT) #define G_ASPECT_MODE_EXT G_ASPECT_CENTER_EXT +#define G_NO_CLIPPING_EXT 0x00000040 /* Extended command macros */