cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=bfe8b7c05ec7f6aea6da8ab22acd865ce43df208

commit bfe8b7c05ec7f6aea6da8ab22acd865ce43df208
Author: Oleksandr Shcherbina <o.shcherb...@samsung.com>
Date:   Wed May 13 16:12:59 2015 +0200

    evas: correct normal map shader.
    
    Summary:
    Due to using Evas_GL_Image for generation texture unit for Evas_3D_Texture 
it is
    need adjusting texture coordinates in shader
    It has been missed here
    
https://git.enlightenment.org/core/efl.git/commit/?id=d88ccf06a5f6ebcfc68dcc21e55a241f64ff9aa9
    
    Reviewers: Hermet, cedric
    
    Subscribers: cedric
    
    Differential Revision: https://phab.enlightenment.org/D2474
    
    Signed-off-by: Cedric BAIL <ced...@osg.samsung.com>
---
 .../engines/gl_common/shader_3d/evas_gl_3d_shaders.x | 20 ++++++++++++++------
 .../engines/gl_common/shader_3d/normal_map_frag.shd  | 13 ++++---------
 2 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/src/modules/evas/engines/gl_common/shader_3d/evas_gl_3d_shaders.x 
b/src/modules/evas/engines/gl_common/shader_3d/evas_gl_3d_shaders.x
index 88a794a..7685aa8 100644
--- a/src/modules/evas/engines/gl_common/shader_3d/evas_gl_3d_shaders.x
+++ b/src/modules/evas/engines/gl_common/shader_3d/evas_gl_3d_shaders.x
@@ -938,7 +938,6 @@ static const char normal_map_frag_glsl[] =
    "#endif\n"
    "varying  vec3        vLightVector;\n"
    "varying  vec3        vLightHalfVector;\n"
-   "uniform  sampler2D   uTextureNormal0;\n"
    "varying  vec3        vEyeVector;\n"
    "#ifdef NEED_TEX_COORD\n"
    "varying vec2   vTexCoord;\n"
@@ -962,9 +961,18 @@ static const char normal_map_frag_glsl[] =
    "     return shadow / 64.0;\n"
    "}\n"
    "#endif //SHADOWED\n"
+   "#ifdef NORMAL_TEXTURE\n"
+   "uniform sampler2D  uTextureNormal0;\n"
+   "uniform mat3 uTextureMatrixTransformNormal0;\n"
+   "vec3 Tex0CoordNormal = \n"
+   "   vec3(vTexCoord, 1.0) * uTextureMatrixTransformNormal0;\n"
+   "#endif //NORMAL_TEXTURE\n"
    "#ifdef NORMAL_TEXTURE_BLEND\n"
-   "uniform  sampler2D  uTextureNormal1;\n"
-   "uniform  float      uTextureNormalWeight;\n"
+   "uniform sampler2D  uTextureNormal1;\n"
+   "uniform float      uTextureNormalWeight;\n"
+   "uniform mat3 uTextureMatrixTransformNormal1;\n"
+   "vec3 Tex1CoordNormal = \n"
+   "   vec3(vTexCoord, 1.0) * uTextureMatrixTransformNormal1;\n"
    "#endif //NORMAL_TEXTURE_BLEND\n"
    "#ifndef VERTEX_TANGENT\n"
    "varying  vec3        vNormal;\n"
@@ -1071,11 +1079,11 @@ static const char normal_map_frag_glsl[] =
    "   vec3  normal;\n"
    "   vec4  color;\n"
    "#ifdef NORMAL_TEXTURE_BLEND\n"
-   "   normal = texture2D(uTextureNormal0, vTexCoord).rgb * 
uTextureNormalWeight / texture2D(uTextureNormal0, vTexCoord).a;\n"
-   "   normal += texture2D(uTextureNormal1, vTexCoord).rgb / 
texture2D(uTextureNormal1, vTexCoord).a *\n"
+   "   normal = texture2D(uTextureNormal0, vec2(Tex0CoordNormal)).rgb * 
uTextureNormalWeight / texture2D(uTextureNormal0, vec2(Tex0CoordNormal)).a;\n"
+   "   normal += texture2D(uTextureNormal1, vec2(Tex1CoordNormal)).rgb / 
texture2D(uTextureNormal1, vec2(Tex1CoordNormal)).a *\n"
    "   (1.0 - uTextureNormalWeight);\n"
    "#else\n"
-   "   normal = texture2D(uTextureNormal0, vTexCoord).rgb / 
texture2D(uTextureNormal0, vTexCoord).a;\n"
+   "   normal = texture2D(uTextureNormal0, vec2(Tex0CoordNormal)).rgb / 
texture2D(uTextureNormal0, vec2(Tex0CoordNormal)).a;\n"
    "#endif //NORMAL_TEXTURE_BLEND\n"
    "   normal = 2.0 * normal - 1.0;\n"
    "#ifndef VERTEX_TANGENT\n"
diff --git a/src/modules/evas/engines/gl_common/shader_3d/normal_map_frag.shd 
b/src/modules/evas/engines/gl_common/shader_3d/normal_map_frag.shd
index 10b51e4..533518b 100644
--- a/src/modules/evas/engines/gl_common/shader_3d/normal_map_frag.shd
+++ b/src/modules/evas/engines/gl_common/shader_3d/normal_map_frag.shd
@@ -1,16 +1,11 @@
 varying  vec3        vLightVector;
 varying  vec3        vLightHalfVector;
-uniform  sampler2D   uTextureNormal0;
 varying  vec3        vEyeVector;
 
 FRAGMENT_SHADER_USE_TEX_COORD
 FRAGMENT_SHADER_USE_FOG
 FRAGMENT_SHADER_USE_SHADOWS
-
-#ifdef NORMAL_TEXTURE_BLEND
-uniform  sampler2D  uTextureNormal1;
-uniform  float      uTextureNormalWeight;
-#endif //NORMAL_TEXTURE_BLEND
+FRAGMENT_SHADER_USE_TEXTURE(NORMAL, Normal)
 
 #ifndef VERTEX_TANGENT
 varying  vec3        vNormal;
@@ -52,11 +47,11 @@ void fragmentNormalMap()
    vec4  color;
 
 #ifdef NORMAL_TEXTURE_BLEND
-   normal = texture2D(uTextureNormal0, vTexCoord).rgb * uTextureNormalWeight / 
texture2D(uTextureNormal0, vTexCoord).a;
-   normal += texture2D(uTextureNormal1, vTexCoord).rgb / 
texture2D(uTextureNormal1, vTexCoord).a *
+   normal = texture2D(uTextureNormal0, vec2(Tex0CoordNormal)).rgb * 
uTextureNormalWeight / texture2D(uTextureNormal0, vec2(Tex0CoordNormal)).a;
+   normal += texture2D(uTextureNormal1, vec2(Tex1CoordNormal)).rgb / 
texture2D(uTextureNormal1, vec2(Tex1CoordNormal)).a *
    (1.0 - uTextureNormalWeight);
 #else
-   normal = texture2D(uTextureNormal0, vTexCoord).rgb / 
texture2D(uTextureNormal0, vTexCoord).a;
+   normal = texture2D(uTextureNormal0, vec2(Tex0CoordNormal)).rgb / 
texture2D(uTextureNormal0, vec2(Tex0CoordNormal)).a;
 #endif //NORMAL_TEXTURE_BLEND
 
    normal = 2.0 * normal - 1.0;

-- 


Reply via email to