aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStapleButter <thetotalworm@gmail.com>2017-04-28 17:35:57 +0200
committerStapleButter <thetotalworm@gmail.com>2017-04-28 17:35:57 +0200
commit2273bd2ea46c1d53a775d0f11bf902e1b3bb125b (patch)
tree1868d536addbf17dd42137809682c456fb0b8931 /src
parent5de98cd48404a59fb5ed0bedc233671f55540960 (diff)
fix texcoord-from-vertex mode. it works like for normals (1.0 = 1/16 texel)
Diffstat (limited to 'src')
-rw-r--r--src/GPU3D.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/GPU3D.cpp b/src/GPU3D.cpp
index fd1b98f..a63193f 100644
--- a/src/GPU3D.cpp
+++ b/src/GPU3D.cpp
@@ -849,6 +849,7 @@ void SubmitPolygon()
if (FlushAttributes & 0x2)
z = w << wshift;
else
+ //z = vtx->Position[2]+0x7FFFFF;//((vtx->Position[2] + (w<<wshift)) * 0x1000) / (w<<(wshift+1));
z = (((s64)vtx->Position[2] * 0x800000) / (w << wshift)) + 0x7FFEFF;
// checkme
@@ -884,8 +885,8 @@ void SubmitVertex()
if ((TexParam >> 30) == 3)
{
- vertextrans->TexCoords[0] = (vertex[0]*TexMatrix[0] + vertex[1]*TexMatrix[4] + vertex[2]*TexMatrix[8] + vertex[3]*(RawTexCoords[0]<<8)) >> 20;
- vertextrans->TexCoords[1] = (vertex[0]*TexMatrix[1] + vertex[1]*TexMatrix[5] + vertex[2]*TexMatrix[9] + vertex[3]*(RawTexCoords[1]<<8)) >> 20;
+ vertextrans->TexCoords[0] = ((vertex[0]*TexMatrix[0] + vertex[1]*TexMatrix[4] + vertex[2]*TexMatrix[8]) >> 24) + RawTexCoords[0];
+ vertextrans->TexCoords[1] = ((vertex[0]*TexMatrix[1] + vertex[1]*TexMatrix[5] + vertex[2]*TexMatrix[9]) >> 24) + RawTexCoords[1];
}
else
{
@@ -963,6 +964,8 @@ void SubmitVertex()
s32 CalculateLighting()
{
// TODO: this requires matrix mode 2, apparently
+ // hardware seems to read garbage when matrix mode isn't 2
+ // also, non-normal normals seem to be treated as zero? or overflow to negative?
if ((TexParam >> 30) == 2)
{