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 <cedric@osg.samsung.com>
This commit is contained in:
Oleksandr Shcherbina 2015-05-13 16:12:59 +02:00 committed by Cedric BAIL
parent 835c393d17
commit bfe8b7c05e
2 changed files with 18 additions and 15 deletions

View File

@ -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"

View File

@ -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;