From ea5375f4a23652594fe07ddbb0bbbe67926f94a6 Mon Sep 17 00:00:00 2001 From: Dmytro Dadyka Date: Wed, 25 Mar 2015 10:37:16 -0700 Subject: [PATCH] [Evas: Evas_3D] Refactor shader system: refactored shadow map shade mode. Reviewers: cedric, jpeg Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D2240 --- .../gl_common/shader_3d/evas_gl_3d_shaders.x | 6 +-- .../gl_common/shader_3d/shadow_map_frag.shd | 5 +-- .../gl_common/shader_3d/shadow_map_vert.shd | 50 +++------------------- 3 files changed, 9 insertions(+), 52 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 d96ce65..f5b42e0 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 @@ -1141,8 +1141,8 @@ static const char const shadow_map_vert_glsl[] = "uniform float uTexCoordWeight;\n" "#endif //VERTEX_TEXCOORD_BLEND\n" "#ifdef NEED_TEX_COORD\n" - "varying vec2 vTexCoord;\n" - "#endif //TEX_COORD\n" + "varying vec2 vTexCoord;\n" + "#endif //NEED_TEX_COORD\n" "#endif //ALPHA_TEST_ENABLED\n" "void main()\n" "{\n" @@ -1156,7 +1156,7 @@ static const char const shadow_map_vert_glsl[] = "#endif // VERTEX_POSITION\n" "#endif //VERTEX_POSITION_BLEND\n" "#ifdef ALPHA_TEST_ENABLED\n" - "#ifdef VERTEX_TEXCOORD_BLEND\n" + " #ifdef VERTEX_TEXCOORD_BLEND\n" " vTexCoord = aTexCoord0.st * uTexCoordWeight +\n" " aTexCoord1.st * (1.0 - uTexCoordWeight);\n" "#else\n" diff --git a/src/modules/evas/engines/gl_common/shader_3d/shadow_map_frag.shd b/src/modules/evas/engines/gl_common/shader_3d/shadow_map_frag.shd index 6bfbcc7..66a88ad 100644 --- a/src/modules/evas/engines/gl_common/shader_3d/shadow_map_frag.shd +++ b/src/modules/evas/engines/gl_common/shader_3d/shadow_map_frag.shd @@ -1,8 +1,5 @@ #ifdef ALPHA_TEST_ENABLED - -#ifdef NEED_TEX_COORD -varying vec2 vTexCoord; -#endif //TEX_COORD +FRAGMENT_SHADER_USE_TEX_COORD #ifdef DIFFUSE diff --git a/src/modules/evas/engines/gl_common/shader_3d/shadow_map_vert.shd b/src/modules/evas/engines/gl_common/shader_3d/shadow_map_vert.shd index be92999..095fc9c 100644 --- a/src/modules/evas/engines/gl_common/shader_3d/shadow_map_vert.shd +++ b/src/modules/evas/engines/gl_common/shader_3d/shadow_map_vert.shd @@ -1,59 +1,19 @@ uniform mat4 uMatrixMvp; -#ifdef VERTEX_POSITION -attribute vec4 aPosition0; -#endif //VERTEX_POSITION - -#ifdef VERTEX_POSITION_BLEND -attribute vec4 aPosition1; -uniform float uPositionWeight; -#endif //VERTEX_POSITION_BLEND +VERTEX_SHADER_USE_POSITION #ifdef ALPHA_TEST_ENABLED - -#ifdef VERTEX_TEXCOORD -attribute vec4 aTexCoord0; -#endif //VERTEX_TEXCOORD - -#ifdef VERTEX_TEXCOORD_BLEND -attribute vec4 aTexCoord1; -uniform float uTexCoordWeight; -#endif //VERTEX_TEXCOORD_BLEND - -#ifdef NEED_TEX_COORD -varying vec2 vTexCoord; -#endif //TEX_COORD - +VERTEX_SHADER_USE_TEXCOORD +VERTEX_SHADER_NEED_TEX_COORD #endif //ALPHA_TEST_ENABLED void main() { -#ifdef VERTEX_POSITION_BLEND - vec4 position = aPosition0 * uPositionWeight + - aPosition1 * (1.0 - uPositionWeight); - position = vec4(position.xyz, 1.0); -#else - -#ifdef VERTEX_POSITION - vec4 position = vec4(aPosition0.xyz, 1.0); -#endif // VERTEX_POSITION - -#endif //VERTEX_POSITION_BLEND +VERTEX_SHADER_POSITION #ifdef ALPHA_TEST_ENABLED - -#ifdef VERTEX_TEXCOORD_BLEND - vTexCoord = aTexCoord0.st * uTexCoordWeight + - aTexCoord1.st * (1.0 - uTexCoordWeight); -#else - -#ifdef VERTEX_TEXCOORD - vTexCoord = aTexCoord0.st; -#endif //VERTEX_TEXCOORD - -#endif //VERTEX_TEXCOORD_BLEND - + VERTEX_SHADER_TEXCOORD #endif //ALPHA_TEST_ENABLED gl_Position = uMatrixMvp * position; -- 2.7.4