OpenGL:
- fix line segment detection (fix missing textures in Garfield's Nightmare, Zelda PH); - recreate toon texture on load state;
This commit is contained in:
parent
ea19f9cf6c
commit
47f781d26d
|
@ -519,6 +519,13 @@ static char OGLInit(void)
|
|||
glTexParameterf(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameterf(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_CLAMP); //clamp so that we dont run off the edges due to 1.0 -> [0,31] math
|
||||
|
||||
// Restore Toon table
|
||||
u32 rgbToonTable[32];
|
||||
for(int i=0;i<32;i++)
|
||||
rgbToonTable[i] = RGB15TO32_NOALPHA(gfx3d.renderState.u16ToonTable[i]);
|
||||
glTexImage1D(GL_TEXTURE_1D, 0, GL_RGB, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, &rgbToonTable[0]);
|
||||
gfx3d.state.invalidateToon = false;
|
||||
}
|
||||
|
||||
// ClearImage/Rear-plane
|
||||
|
|
|
@ -498,6 +498,7 @@ void gfx3d_reset()
|
|||
flushPending = FALSE;
|
||||
memset(polylists, 0, sizeof(polylists));
|
||||
memset(vertlists, 0, sizeof(vertlists));
|
||||
gfx3d.state.invalidateToon = true;
|
||||
listTwiddle = 1;
|
||||
twiddleLists();
|
||||
gfx3d.polylist = polylist;
|
||||
|
@ -742,21 +743,24 @@ static void SetVertex()
|
|||
|
||||
// Line segment detect
|
||||
// Tested" Castlevania POR - warp stone, trajectory of ricochet, "Eye of Decay"
|
||||
bool duplicated = false;
|
||||
VERT &vert0 = vertlist->list[poly.vertIndexes[0]];
|
||||
VERT &vert1 = vertlist->list[poly.vertIndexes[1]];
|
||||
VERT &vert2 = vertlist->list[poly.vertIndexes[2]];
|
||||
if ( (vert0.x == vert1.x) && (vert0.y == vert1.y) ) duplicated = true;
|
||||
else
|
||||
if ( (vert1.x == vert2.x) && (vert1.y == vert2.y) ) duplicated = true;
|
||||
else
|
||||
if ( (vert0.y == vert1.y) && (vert1.y == vert2.y) ) duplicated = true;
|
||||
else
|
||||
if ( (vert0.x == vert1.x) && (vert1.x == vert2.x) ) duplicated = true;
|
||||
if (duplicated)
|
||||
if (textureFormat & (7 << 26) == 0) // no texture
|
||||
{
|
||||
//printf("Line Segmet detected (poly type %i, mode %i)\n", poly.type, poly.vtxFormat);
|
||||
poly.vtxFormat = vtxFormat + 4;
|
||||
bool duplicated = false;
|
||||
VERT &vert0 = vertlist->list[poly.vertIndexes[0]];
|
||||
VERT &vert1 = vertlist->list[poly.vertIndexes[1]];
|
||||
VERT &vert2 = vertlist->list[poly.vertIndexes[2]];
|
||||
if ( (vert0.x == vert1.x) && (vert0.y == vert1.y) ) duplicated = true;
|
||||
else
|
||||
if ( (vert1.x == vert2.x) && (vert1.y == vert2.y) ) duplicated = true;
|
||||
else
|
||||
if ( (vert0.y == vert1.y) && (vert1.y == vert2.y) ) duplicated = true;
|
||||
else
|
||||
if ( (vert0.x == vert1.x) && (vert1.x == vert2.x) ) duplicated = true;
|
||||
if (duplicated)
|
||||
{
|
||||
//printf("Line Segmet detected (poly type %i, mode %i, texparam %08X)\n", poly.type, poly.vtxFormat, textureFormat);
|
||||
poly.vtxFormat = vtxFormat + 4;
|
||||
}
|
||||
}
|
||||
|
||||
poly.polyAttr = polyAttr;
|
||||
|
|
Loading…
Reference in New Issue