Chests on LoZ:WW are now texture mapped correctly (as should many other weirdnesses) in DX9.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@775 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
XTra.KrazzY 2008-10-04 22:47:28 +00:00
parent d4dafd1d5b
commit c69506bb46
2 changed files with 11 additions and 16 deletions

View File

@ -307,11 +307,9 @@ void CTransformEngine::TransformVertices(int _numVertices, const DecodedVArray *
Vec3 TempUVs[8]; Vec3 TempUVs[8];
for (int j = 0; j < xfregs.numTexGens; j++) for (int j = 0; j < xfregs.numTexGens; j++)
{ {
int n = bpmem.tevorders[j / 2].getTexCoord(j & 1); // <- yazor: dirty zelda patch ^^
n = j;
Vec3 t; Vec3 t;
switch (xfregs.texcoords[n].texmtxinfo.sourcerow) { switch (xfregs.texcoords[j].texmtxinfo.sourcerow) {
case XF_SRCGEOM_INROW: t = OrigPos; break; //HACK WTFF??? case XF_SRCGEOM_INROW: t = OrigPos; break; //HACK WTFF???
case XF_SRCNORMAL_INROW: t = OrigNormal; break; case XF_SRCNORMAL_INROW: t = OrigNormal; break;
case XF_SRCCOLORS_INROW: break; //set uvs to something? case XF_SRCCOLORS_INROW: break; //set uvs to something?
@ -319,7 +317,7 @@ void CTransformEngine::TransformVertices(int _numVertices, const DecodedVArray *
case XF_SRCBINORMAL_B_INROW: t=Vec3(0,0,0);break; case XF_SRCBINORMAL_B_INROW: t=Vec3(0,0,0);break;
default: default:
{ {
int c = xfregs.texcoords[n].texmtxinfo.sourcerow - XF_SRCTEX0_INROW; int c = xfregs.texcoords[j].texmtxinfo.sourcerow - XF_SRCTEX0_INROW;
bool hasTCC = (components & (VertexLoader::VB_HAS_UV0 << c)) != 0; bool hasTCC = (components & (VertexLoader::VB_HAS_UV0 << c)) != 0;
if (c >= 0 && c <= 7 && hasTCC) if (c >= 0 && c <= 7 && hasTCC)
{ {
@ -330,7 +328,7 @@ void CTransformEngine::TransformVertices(int _numVertices, const DecodedVArray *
} }
Vec3 out,out2; Vec3 out,out2;
switch (xfregs.texcoords[n].texmtxinfo.texgentype) switch (xfregs.texcoords[j].texmtxinfo.texgentype)
{ {
case XF_TEXGEN_COLOR_STRGBC0: case XF_TEXGEN_COLOR_STRGBC0:
out = Vec3(chans[0].r*255, chans[0].g*255, 1)/255.0f; out = Vec3(chans[0].r*255, chans[0].g*255, 1)/255.0f;
@ -339,17 +337,17 @@ void CTransformEngine::TransformVertices(int _numVertices, const DecodedVArray *
out = Vec3(chans[1].r*255, chans[1].g*255, 1)/255.0f; //FIX: take color1 instead out = Vec3(chans[1].r*255, chans[1].g*255, 1)/255.0f; //FIX: take color1 instead
break; break;
case XF_TEXGEN_REGULAR: case XF_TEXGEN_REGULAR:
if (xfregs.texcoords[n].texmtxinfo.projection) if (xfregs.texcoords[j].texmtxinfo.projection)
VtxMulMtx43(out, t, m_pTexMatrix[n]); VtxMulMtx43(out, t, m_pTexMatrix[j]);
else else
VtxMulMtx42(out, t, m_pTexMatrix[n]); VtxMulMtx42(out, t, m_pTexMatrix[j]);
break; break;
} }
if (xfregs.texcoords[n].postmtxinfo.normalize) if (xfregs.texcoords[j].postmtxinfo.normalize)
out.normalize(); out.normalize();
int postMatrix = xfregs.texcoords[n].postmtxinfo.index; int postMatrix = xfregs.texcoords[j].postmtxinfo.index;
float *pmtx = ((float*)xfmem) + 0x500 + postMatrix * 4; //CHECK float *pmtx = ((float*)xfmem) + 0x500 + postMatrix * 4; //CHECK
//multiply with postmatrix //multiply with postmatrix
VtxMulMtx43(TempUVs[j], out, pmtx); VtxMulMtx43(TempUVs[j], out, pmtx);

View File

@ -15,6 +15,7 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "stdafx.h" #include "stdafx.h"
#include "D3DShader.h" #include "D3DShader.h"
#include "VertexShader.h" #include "VertexShader.h"
@ -44,11 +45,8 @@ VS_OUTPUT output;\n\
\n\ \n\
output.pos = mul(matWorldViewProj, input.pos);\n\ output.pos = mul(matWorldViewProj, input.pos);\n\
// texgen\n\ // texgen\n\
output.uv[0] = float4(input.uv[0].xy,0,input.uv[0].z);\n\ for (int i=0; i<5; i++)\n\
output.uv[1] = float4(input.uv[1].xy,0,input.uv[1].z);\n\ output.uv[i] = float4(input.uv[i].xyz,1);\n\
output.uv[2] = float4(input.uv[2].xy,0,input.uv[2].z);\n\
output.uv[3] = float4(input.uv[3].xy,0,input.uv[3].z);\n\
output.uv[4] = float4(input.uv[4].xy,0,input.uv[4].z);\n\
\n\ \n\
for (int i=0; i<2; i++)\n output.colors[i] = input.colors[i];\n\ for (int i=0; i<2; i++)\n output.colors[i] = input.colors[i];\n\
return output;\n\ return output;\n\
@ -57,7 +55,6 @@ return output;\n\
const char *GenerateVertexShader() { const char *GenerateVertexShader() {
return genericVS; return genericVS;
} }
/* /*
char text2[65536]; char text2[65536];