mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-16 12:58:33 +02:00
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
This commit is contained in:
@ -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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user