Fixed the texcoord generation mode 2 (normal).

I know it's strange, but it seems the transform must be applied on the raw texcoord val, not on the floating-point one.
This commit is contained in:
luigi__ 2009-02-07 17:19:26 +00:00
parent 1029997586
commit e3f4325160
1 changed files with 10 additions and 5 deletions

View File

@ -700,6 +700,11 @@ static void SetVertex()
poly.polyAttr = polyAttr; poly.polyAttr = polyAttr;
poly.texParam = textureFormat; poly.texParam = textureFormat;
poly.texPalette = texturePalette; poly.texPalette = texturePalette;
poly.averageDepth = getAverageDepth( vertlist->list[poly.vertIndexes[0]].coord,
vertlist->list[poly.vertIndexes[1]].coord,
vertlist->list[poly.vertIndexes[2]].coord,
vertlist->list[poly.vertIndexes[3]].coord,
poly.type);
polylist->count++; polylist->count++;
} }
} }
@ -890,11 +895,10 @@ void gfx3d_glNormal(u32 v)
if (texCoordinateTransform == 2) if (texCoordinateTransform == 2)
{ {
float normal_fixed[3] = {normal[0]/8,normal[1]/8,normal[2]/8}; last_s =( (normal[0] *mtxCurrent[3][0] + normal[1] *mtxCurrent[3][4] +
last_s =( (normal_fixed[0] *mtxCurrent[3][0] + normal_fixed[1] *mtxCurrent[3][4] + normal[2] *mtxCurrent[3][8]) + (_s*16.0f)) / 16.0f;
normal_fixed[2] *mtxCurrent[3][8]) + _s); last_t =( (normal[0] *mtxCurrent[3][1] + normal[1] *mtxCurrent[3][5] +
last_t =( (normal_fixed[0] *mtxCurrent[3][1] + normal_fixed[1] *mtxCurrent[3][5] + normal[2] *mtxCurrent[3][9]) + (_t*16.0f)) / 16.0f;
normal_fixed[2] *mtxCurrent[3][9]) + _t);
} }
@ -1249,6 +1253,7 @@ void gfx3d_glFlush(u32 v)
if(!poly.isTranslucent()) if(!poly.isTranslucent())
gfx3d.indexlist[ctr++] = i; gfx3d.indexlist[ctr++] = i;
} }
int translucentPolyStart = ctr;
//then look for translucent polys //then look for translucent polys
for(int i=0;i<polycount;i++) { for(int i=0;i<polycount;i++) {
POLY &poly = polylist->list[i]; POLY &poly = polylist->list[i];