1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-04 10:03:36 +00:00

Fix set vertex z in prim-depth mode.

Fixed flagshot in Mario Golf.
This commit is contained in:
Sergey Lipskiy 2014-12-23 16:57:21 +06:00
parent 0a9fa85fd6
commit 8e3679e321
2 changed files with 11 additions and 8 deletions

View File

@ -290,6 +290,13 @@ void OGLRender::addTriangle(int _v0, int _v1, int _v2)
vtx.flat_a = vtx.a;
}
}
if (gDP.otherMode.depthSource == G_ZS_PRIM) {
for (u32 i = triangles.num - 3; i < triangles.num; ++i) {
SPVertex & vtx = triangles.vertices[triangles.elements[i]];
vtx.z = gDP.primDepth.z * vtx.w;
}
}
}
#define ORKIN_BLENDMODE

12
gSP.cpp
View File

@ -326,12 +326,11 @@ void gSPProcessVertex4(u32 v)
}
gSPTransformVertex4(v, gSP.matrix.combined );
for(int i = 0; i < 4; ++i) {
SPVertex & vtx = render.getVertex(v+i);
if (gDP.otherMode.depthSource == G_ZS_PRIM)
vtx.z = gDP.primDepth.z * vtx.w;
if (gSP.viewport.vscale[0] < 0)
if (gSP.viewport.vscale[0] < 0) {
for(int i = 0; i < 4; ++i) {
SPVertex & vtx = render.getVertex(v+i);
vtx.x = -vtx.x;
}
}
if (gSP.matrix.billboard)
@ -550,9 +549,6 @@ void gSPProcessVertex(u32 v)
float vPos[3] = {(float)vtx.x, (float)vtx.y, (float)vtx.z};
gSPTransformVertex( &vtx.x, gSP.matrix.combined );
if (gDP.otherMode.depthSource == G_ZS_PRIM)
vtx.z = gDP.primDepth.z * vtx.w;
if (gSP.viewport.vscale[0] < 0)
vtx.x = -vtx.x;