Enhance detection of flipped sprites

- Use PGXP to better detect and reject 3D elements
- Greatly reduces false positives which caused visible popping on 3D elements as their UVs align on screen.
This commit is contained in:
iCatButler 2018-12-08 20:43:00 +00:00
parent b9dbeb7b54
commit ea51d22616

View File

@ -533,8 +533,11 @@ void Calc_UVOffsets(PS_GPU *gpu, tri_vertex *vertices, unsigned count)
// iCB: Detect and reject any triangles with 0 size texture area
float texArea = (vertices[1].u - vertices[0].u) * (vertices[2].v - vertices[0].v) - (vertices[2].u - vertices[0].u) * (vertices[1].v - vertices[0].v);
// Leverage PGXP to further avoid 3D polygons that just happen to align this way after projection
bool is3D = ((vertices[0].precise[2] != vertices[1].precise[2]) || (vertices[1].precise[2] != vertices[2].precise[2]));
// Shouldn't matter as degenerate primitives will be culled anyways.
if ((area != 0.0f) && (texArea != 0.0f))
if ((area != 0.0f) && (texArea != 0.0f) && !is3D)
{
float inv_area = 1.0f / area;
dudx *= inv_area;