diff options
| author | donkopunchstania <donkopunchstania@gmail.com> | 2010-12-01 04:26:21 +0000 |
|---|---|---|
| committer | donkopunchstania <donkopunchstania@gmail.com> | 2010-12-01 04:26:21 +0000 |
| commit | 1f660de7e53eb3675bc258dc57dfff99d779fc55 (patch) | |
| tree | f31378952893f088af43b544735514cde4defdef /Source/Plugins/Plugin_VideoSoftware/Src/TransformUnit.cpp | |
| parent | 0718e1bd772e641cfad180b42d800f5fb49b46d7 (diff) | |
Avoid repeatedly asserting in SWG plugin when matrix indices don't match. Small change to the transform unit to avoid some unnecessary work. Check if Q is zero before dividing UV coordinates by it. Fixes issue 3454.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6504 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Plugins/Plugin_VideoSoftware/Src/TransformUnit.cpp')
| -rw-r--r-- | Source/Plugins/Plugin_VideoSoftware/Src/TransformUnit.cpp | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/TransformUnit.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/TransformUnit.cpp index dcdf0daa1f..f17074d1c9 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/TransformUnit.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/TransformUnit.cpp @@ -35,6 +35,7 @@ void MultiplyVec2Mat24(const Vec3 &vec, const float *mat, Vec3 &result) { result.x = mat[0] * vec.x + mat[1] * vec.y + mat[2] + mat[3]; result.y = mat[4] * vec.x + mat[5] * vec.y + mat[6] + mat[7]; + result.z = 1.0f; } void MultiplyVec2Mat34(const Vec3 &vec, const float *mat, Vec3 &result) @@ -51,6 +52,13 @@ void MultiplyVec3Mat33(const Vec3 &vec, const float *mat, Vec3 &result) result.z = mat[6] * vec.x + mat[7] * vec.y + mat[8] * vec.z; } +void MultiplyVec3Mat24(const Vec3 &vec, const float *mat, Vec3 &result) +{ + result.x = mat[0] * vec.x + mat[1] * vec.y + mat[2] * vec.z + mat[3]; + result.y = mat[4] * vec.x + mat[5] * vec.y + mat[6] * vec.z + mat[7]; + result.z = 1.0f; +} + void MultiplyVec3Mat34(const Vec3 &vec, const float *mat, Vec3 &result) { result.x = mat[0] * vec.x + mat[1] * vec.y + mat[2] * vec.z + mat[3]; @@ -134,14 +142,22 @@ inline void TransformTexCoordRegular(const TexMtxInfo &texinfo, int coordNum, bo const float *mat = (const float*)&xfregs.posMatrices[srcVertex->texMtx[coordNum] * 4]; Vec3 *dst = &dstVertex->texCoords[coordNum]; - if (texinfo.inputform == XF_TEXINPUT_AB11) - { - MultiplyVec2Mat34(*src, mat, *dst); - } - else - { - MultiplyVec3Mat34(*src, mat, *dst); - } + if (texinfo.projection == XF_TEXPROJ_ST) + { + if (texinfo.inputform == XF_TEXINPUT_AB11 || specialCase) + MultiplyVec2Mat24(*src, mat, *dst); + else + MultiplyVec3Mat24(*src, mat, *dst); + } + else // texinfo.projection == XF_TEXPROJ_STQ + { + _assert_(!specialCase); + + if (texinfo.inputform == XF_TEXINPUT_AB11) + MultiplyVec2Mat34(*src, mat, *dst); + else + MultiplyVec3Mat34(*src, mat, *dst); + } if (xfregs.dualTexTrans) { |
