0.9.8: rasterize: fix pixel poly regression at r3954
This commit is contained in:
parent
af2573981e
commit
b12f564aec
|
@ -143,7 +143,7 @@ public:
|
|||
commandCursor = 0;
|
||||
size = 0;
|
||||
|
||||
// A “command without parameters” is one of the four following commands:
|
||||
// A "command without parameters" is one of the four following commands:
|
||||
// - PushMatrix
|
||||
// - LoadIdentity
|
||||
// - End
|
||||
|
@ -2833,71 +2833,3 @@ void GFX3D_Clipper::clipPoly(POLY* poly, VERT** verts)
|
|||
|
||||
}
|
||||
#endif
|
||||
|
||||
// "Workaround" for line poly
|
||||
bool gfx3d_IsLinePoly(POLY *poly)
|
||||
{
|
||||
if(!CommonSettings.GFX3D_LineHack) return false;
|
||||
|
||||
int type = poly->type;
|
||||
VERT *vert1, *vert2;
|
||||
|
||||
if (type <= 2)
|
||||
return true;
|
||||
else if (type > 10)
|
||||
return false;
|
||||
|
||||
// Method 1:
|
||||
// Castlevania Portrait of Ruin - trajectory of ricochet
|
||||
bool duplicatedVert[10];
|
||||
for(int i = 0; i < type; i++)
|
||||
duplicatedVert[i] = false;
|
||||
for(int i = 0; i < type - 1; i++)
|
||||
{
|
||||
vert1 = &gfx3d.vertlist->list[poly->vertIndexes[i]];
|
||||
for(int j = i + 1; j < type; j++)
|
||||
{
|
||||
vert2 = &gfx3d.vertlist->list[poly->vertIndexes[j]];
|
||||
if (vert1->x == vert2->x && vert1->y == vert2->y
|
||||
//&& vert1->z == vert2->z
|
||||
)
|
||||
{
|
||||
duplicatedVert[j] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
int vertCount = type;
|
||||
for(int i = 0; i < type; i++)
|
||||
{
|
||||
if (duplicatedVert[i])
|
||||
vertCount--;
|
||||
}
|
||||
if (vertCount <= 2)
|
||||
return true;
|
||||
|
||||
// Method 2:
|
||||
// Castlevania Portrait of Ruin - warp stone
|
||||
bool horizontalLine = true;
|
||||
bool verticalLine = true;
|
||||
vert1 = &gfx3d.vertlist->list[poly->vertIndexes[0]];
|
||||
for(int i = 1; i < type && (horizontalLine || verticalLine); i++)
|
||||
{
|
||||
vert2 = &gfx3d.vertlist->list[poly->vertIndexes[i]];
|
||||
if (vert1->coord[0] != vert2->coord[0])
|
||||
{
|
||||
verticalLine = false;
|
||||
}
|
||||
if (vert1->coord[1] != vert2->coord[1])
|
||||
{
|
||||
horizontalLine = false;
|
||||
}
|
||||
|
||||
//the Z is different, and this method isn't even meant to catch that
|
||||
//if (vert1->coord[2] != vert2->coord[2])
|
||||
// return false;
|
||||
}
|
||||
if (horizontalLine || verticalLine)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -447,6 +447,4 @@ bool gfx3d_loadstate(EMUFILE* is, int size);
|
|||
|
||||
void gfx3d_ClearStack();
|
||||
|
||||
bool gfx3d_IsLinePoly(POLY *poly);
|
||||
|
||||
#endif //_GFX3D_H_
|
||||
|
|
|
@ -200,6 +200,11 @@ struct edge_fx_fl {
|
|||
float curr, step, stepExtra;
|
||||
FORCEINLINE void doStep() { curr += step; }
|
||||
FORCEINLINE void doStepExtra() { curr += stepExtra; }
|
||||
FORCEINLINE void initialize(float value) {
|
||||
curr = value;
|
||||
step = 0;
|
||||
stepExtra = 0;
|
||||
}
|
||||
FORCEINLINE void initialize(float top, float bottom, float dx, float dy, long XStep, float XPrestep, float YPrestep) {
|
||||
dx = 0;
|
||||
dy *= (bottom-top);
|
||||
|
@ -265,8 +270,18 @@ FORCEINLINE edge_fx_fl::edge_fx_fl(int Top, int Bottom, VERT** verts, bool& fail
|
|||
}
|
||||
else
|
||||
{
|
||||
memset(this, 0, sizeof(*this));
|
||||
this->verts = verts;
|
||||
// even if Width == 0 && Height == 0, give some info for pixel poly
|
||||
// example: Castlevania Portrait of Ruin, warp stone
|
||||
XStep = 1;
|
||||
Numerator = 0;
|
||||
Denominator = 1;
|
||||
ErrorTerm = 0;
|
||||
invw.initialize(1/verts[Top]->w);
|
||||
u.initialize(verts[Top]->u);
|
||||
v.initialize(verts[Top]->v);
|
||||
z.initialize(verts[Top]->z);
|
||||
for(int i=0;i<3;i++)
|
||||
color[i].initialize(verts[Top]->fcolor[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1045,7 +1060,7 @@ public:
|
|||
|
||||
polyAttr.backfacing = engine->polyBackfacing[i];
|
||||
|
||||
shape_engine<SLI>(type,!polyAttr.backfacing, gfx3d_IsLinePoly(poly));
|
||||
shape_engine<SLI>(type,!polyAttr.backfacing, (poly->vtxFormat & 4) && CommonSettings.GFX3D_LineHack);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue