From eb6ee6c6767b516ae483acb5c0e318a1b13fa672 Mon Sep 17 00:00:00 2001 From: Kearwood Gilbert Date: Sat, 7 Sep 2013 16:57:18 -0700 Subject: [PATCH] Fixed shader compile error that occurred when using Reflection Map scale or offset attributes in a material. Fixed bug that caused the Reflection Map scale to be swapped with the Normal Map scale material parameter. Fixed bug that caused the Reflection Map offset to be swapped with the Normal Map offset material parameter. --HG-- branch : nfb --- KREngine/kraken/KRMaterial.cpp | 2 +- KREngine/kraken_standard_assets_ios/Shaders/ObjectShader.vsh | 4 ++-- .../kraken_standard_assets_osx/Shaders/ObjectShader_osx.vsh | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/KREngine/kraken/KRMaterial.cpp b/KREngine/kraken/KRMaterial.cpp index 95e836e..3a29612 100644 --- a/KREngine/kraken/KRMaterial.cpp +++ b/KREngine/kraken/KRMaterial.cpp @@ -252,7 +252,7 @@ bool KRMaterial::bind(KRCamera *pCamera, std::vector &point_ligh bool bAlphaBlend = (m_alpha_mode == KRMATERIAL_ALPHA_MODE_BLENDONESIDE) || (m_alpha_mode == KRMATERIAL_ALPHA_MODE_BLENDTWOSIDE); - KRShader *pShader = getContext().getShaderManager()->getShader("ObjectShader", pCamera, point_lights, directional_lights, spot_lights, bones.size(), bDiffuseMap, bNormalMap, bSpecMap, bReflectionMap, bReflectionCubeMap, bLightMap, m_diffuseMapScale != default_scale && bDiffuseMap, m_specularMapScale != default_scale && bSpecMap, m_reflectionMapScale != default_scale && bReflectionMap, m_normalMapScale != default_scale && bNormalMap, m_diffuseMapOffset != default_offset && bDiffuseMap, m_specularMapOffset != default_offset && bSpecMap, m_reflectionMapOffset != default_offset && bReflectionMap, m_normalMapOffset != default_offset && bNormalMap, bAlphaTest, bAlphaBlend, renderPass); + KRShader *pShader = getContext().getShaderManager()->getShader("ObjectShader", pCamera, point_lights, directional_lights, spot_lights, bones.size(), bDiffuseMap, bNormalMap, bSpecMap, bReflectionMap, bReflectionCubeMap, bLightMap, m_diffuseMapScale != default_scale && bDiffuseMap, m_specularMapScale != default_scale && bSpecMap, m_normalMapScale != default_scale && bNormalMap, m_reflectionMapScale != default_scale && bReflectionMap, m_diffuseMapOffset != default_offset && bDiffuseMap, m_specularMapOffset != default_offset && bSpecMap, m_normalMapOffset != default_offset && bNormalMap, m_reflectionMapOffset != default_offset && bReflectionMap, bAlphaTest, bAlphaBlend, renderPass); if(!getContext().getShaderManager()->selectShader(*pCamera, pShader, viewport, matModel, point_lights, directional_lights, spot_lights, 0, renderPass)) { return false; diff --git a/KREngine/kraken_standard_assets_ios/Shaders/ObjectShader.vsh b/KREngine/kraken_standard_assets_ios/Shaders/ObjectShader.vsh index 353f5b2..6d2b3fe 100644 --- a/KREngine/kraken_standard_assets_ios/Shaders/ObjectShader.vsh +++ b/KREngine/kraken_standard_assets_ios/Shaders/ObjectShader.vsh @@ -111,11 +111,11 @@ uniform highp mat4 mvp_matrix; // mvp_matrix is the result of multiplying t #endif #if HAS_REFLECTION_MAP_SCALE == 1 - uniform highp vec2 reflection_Scale; + uniform highp vec2 reflectionTexture_Scale; #endif #if HAS_REFLECTION_MAP_OFFSET == 1 - uniform highp vec2 reflection_Offset; + uniform highp vec2 reflectionTexture_Offset; #endif #if SHADOW_QUALITY >= 1 diff --git a/KREngine/kraken_standard_assets_osx/Shaders/ObjectShader_osx.vsh b/KREngine/kraken_standard_assets_osx/Shaders/ObjectShader_osx.vsh index fd08cb2..4aaad3b 100644 --- a/KREngine/kraken_standard_assets_osx/Shaders/ObjectShader_osx.vsh +++ b/KREngine/kraken_standard_assets_osx/Shaders/ObjectShader_osx.vsh @@ -107,11 +107,11 @@ uniform highp mat4 mvp_matrix; // mvp_matrix is the result of multiplying t #endif #if HAS_REFLECTION_MAP_SCALE == 1 - uniform highp vec2 reflection_Scale; + uniform highp vec2 reflectionTexture_Scale; #endif #if HAS_REFLECTION_MAP_OFFSET == 1 - uniform highp vec2 reflection_Offset; + uniform highp vec2 reflectionTexture_Offset; #endif #if SHADOW_QUALITY >= 1