inputform ABC1's q value is defaulting to 0

This is causing the 0 divide case to run when source row is using tex0-7 and inputform is ABC1.
This commit is contained in:
Preston Smith 2016-03-29 05:49:15 -04:00
parent 767f56d7c8
commit 8f69de51ca
1 changed files with 12 additions and 10 deletions

View File

@ -106,24 +106,26 @@ void TransformNormal(const InputVertexData* src, bool nbt, OutputVertexData* dst
static void TransformTexCoordRegular(const TexMtxInfo& texinfo, int coordNum, bool specialCase,
const InputVertexData* srcVertex, OutputVertexData* dstVertex)
{
const Vec3* src;
Vec3 src;
switch (texinfo.sourcerow)
{
case XF_SRCGEOM_INROW:
src = &srcVertex->position;
src = srcVertex->position;
break;
case XF_SRCNORMAL_INROW:
src = &srcVertex->normal[0];
src = srcVertex->normal[0];
break;
case XF_SRCBINORMAL_T_INROW:
src = &srcVertex->normal[1];
src = srcVertex->normal[1];
break;
case XF_SRCBINORMAL_B_INROW:
src = &srcVertex->normal[2];
src = srcVertex->normal[2];
break;
default:
_assert_(texinfo.sourcerow >= XF_SRCTEX0_INROW && texinfo.sourcerow <= XF_SRCTEX7_INROW);
src = (Vec3*)srcVertex->texCoords[texinfo.sourcerow - XF_SRCTEX0_INROW];
src.x = srcVertex->texCoords[texinfo.sourcerow - XF_SRCTEX0_INROW][0];
src.y = srcVertex->texCoords[texinfo.sourcerow - XF_SRCTEX0_INROW][1];
src.z = 1.0f;
break;
}
@ -133,18 +135,18 @@ static void TransformTexCoordRegular(const TexMtxInfo& texinfo, int coordNum, bo
if (texinfo.projection == XF_TEXPROJ_ST)
{
if (texinfo.inputform == XF_TEXINPUT_AB11 || specialCase)
MultiplyVec2Mat24(*src, mat, *dst);
MultiplyVec2Mat24(src, mat, *dst);
else
MultiplyVec3Mat24(*src, mat, *dst);
MultiplyVec3Mat24(src, mat, *dst);
}
else // texinfo.projection == XF_TEXPROJ_STQ
{
_assert_(!specialCase);
if (texinfo.inputform == XF_TEXINPUT_AB11)
MultiplyVec2Mat34(*src, mat, *dst);
MultiplyVec2Mat34(src, mat, *dst);
else
MultiplyVec3Mat34(*src, mat, *dst);
MultiplyVec3Mat34(src, mat, *dst);
}
// normalize