From 03cb7cf237db176f5489a2f38a5f5a8bb669ac0b Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Wed, 6 Jun 2018 18:36:46 -1000 Subject: [PATCH] Ensure lighting extension is passed vec3 --- hecl/extern/boo | 2 +- hecl/lib/Backend/GLSL.cpp | 4 ++-- hecl/lib/Backend/HLSL.cpp | 4 ++-- hecl/lib/Backend/Metal.cpp | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/hecl/extern/boo b/hecl/extern/boo index 82966931f..4a19ac1e8 160000 --- a/hecl/extern/boo +++ b/hecl/extern/boo @@ -1 +1 @@ -Subproject commit 82966931f86d3d52732b21962a44a42cb6b14730 +Subproject commit 4a19ac1e8352740db781012b523fefe1132672f3 diff --git a/hecl/lib/Backend/GLSL.cpp b/hecl/lib/Backend/GLSL.cpp index e43bbe964..080bc8f05 100644 --- a/hecl/lib/Backend/GLSL.cpp +++ b/hecl/lib/Backend/GLSL.cpp @@ -262,7 +262,7 @@ std::string GLSL::makeFrag(const char* glslVer, bool alphaTest, if (m_lighting) { if (lighting.m_entry) - retval += hecl::Format(" vec4 lighting = %s(vtf.mvPos, vtf.mvNorm);\n", lighting.m_entry); + retval += hecl::Format(" vec4 lighting = %s(vtf.mvPos.xyz, normalize(vtf.mvNorm.xyz));\n", lighting.m_entry); else retval += " vec4 lighting = vec4(1.0,1.0,1.0,1.0);\n"; } @@ -341,7 +341,7 @@ std::string GLSL::makeFrag(const char* glslVer, bool alphaTest, if (m_lighting) { if (lighting.m_entry) - retval += hecl::Format(" vec4 lighting = %s(vtf.mvPos, vtf.mvNorm);\n", lighting.m_entry); + retval += hecl::Format(" vec4 lighting = %s(vtf.mvPos.xyz, normalize(vtf.mvNorm.xyz));\n", lighting.m_entry); else retval += " vec4 lighting = vec4(1.0,1.0,1.0,1.0);\n"; } diff --git a/hecl/lib/Backend/HLSL.cpp b/hecl/lib/Backend/HLSL.cpp index e6f1c6958..5c28d4c90 100644 --- a/hecl/lib/Backend/HLSL.cpp +++ b/hecl/lib/Backend/HLSL.cpp @@ -249,7 +249,7 @@ std::string HLSL::makeFrag(bool alphaTest, ReflectionType reflectionType, if (m_lighting) { if (lighting.m_entry) - retval += hecl::Format(" float4 lighting = %s(vtf.mvPos, vtf.mvNorm, vtf);\n", lighting.m_entry); + retval += hecl::Format(" float4 lighting = %s(vtf.mvPos.xyz, normalize(vtf.mvNorm.xyz), vtf);\n", lighting.m_entry); else retval += " float4 lighting = float4(1.0,1.0,1.0,1.0);\n"; } @@ -324,7 +324,7 @@ std::string HLSL::makeFrag(bool alphaTest, ReflectionType reflectionType, if (m_lighting) { if (lighting.m_entry) - retval += hecl::Format(" float4 lighting = %s(vtf.mvPos, vtf.mvNorm, vtf);\n", lighting.m_entry); + retval += hecl::Format(" float4 lighting = %s(vtf.mvPos.xyz, normalize(vtf.mvNorm.xyz), vtf);\n", lighting.m_entry); else retval += " float4 lighting = float4(1.0,1.0,1.0,1.0);\n"; } diff --git a/hecl/lib/Backend/Metal.cpp b/hecl/lib/Backend/Metal.cpp index 03bf40aa2..5f8540e20 100644 --- a/hecl/lib/Backend/Metal.cpp +++ b/hecl/lib/Backend/Metal.cpp @@ -277,7 +277,7 @@ std::string Metal::makeFrag(size_t blockCount, const char** blockNames, bool alp if (m_lighting) { if (lighting.m_entry) - retval += hecl::Format(" float4 lighting = %s(%s, vtf.mvPos, vtf.mvNorm, vtf);\n", lighting.m_entry, blockCall.c_str()); + retval += hecl::Format(" float4 lighting = %s(%s, vtf.mvPos.xyz, normalize(vtf.mvNorm.xyz), vtf);\n", lighting.m_entry, blockCall.c_str()); else retval += " float4 lighting = float4(1.0,1.0,1.0,1.0);\n"; }