diff --git a/hecl/lib/Backend/GLSL.cpp b/hecl/lib/Backend/GLSL.cpp index f3d3e160b..813be06fd 100644 --- a/hecl/lib/Backend/GLSL.cpp +++ b/hecl/lib/Backend/GLSL.cpp @@ -155,8 +155,8 @@ std::string GLSL::makeVert(const char* glslVer, unsigned col, unsigned uv, unsig retval += hecl::Format(" vtf.tcgs[%u] = %s;\n", tcgIdx, EmitTexGenSource2(tcg.m_src, tcg.m_uvIdx).c_str()); else - retval += hecl::Format(" vtf.tcgs[%u] = normalize((texMtxs[%u].postMtx * (texMtxs[%u].mtx * %s)).xy);\n", tcgIdx, tcg.m_mtx, - tcg.m_mtx, EmitTexGenSource4(tcg.m_src, tcg.m_uvIdx).c_str()); + retval += hecl::Format(" vtf.tcgs[%u] = (texMtxs[%u].postMtx * %s(texMtxs[%u].mtx * %s)).xy;\n", tcgIdx, tcg.m_mtx, + tcg.m_norm ? "normalize" : "", tcg.m_mtx, EmitTexGenSource4(tcg.m_src, tcg.m_uvIdx).c_str()); ++tcgIdx; } diff --git a/hecl/lib/Backend/HLSL.cpp b/hecl/lib/Backend/HLSL.cpp index af7aae4a6..323d7f219 100644 --- a/hecl/lib/Backend/HLSL.cpp +++ b/hecl/lib/Backend/HLSL.cpp @@ -138,8 +138,8 @@ std::string HLSL::makeVert(unsigned col, unsigned uv, unsigned w, retval += hecl::Format(" vtf.tcgs[%u] = %s;\n", tcgIdx, EmitTexGenSource2(tcg.m_src, tcg.m_uvIdx).c_str()); else - retval += hecl::Format(" vtf.tcgs[%u] = mul(postMtxs[%u], mul(texMtxs[%u], %s)).xy;\n", tcgIdx, tcg.m_mtx, - tcg.m_mtx, EmitTexGenSource4(tcg.m_src, tcg.m_uvIdx).c_str()); + retval += hecl::Format(" vtf.tcgs[%u] = mul(texMtxs[%u].postMtx, %s(mul(texMtxs[%u].mtx, %s))).xy;\n", tcgIdx, tcg.m_mtx, + tcg.m_norm ? "normalize" : "", tcg.m_mtx, EmitTexGenSource4(tcg.m_src, tcg.m_uvIdx).c_str()); ++tcgIdx; } diff --git a/hecl/lib/Backend/Metal.cpp b/hecl/lib/Backend/Metal.cpp index 62dd43955..6447f107c 100644 --- a/hecl/lib/Backend/Metal.cpp +++ b/hecl/lib/Backend/Metal.cpp @@ -154,8 +154,8 @@ std::string Metal::makeVert(unsigned col, unsigned uv, unsigned w, retval += hecl::Format(" vtf.tcgs%u = %s;\n", tcgIdx, EmitTexGenSource2(tcg.m_src, tcg.m_uvIdx).c_str()); else - retval += hecl::Format(" vtf.tcgs%u = (texMtxs[%u] * %s).xy;\n", tcgIdx, tcg.m_mtx, - EmitTexGenSource4(tcg.m_src, tcg.m_uvIdx).c_str()); + retval += hecl::Format(" vtf.tcgs[%u] = (texMtxs[%u].postMtx * %s(texMtxs[%u].mtx * %s)).xy;\n", tcgIdx, tcg.m_mtx, + tcg.m_norm ? "normalize" : "", tcg.m_mtx, EmitTexGenSource4(tcg.m_src, tcg.m_uvIdx).c_str()); ++tcgIdx; }