From 0decdce86dea30af10e9e6081ee4a40326d4ebce Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Mon, 18 Jul 2016 20:12:00 -1000 Subject: [PATCH] Update shaders for normalize TCG flag --- hecl/lib/Backend/GLSL.cpp | 4 ++-- hecl/lib/Backend/HLSL.cpp | 4 ++-- hecl/lib/Backend/Metal.cpp | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) 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; }