summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorOleksandr Shcherbina <o.shcherbina@samsung.com>2015-10-01 19:08:14 +0900
committerChunEon Park <hermet@hermet.pe.kr>2015-10-01 19:08:14 +0900
commitfe92fac05f0306bea83a6c113daea35acde80398 (patch)
tree51ca48edc9db1950975efdc91a0afadd372ff84d /src
parent7c8ca6b752b3f584b84aac78d8ee28bf6a6f562a (diff)
evas_canvas3d: Unification algorithm generation shadow
Summary: Change type of texdepth from GL_R(doesn't support with GLES) to GL_RGBA. Don't use useless additional framebuffers for shadows. Use same shader code for generation shadow map texture. Turn always using software alpha-test. It reduce and simplify code in general. Reviewers: cedric, Hermet Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D3115
Diffstat (limited to 'src')
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_3d.c38
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_3d_private.h6
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_3d_shader.c6
-rw-r--r--src/modules/evas/engines/gl_common/shader_3d/evas_gl_3d_shaders.x100
-rw-r--r--src/modules/evas/engines/gl_common/shader_3d/include.shd21
-rw-r--r--src/modules/evas/engines/gl_common/shader_3d/shadow_map_frag.shd5
6 files changed, 16 insertions, 160 deletions
diff --git a/src/modules/evas/engines/gl_common/evas_gl_3d.c b/src/modules/evas/engines/gl_common/evas_gl_3d.c
index 69c9c54f9f..68fc15fa1b 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_3d.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_3d.c
@@ -276,9 +276,6 @@ e3d_drawable_new(int w, int h, int alpha, GLenum depth_format, GLenum stencil_fo
276 GLuint depth_stencil_buf = 0; 276 GLuint depth_stencil_buf = 0;
277 GLuint depth_buf = 0; 277 GLuint depth_buf = 0;
278 GLuint stencil_buf = 0; 278 GLuint stencil_buf = 0;
279#ifdef GL_GLES
280 GLuint shadow_fbo, depth_render_buf;
281#endif
282 Eina_Bool depth_stencil = EINA_FALSE; 279 Eina_Bool depth_stencil = EINA_FALSE;
283 280
284 glGenTextures(1, &tex); 281 glGenTextures(1, &tex);
@@ -299,13 +296,7 @@ e3d_drawable_new(int w, int h, int alpha, GLenum depth_format, GLenum stencil_fo
299 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); 296 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
300 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 297 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
301 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 298 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
302#ifndef GL_GLES
303 glTexImage2D(GL_TEXTURE_2D, 0, GL_R16, w, h, 0, GL_RED, GL_UNSIGNED_SHORT, 0);
304#else
305 glGenFramebuffers(1, &shadow_fbo);
306 glGenFramebuffers(1, &depth_render_buf);
307 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); 299 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
308#endif
309 300
310 glGenFramebuffers(1, &color_pick_fb_id); 301 glGenFramebuffers(1, &color_pick_fb_id);
311 glGenTextures(1, &texcolorpick); 302 glGenTextures(1, &texcolorpick);
@@ -401,10 +392,7 @@ e3d_drawable_new(int w, int h, int alpha, GLenum depth_format, GLenum stencil_fo
401 drawable->depth_buf = depth_buf; 392 drawable->depth_buf = depth_buf;
402 drawable->stencil_buf = stencil_buf; 393 drawable->stencil_buf = stencil_buf;
403 drawable->texDepth = texDepth; 394 drawable->texDepth = texDepth;
404#ifdef GL_GLES 395
405 drawable->shadow_fbo = shadow_fbo;
406 drawable->depth_render_buf = depth_render_buf;
407#endif
408 return drawable; 396 return drawable;
409 397
410error: 398error:
@@ -437,12 +425,6 @@ error:
437 if (stencil_buf) 425 if (stencil_buf)
438 glDeleteRenderbuffers(1, &stencil_buf); 426 glDeleteRenderbuffers(1, &stencil_buf);
439 427
440#ifdef GL_GLES
441 if (shadow_fbo)
442 glDeleteFramebuffers(1, &shadow_fbo);
443 if (depth_render_buf)
444 glDeleteFramebuffers(1, &depth_render_buf);
445#endif
446 428
447 return NULL; 429 return NULL;
448} 430}
@@ -1009,9 +991,7 @@ _mesh_draw_data_build(E3D_Draw_Data *data,
1009 data->flags |= E3D_SHADER_FLAG_SHADOWED; 991 data->flags |= E3D_SHADER_FLAG_SHADOWED;
1010 data->pcf_size = 1 / pdmesh->shadows_edges_size; 992 data->pcf_size = 1 / pdmesh->shadows_edges_size;
1011 data->pcf_step = (Evas_Real)pdmesh->shadows_edges_filtering_level; 993 data->pcf_step = (Evas_Real)pdmesh->shadows_edges_filtering_level;
1012#ifdef GL_GLES
1013 data->constant_bias = pdmesh->shadows_constant_bias; 994 data->constant_bias = pdmesh->shadows_constant_bias;
1014#endif
1015 } 995 }
1016 996
1017 if (pdmesh->color_pick_enabled) 997 if (pdmesh->color_pick_enabled)
@@ -1186,18 +1166,10 @@ void _shadowmap_render(E3D_Drawable *drawable, E3D_Renderer *renderer,
1186 1166
1187 glEnable(GL_POLYGON_OFFSET_FILL); 1167 glEnable(GL_POLYGON_OFFSET_FILL);
1188 glPolygonOffset(data->depth_offset, data->depth_constant); 1168 glPolygonOffset(data->depth_offset, data->depth_constant);
1189#ifdef GL_GLES 1169
1190 glBindFramebuffer(GL_FRAMEBUFFER, drawable->shadow_fbo);
1191 glBindRenderbuffer(GL_RENDERBUFFER, drawable->depth_render_buf);
1192#endif
1193 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 1170 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
1194 drawable->texDepth, 0); 1171 drawable->texDepth, 0);
1195#ifdef GL_GLES 1172
1196 glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, drawable->w,
1197 drawable->h);
1198 glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER,
1199 drawable->depth_render_buf);
1200#endif
1201 e3d_renderer_target_set(renderer, drawable); 1173 e3d_renderer_target_set(renderer, drawable);
1202 e3d_renderer_clear(renderer, &c); 1174 e3d_renderer_clear(renderer, &c);
1203 1175
@@ -1231,9 +1203,7 @@ void _shadowmap_render(E3D_Drawable *drawable, E3D_Renderer *renderer,
1231 } 1203 }
1232 1204
1233 glDisable(GL_POLYGON_OFFSET_FILL); 1205 glDisable(GL_POLYGON_OFFSET_FILL);
1234#ifdef GL_GLES 1206
1235 glBindFramebuffer(GL_FRAMEBUFFER, drawable->fbo);
1236#endif
1237 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, drawable->tex, 0); 1207 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, drawable->tex, 0);
1238} 1208}
1239 1209
diff --git a/src/modules/evas/engines/gl_common/evas_gl_3d_private.h b/src/modules/evas/engines/gl_common/evas_gl_3d_private.h
index 6f44456b94..a05eba7669 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_3d_private.h
+++ b/src/modules/evas/engines/gl_common/evas_gl_3d_private.h
@@ -114,9 +114,7 @@ struct _E3D_Draw_Data
114 /*Sets of the quality of shadow rendering*/ 114 /*Sets of the quality of shadow rendering*/
115 Evas_Real pcf_step; 115 Evas_Real pcf_step;
116 Evas_Real pcf_size; 116 Evas_Real pcf_size;
117#ifdef GL_GLES
118 Evas_Real constant_bias; 117 Evas_Real constant_bias;
119#endif
120}; 118};
121 119
122struct _E3D_Texture 120struct _E3D_Texture
@@ -157,10 +155,6 @@ struct _E3D_Drawable
157 GLuint texDepth; 155 GLuint texDepth;
158 GLuint texcolorpick; 156 GLuint texcolorpick;
159 GLuint color_pick_fb_id; 157 GLuint color_pick_fb_id;
160#ifdef GL_GLES
161 GLuint shadow_fbo;
162 GLuint depth_render_buf;
163#endif
164}; 158};
165 159
166/* Texture internal functions. */ 160/* Texture internal functions. */
diff --git a/src/modules/evas/engines/gl_common/evas_gl_3d_shader.c b/src/modules/evas/engines/gl_common/evas_gl_3d_shader.c
index 21d5d18af8..8beeb3d0a6 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_3d_shader.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_3d_shader.c
@@ -47,9 +47,7 @@ typedef enum _E3D_Uniform
47 E3D_UNIFORM_SHADOWMAP, 47 E3D_UNIFORM_SHADOWMAP,
48 E3D_UNIFORM_SHADOWS_PCF_STEP, 48 E3D_UNIFORM_SHADOWS_PCF_STEP,
49 E3D_UNIFORM_SHADOWS_PCF_SIZE, 49 E3D_UNIFORM_SHADOWS_PCF_SIZE,
50#ifdef GL_GLES
51 E3D_UNIFORM_SHADOWS_CONSTANT_BIAS, 50 E3D_UNIFORM_SHADOWS_CONSTANT_BIAS,
52#endif
53 51
54 E3D_UNIFORM_LIGHT_POSITION, 52 E3D_UNIFORM_LIGHT_POSITION,
55 E3D_UNIFORM_LIGHT_SPOT_DIR, 53 E3D_UNIFORM_LIGHT_SPOT_DIR,
@@ -344,9 +342,7 @@ static const char *uniform_names[] =
344 "uShadowMap", 342 "uShadowMap",
345 "uShadowsPCFStep", 343 "uShadowsPCFStep",
346 "uShadowsPCFSize", 344 "uShadowsPCFSize",
347#ifdef GL_GLES
348 "uShadowsConstantBias", 345 "uShadowsConstantBias",
349#endif
350 "uLightPosition", 346 "uLightPosition",
351 "uLightSpotDir", 347 "uLightSpotDir",
352 "uLightSpotExp", 348 "uLightSpotExp",
@@ -528,11 +524,9 @@ _uniform_upload(E3D_Uniform u, GLint loc, const E3D_Draw_Data *data)
528 case E3D_UNIFORM_SHADOWS_PCF_SIZE: 524 case E3D_UNIFORM_SHADOWS_PCF_SIZE:
529 glUniform1f(loc, data->pcf_size); 525 glUniform1f(loc, data->pcf_size);
530 break; 526 break;
531#ifdef GL_GLES
532 case E3D_UNIFORM_SHADOWS_CONSTANT_BIAS: 527 case E3D_UNIFORM_SHADOWS_CONSTANT_BIAS:
533 glUniform1f(loc, data->constant_bias); 528 glUniform1f(loc, data->constant_bias);
534 break; 529 break;
535#endif
536 case E3D_UNIFORM_LIGHT_POSITION: 530 case E3D_UNIFORM_LIGHT_POSITION:
537 glUniform4f(loc, data->light.position.x, data->light.position.y, 531 glUniform4f(loc, data->light.position.x, data->light.position.y,
538 data->light.position.z, data->light.position.w); 532 data->light.position.z, data->light.position.w);
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 b6dbb5ab2d..46195fec97 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
@@ -55,15 +55,12 @@ static const char vertex_color_frag_glsl[] =
55 "uniform float uFogFactor;\n" 55 "uniform float uFogFactor;\n"
56 "uniform vec4 uFogColor;\n" 56 "uniform vec4 uFogColor;\n"
57 "#endif //FOG_ENABLED\n" 57 "#endif //FOG_ENABLED\n"
58 "#ifdef GL_ES\n"
59 "uniform int uAlphaTestComparison;\n" 58 "uniform int uAlphaTestComparison;\n"
60 "uniform float uAlphaTestRefValue;\n" 59 "uniform float uAlphaTestRefValue;\n"
61 "#endif //GL_ES\n"
62 "void main()\n" 60 "void main()\n"
63 "{\n" 61 "{\n"
64 "#ifdef ALPHA_TEST_ENABLED\n" 62 "#ifdef ALPHA_TEST_ENABLED\n"
65 " #ifdef GL_ES\n" 63 " /*uAlphaTestComparison is value of the Evas_3D_Comparison type*/\n"
66 "/*uAlphaTestComparison is value of the Evas_3D_Comparison type*/\n"
67 " const float p = 1000000.0;\n" 64 " const float p = 1000000.0;\n"
68 " float acolor = floor(vColor.a * p);\n" 65 " float acolor = floor(vColor.a * p);\n"
69 " float refvalue = floor(uAlphaTestRefValue * p);\n" 66 " float refvalue = floor(uAlphaTestRefValue * p);\n"
@@ -101,9 +98,6 @@ static const char vertex_color_frag_glsl[] =
101 " else if (uAlphaTestComparison == 7) ;\n" 98 " else if (uAlphaTestComparison == 7) ;\n"
102 "#else\n" 99 "#else\n"
103 " gl_FragColor = vColor;\n" 100 " gl_FragColor = vColor;\n"
104 "#endif //GL_ES\n"
105 "#else\n"
106 " gl_FragColor = vColor;\n"
107 "#endif //ALPHA_TEST_ENABLED\n" 101 "#endif //ALPHA_TEST_ENABLED\n"
108 " \n" 102 " \n"
109 "#ifdef FOG_ENABLED\n" 103 "#ifdef FOG_ENABLED\n"
@@ -188,10 +182,8 @@ static const char diffuse_frag_glsl[] =
188 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformDiffuse1;\n" 182 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformDiffuse1;\n"
189 "#endif //DIFFUSE_TEXTURE_BLEND\n" 183 "#endif //DIFFUSE_TEXTURE_BLEND\n"
190 "#endif //DIFFUSE\n" 184 "#endif //DIFFUSE\n"
191 "#ifdef GL_ES\n"
192 "uniform int uAlphaTestComparison;\n" 185 "uniform int uAlphaTestComparison;\n"
193 "uniform float uAlphaTestRefValue;\n" 186 "uniform float uAlphaTestRefValue;\n"
194 "#endif //GL_ES\n"
195 "void main() {\n" 187 "void main() {\n"
196 " vec4 color;\n" 188 " vec4 color;\n"
197 " \n" 189 " \n"
@@ -207,8 +199,7 @@ static const char diffuse_frag_glsl[] =
207 "#endif //DIFFUSE_TEXTURE\n" 199 "#endif //DIFFUSE_TEXTURE\n"
208 "#endif //DIFFUSE_TEXTURE_BLEND\n" 200 "#endif //DIFFUSE_TEXTURE_BLEND\n"
209 "#ifdef ALPHA_TEST_ENABLED\n" 201 "#ifdef ALPHA_TEST_ENABLED\n"
210 " #ifdef GL_ES\n" 202 " /*uAlphaTestComparison is value of the Evas_3D_Comparison type*/\n"
211 "/*uAlphaTestComparison is value of the Evas_3D_Comparison type*/\n"
212 " const float p = 1000000.0;\n" 203 " const float p = 1000000.0;\n"
213 " float acolor = floor(color.a * p);\n" 204 " float acolor = floor(color.a * p);\n"
214 " float refvalue = floor(uAlphaTestRefValue * p);\n" 205 " float refvalue = floor(uAlphaTestRefValue * p);\n"
@@ -246,9 +237,6 @@ static const char diffuse_frag_glsl[] =
246 " else if (uAlphaTestComparison == 7) ;\n" 237 " else if (uAlphaTestComparison == 7) ;\n"
247 "#else\n" 238 "#else\n"
248 " gl_FragColor = color;\n" 239 " gl_FragColor = color;\n"
249 "#endif //GL_ES\n"
250 "#else\n"
251 " gl_FragColor = color;\n"
252 "#endif //ALPHA_TEST_ENABLED\n" 240 "#endif //ALPHA_TEST_ENABLED\n"
253 " \n" 241 " \n"
254 "#ifdef FOG_ENABLED\n" 242 "#ifdef FOG_ENABLED\n"
@@ -403,9 +391,7 @@ static const char flat_frag_glsl[] =
403 "uniform sampler2D uShadowMap;\n" 391 "uniform sampler2D uShadowMap;\n"
404 "uniform float uShadowsPCFStep;\n" 392 "uniform float uShadowsPCFStep;\n"
405 "uniform float uShadowsPCFSize;\n" 393 "uniform float uShadowsPCFSize;\n"
406 "#ifdef GL_ES\n"
407 "uniform float uShadowsConstantBias;\n" 394 "uniform float uShadowsConstantBias;\n"
408 "#endif //GL_ES\n"
409 "float shadow;\n" 395 "float shadow;\n"
410 "float pcf(vec4 lpos)\n" 396 "float pcf(vec4 lpos)\n"
411 "{\n" 397 "{\n"
@@ -414,11 +400,6 @@ static const char flat_frag_glsl[] =
414 " q = floor(uShadowsPCFStep * 2.0);\n" 400 " q = floor(uShadowsPCFStep * 2.0);\n"
415 " c = floor(uShadowsPCFStep * uShadowsPCFStep * 4.0);\n" 401 " c = floor(uShadowsPCFStep * uShadowsPCFStep * 4.0);\n"
416 " shadow = 0.0;\n" 402 " shadow = 0.0;\n"
417 "#ifndef GL_ES\n"
418 " for (i = -uShadowsPCFStep; i < uShadowsPCFStep; i += 1.0)\n"
419 " for (j = -uShadowsPCFStep; j < uShadowsPCFStep; j += 1.0)\n"
420 " shadow += float(smcoord.z <= texture2D(uShadowMap, smcoord.xy + vec2(i / q, j / q) * uShadowsPCFSize).x);\n"
421 "#else\n"
422 " const vec4 unpack = vec4(1.0 / (256.0 * 256.0 * 256.0), 1.0 / (256.0 * 256.0), 1.0 / 256.0, 1.0);\n" 403 " const vec4 unpack = vec4(1.0 / (256.0 * 256.0 * 256.0), 1.0 / (256.0 * 256.0), 1.0 / 256.0, 1.0);\n"
423 " for (i = -uShadowsPCFStep; i < uShadowsPCFStep; i += 1.0)\n" 404 " for (i = -uShadowsPCFStep; i < uShadowsPCFStep; i += 1.0)\n"
424 " for (j = -uShadowsPCFStep; j < uShadowsPCFStep; j += 1.0)\n" 405 " for (j = -uShadowsPCFStep; j < uShadowsPCFStep; j += 1.0)\n"
@@ -426,7 +407,6 @@ static const char flat_frag_glsl[] =
426 " vec4 zvalue = texture2D(uShadowMap, smcoord.xy + vec2(i / q, j / q) * uShadowsPCFSize);\n" 407 " vec4 zvalue = texture2D(uShadowMap, smcoord.xy + vec2(i / q, j / q) * uShadowsPCFSize);\n"
427 " shadow += float(smcoord.z < dot(zvalue, unpack) + uShadowsConstantBias);\n" 408 " shadow += float(smcoord.z < dot(zvalue, unpack) + uShadowsConstantBias);\n"
428 " }\n" 409 " }\n"
429 "#endif //GL_ES\n"
430 " return shadow / c;\n" 410 " return shadow / c;\n"
431 "}\n" 411 "}\n"
432 "#endif //SHADOWED\n" 412 "#endif //SHADOWED\n"
@@ -498,10 +478,8 @@ static const char flat_frag_glsl[] =
498 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformEmission1;\n" 478 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformEmission1;\n"
499 "#endif //EMISSION_TEXTURE_BLEND\n" 479 "#endif //EMISSION_TEXTURE_BLEND\n"
500 "#endif //EMISSION\n" 480 "#endif //EMISSION\n"
501 "#ifdef GL_ES\n"
502 "uniform int uAlphaTestComparison;\n" 481 "uniform int uAlphaTestComparison;\n"
503 "uniform float uAlphaTestRefValue;\n" 482 "uniform float uAlphaTestRefValue;\n"
504 "#endif //GL_ES\n"
505 "vec4 fragmentFlat()\n" 483 "vec4 fragmentFlat()\n"
506 "{\n" 484 "{\n"
507 " vec4 color;\n" 485 " vec4 color;\n"
@@ -580,8 +558,7 @@ static const char flat_frag_glsl[] =
580 "#endif //SHADOWED\n" 558 "#endif //SHADOWED\n"
581 " color = fragmentFlat();\n" 559 " color = fragmentFlat();\n"
582 "#ifdef ALPHA_TEST_ENABLED\n" 560 "#ifdef ALPHA_TEST_ENABLED\n"
583 " #ifdef GL_ES\n" 561 " /*uAlphaTestComparison is value of the Evas_3D_Comparison type*/\n"
584 "/*uAlphaTestComparison is value of the Evas_3D_Comparison type*/\n"
585 " const float p = 1000000.0;\n" 562 " const float p = 1000000.0;\n"
586 " float acolor = floor(color.a * p);\n" 563 " float acolor = floor(color.a * p);\n"
587 " float refvalue = floor(uAlphaTestRefValue * p);\n" 564 " float refvalue = floor(uAlphaTestRefValue * p);\n"
@@ -619,9 +596,6 @@ static const char flat_frag_glsl[] =
619 " else if (uAlphaTestComparison == 7) ;\n" 596 " else if (uAlphaTestComparison == 7) ;\n"
620 "#else\n" 597 "#else\n"
621 " gl_FragColor = color;\n" 598 " gl_FragColor = color;\n"
622 "#endif //GL_ES\n"
623 "#else\n"
624 " gl_FragColor = color;\n"
625 "#endif //ALPHA_TEST_ENABLED\n" 599 "#endif //ALPHA_TEST_ENABLED\n"
626 " \n" 600 " \n"
627 "#ifdef FOG_ENABLED\n" 601 "#ifdef FOG_ENABLED\n"
@@ -746,9 +720,7 @@ static const char phong_frag_glsl[] =
746 "uniform sampler2D uShadowMap;\n" 720 "uniform sampler2D uShadowMap;\n"
747 "uniform float uShadowsPCFStep;\n" 721 "uniform float uShadowsPCFStep;\n"
748 "uniform float uShadowsPCFSize;\n" 722 "uniform float uShadowsPCFSize;\n"
749 "#ifdef GL_ES\n"
750 "uniform float uShadowsConstantBias;\n" 723 "uniform float uShadowsConstantBias;\n"
751 "#endif //GL_ES\n"
752 "float shadow;\n" 724 "float shadow;\n"
753 "float pcf(vec4 lpos)\n" 725 "float pcf(vec4 lpos)\n"
754 "{\n" 726 "{\n"
@@ -757,11 +729,6 @@ static const char phong_frag_glsl[] =
757 " q = floor(uShadowsPCFStep * 2.0);\n" 729 " q = floor(uShadowsPCFStep * 2.0);\n"
758 " c = floor(uShadowsPCFStep * uShadowsPCFStep * 4.0);\n" 730 " c = floor(uShadowsPCFStep * uShadowsPCFStep * 4.0);\n"
759 " shadow = 0.0;\n" 731 " shadow = 0.0;\n"
760 "#ifndef GL_ES\n"
761 " for (i = -uShadowsPCFStep; i < uShadowsPCFStep; i += 1.0)\n"
762 " for (j = -uShadowsPCFStep; j < uShadowsPCFStep; j += 1.0)\n"
763 " shadow += float(smcoord.z <= texture2D(uShadowMap, smcoord.xy + vec2(i / q, j / q) * uShadowsPCFSize).x);\n"
764 "#else\n"
765 " const vec4 unpack = vec4(1.0 / (256.0 * 256.0 * 256.0), 1.0 / (256.0 * 256.0), 1.0 / 256.0, 1.0);\n" 732 " const vec4 unpack = vec4(1.0 / (256.0 * 256.0 * 256.0), 1.0 / (256.0 * 256.0), 1.0 / 256.0, 1.0);\n"
766 " for (i = -uShadowsPCFStep; i < uShadowsPCFStep; i += 1.0)\n" 733 " for (i = -uShadowsPCFStep; i < uShadowsPCFStep; i += 1.0)\n"
767 " for (j = -uShadowsPCFStep; j < uShadowsPCFStep; j += 1.0)\n" 734 " for (j = -uShadowsPCFStep; j < uShadowsPCFStep; j += 1.0)\n"
@@ -769,7 +736,6 @@ static const char phong_frag_glsl[] =
769 " vec4 zvalue = texture2D(uShadowMap, smcoord.xy + vec2(i / q, j / q) * uShadowsPCFSize);\n" 736 " vec4 zvalue = texture2D(uShadowMap, smcoord.xy + vec2(i / q, j / q) * uShadowsPCFSize);\n"
770 " shadow += float(smcoord.z < dot(zvalue, unpack) + uShadowsConstantBias);\n" 737 " shadow += float(smcoord.z < dot(zvalue, unpack) + uShadowsConstantBias);\n"
771 " }\n" 738 " }\n"
772 "#endif //GL_ES\n"
773 " return shadow / c;\n" 739 " return shadow / c;\n"
774 "}\n" 740 "}\n"
775 "#endif //SHADOWED\n" 741 "#endif //SHADOWED\n"
@@ -849,10 +815,8 @@ static const char phong_frag_glsl[] =
849 "#ifdef LIGHT_ATTENUATION\n" 815 "#ifdef LIGHT_ATTENUATION\n"
850 "varying float vLightDist;\n" 816 "varying float vLightDist;\n"
851 "#endif //LIGHT_ATTENUATION\n" 817 "#endif //LIGHT_ATTENUATION\n"
852 "#ifdef GL_ES\n"
853 "uniform int uAlphaTestComparison;\n" 818 "uniform int uAlphaTestComparison;\n"
854 "uniform float uAlphaTestRefValue;\n" 819 "uniform float uAlphaTestRefValue;\n"
855 "#endif //GL_ES\n"
856 "vec4 fragmentPhong()\n" 820 "vec4 fragmentPhong()\n"
857 "{\n" 821 "{\n"
858 " vec3 normal = normalize(vNormal);\n" 822 " vec3 normal = normalize(vNormal);\n"
@@ -959,8 +923,7 @@ static const char phong_frag_glsl[] =
959 "#endif //SHADOWED\n" 923 "#endif //SHADOWED\n"
960 " color = fragmentPhong();\n" 924 " color = fragmentPhong();\n"
961 "#ifdef ALPHA_TEST_ENABLED\n" 925 "#ifdef ALPHA_TEST_ENABLED\n"
962 " #ifdef GL_ES\n" 926 " /*uAlphaTestComparison is value of the Evas_3D_Comparison type*/\n"
963 "/*uAlphaTestComparison is value of the Evas_3D_Comparison type*/\n"
964 " const float p = 1000000.0;\n" 927 " const float p = 1000000.0;\n"
965 " float acolor = floor(color.a * p);\n" 928 " float acolor = floor(color.a * p);\n"
966 " float refvalue = floor(uAlphaTestRefValue * p);\n" 929 " float refvalue = floor(uAlphaTestRefValue * p);\n"
@@ -998,9 +961,6 @@ static const char phong_frag_glsl[] =
998 " else if (uAlphaTestComparison == 7) ;\n" 961 " else if (uAlphaTestComparison == 7) ;\n"
999 "#else\n" 962 "#else\n"
1000 " gl_FragColor = color;\n" 963 " gl_FragColor = color;\n"
1001 "#endif //GL_ES\n"
1002 "#else\n"
1003 " gl_FragColor = color;\n"
1004 "#endif //ALPHA_TEST_ENABLED\n" 964 "#endif //ALPHA_TEST_ENABLED\n"
1005 " \n" 965 " \n"
1006 "#ifdef FOG_ENABLED\n" 966 "#ifdef FOG_ENABLED\n"
@@ -1182,9 +1142,7 @@ static const char normal_map_frag_glsl[] =
1182 "uniform sampler2D uShadowMap;\n" 1142 "uniform sampler2D uShadowMap;\n"
1183 "uniform float uShadowsPCFStep;\n" 1143 "uniform float uShadowsPCFStep;\n"
1184 "uniform float uShadowsPCFSize;\n" 1144 "uniform float uShadowsPCFSize;\n"
1185 "#ifdef GL_ES\n"
1186 "uniform float uShadowsConstantBias;\n" 1145 "uniform float uShadowsConstantBias;\n"
1187 "#endif //GL_ES\n"
1188 "float shadow;\n" 1146 "float shadow;\n"
1189 "float pcf(vec4 lpos)\n" 1147 "float pcf(vec4 lpos)\n"
1190 "{\n" 1148 "{\n"
@@ -1193,11 +1151,6 @@ static const char normal_map_frag_glsl[] =
1193 " q = floor(uShadowsPCFStep * 2.0);\n" 1151 " q = floor(uShadowsPCFStep * 2.0);\n"
1194 " c = floor(uShadowsPCFStep * uShadowsPCFStep * 4.0);\n" 1152 " c = floor(uShadowsPCFStep * uShadowsPCFStep * 4.0);\n"
1195 " shadow = 0.0;\n" 1153 " shadow = 0.0;\n"
1196 "#ifndef GL_ES\n"
1197 " for (i = -uShadowsPCFStep; i < uShadowsPCFStep; i += 1.0)\n"
1198 " for (j = -uShadowsPCFStep; j < uShadowsPCFStep; j += 1.0)\n"
1199 " shadow += float(smcoord.z <= texture2D(uShadowMap, smcoord.xy + vec2(i / q, j / q) * uShadowsPCFSize).x);\n"
1200 "#else\n"
1201 " const vec4 unpack = vec4(1.0 / (256.0 * 256.0 * 256.0), 1.0 / (256.0 * 256.0), 1.0 / 256.0, 1.0);\n" 1154 " const vec4 unpack = vec4(1.0 / (256.0 * 256.0 * 256.0), 1.0 / (256.0 * 256.0), 1.0 / 256.0, 1.0);\n"
1202 " for (i = -uShadowsPCFStep; i < uShadowsPCFStep; i += 1.0)\n" 1155 " for (i = -uShadowsPCFStep; i < uShadowsPCFStep; i += 1.0)\n"
1203 " for (j = -uShadowsPCFStep; j < uShadowsPCFStep; j += 1.0)\n" 1156 " for (j = -uShadowsPCFStep; j < uShadowsPCFStep; j += 1.0)\n"
@@ -1205,7 +1158,6 @@ static const char normal_map_frag_glsl[] =
1205 " vec4 zvalue = texture2D(uShadowMap, smcoord.xy + vec2(i / q, j / q) * uShadowsPCFSize);\n" 1158 " vec4 zvalue = texture2D(uShadowMap, smcoord.xy + vec2(i / q, j / q) * uShadowsPCFSize);\n"
1206 " shadow += float(smcoord.z < dot(zvalue, unpack) + uShadowsConstantBias);\n" 1159 " shadow += float(smcoord.z < dot(zvalue, unpack) + uShadowsConstantBias);\n"
1207 " }\n" 1160 " }\n"
1208 "#endif //GL_ES\n"
1209 " return shadow / c;\n" 1161 " return shadow / c;\n"
1210 "}\n" 1162 "}\n"
1211 "#endif //SHADOWED\n" 1163 "#endif //SHADOWED\n"
@@ -1222,10 +1174,8 @@ static const char normal_map_frag_glsl[] =
1222 "vec3 Tex1CoordNormal =\n" 1174 "vec3 Tex1CoordNormal =\n"
1223 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformNormal1;\n" 1175 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformNormal1;\n"
1224 "#endif //NORMAL_TEXTURE_BLEND\n" 1176 "#endif //NORMAL_TEXTURE_BLEND\n"
1225 "#ifdef GL_ES\n"
1226 "uniform int uAlphaTestComparison;\n" 1177 "uniform int uAlphaTestComparison;\n"
1227 "uniform float uAlphaTestRefValue;\n" 1178 "uniform float uAlphaTestRefValue;\n"
1228 "#endif //GL_ES\n"
1229 "#ifndef VERTEX_TANGENT\n" 1179 "#ifndef VERTEX_TANGENT\n"
1230 "varying vec3 vNormal;\n" 1180 "varying vec3 vNormal;\n"
1231 "#endif //VERTEX_TANGENT\n" 1181 "#endif //VERTEX_TANGENT\n"
@@ -1439,8 +1389,7 @@ static const char normal_map_frag_glsl[] =
1439 "#endif //SHADOWED\n" 1389 "#endif //SHADOWED\n"
1440 " color = fragmentNormalMap();\n" 1390 " color = fragmentNormalMap();\n"
1441 "#ifdef ALPHA_TEST_ENABLED\n" 1391 "#ifdef ALPHA_TEST_ENABLED\n"
1442 " #ifdef GL_ES\n" 1392 " /*uAlphaTestComparison is value of the Evas_3D_Comparison type*/\n"
1443 "/*uAlphaTestComparison is value of the Evas_3D_Comparison type*/\n"
1444 " const float p = 1000000.0;\n" 1393 " const float p = 1000000.0;\n"
1445 " float acolor = floor(color.a * p);\n" 1394 " float acolor = floor(color.a * p);\n"
1446 " float refvalue = floor(uAlphaTestRefValue * p);\n" 1395 " float refvalue = floor(uAlphaTestRefValue * p);\n"
@@ -1478,9 +1427,6 @@ static const char normal_map_frag_glsl[] =
1478 " else if (uAlphaTestComparison == 7) ;\n" 1427 " else if (uAlphaTestComparison == 7) ;\n"
1479 "#else\n" 1428 "#else\n"
1480 " gl_FragColor = color;\n" 1429 " gl_FragColor = color;\n"
1481 "#endif //GL_ES\n"
1482 "#else\n"
1483 " gl_FragColor = color;\n"
1484 "#endif //ALPHA_TEST_ENABLED\n" 1430 "#endif //ALPHA_TEST_ENABLED\n"
1485 "#ifdef FOG_ENABLED\n" 1431 "#ifdef FOG_ENABLED\n"
1486 " float z = gl_FragCoord.z / gl_FragCoord.w;\n" 1432 " float z = gl_FragCoord.z / gl_FragCoord.w;\n"
@@ -1551,10 +1497,8 @@ static const char shadow_map_frag_glsl[] =
1551 "#ifdef NEED_TEX_COORD\n" 1497 "#ifdef NEED_TEX_COORD\n"
1552 "varying vec2 vTexCoord;\n" 1498 "varying vec2 vTexCoord;\n"
1553 "#endif //TEX_COORD\n" 1499 "#endif //TEX_COORD\n"
1554 "#ifdef GL_ES\n"
1555 "uniform int uAlphaTestComparison;\n" 1500 "uniform int uAlphaTestComparison;\n"
1556 "uniform float uAlphaTestRefValue;\n" 1501 "uniform float uAlphaTestRefValue;\n"
1557 "#endif //GL_ES\n"
1558 "#ifdef DIFFUSE\n" 1502 "#ifdef DIFFUSE\n"
1559 "#ifdef DIFFUSE_TEXTURE\n" 1503 "#ifdef DIFFUSE_TEXTURE\n"
1560 "uniform sampler2D uTextureDiffuse0;\n" 1504 "uniform sampler2D uTextureDiffuse0;\n"
@@ -1588,8 +1532,7 @@ static const char shadow_map_frag_glsl[] =
1588 " color = vec4(1);\n" 1532 " color = vec4(1);\n"
1589 "#endif //DIFFUSE_TEXTURE\n" 1533 "#endif //DIFFUSE_TEXTURE\n"
1590 "#endif //DIFFUSE_TEXTURE_BLEND\n" 1534 "#endif //DIFFUSE_TEXTURE_BLEND\n"
1591 " #ifdef GL_ES\n" 1535 " /*uAlphaTestComparison is value of the Evas_3D_Comparison type*/\n"
1592 "/*uAlphaTestComparison is value of the Evas_3D_Comparison type*/\n"
1593 " const float p = 1000000.0;\n" 1536 " const float p = 1000000.0;\n"
1594 " float acolor = floor(color.a * p);\n" 1537 " float acolor = floor(color.a * p);\n"
1595 " float refvalue = floor(uAlphaTestRefValue * p);\n" 1538 " float refvalue = floor(uAlphaTestRefValue * p);\n"
@@ -1625,13 +1568,7 @@ static const char shadow_map_frag_glsl[] =
1625 " else discard;\n" 1568 " else discard;\n"
1626 " }\n" 1569 " }\n"
1627 " else if (uAlphaTestComparison == 7) ;\n" 1570 " else if (uAlphaTestComparison == 7) ;\n"
1628 "#else\n"
1629 " gl_FragColor = color;\n"
1630 "#endif //GL_ES\n"
1631 "#endif //ALPHA_TEST_ENABLED\n" 1571 "#endif //ALPHA_TEST_ENABLED\n"
1632 "#ifndef GL_ES\n"
1633 " gl_FragColor.r = gl_FragCoord.z;\n"
1634 "#else\n"
1635 " const vec4 pack = vec4(256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0);\n" 1572 " const vec4 pack = vec4(256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0);\n"
1636 " const vec4 mask = vec4(0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0);\n" 1573 " const vec4 mask = vec4(0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0);\n"
1637 " vec4 depthcolor;\n" 1574 " vec4 depthcolor;\n"
@@ -1640,7 +1577,6 @@ static const char shadow_map_frag_glsl[] =
1640 " depthcolor = vec4(fract(pack * normdist));\n" 1577 " depthcolor = vec4(fract(pack * normdist));\n"
1641 " depthcolor -= depthcolor.xxyz * mask;\n" 1578 " depthcolor -= depthcolor.xxyz * mask;\n"
1642 " gl_FragColor = depthcolor;\n" 1579 " gl_FragColor = depthcolor;\n"
1643 "#endif\n"
1644 "}\n"; 1580 "}\n";
1645 1581
1646static const char color_pick_vert_glsl[] = 1582static const char color_pick_vert_glsl[] =
@@ -1681,10 +1617,8 @@ static const char color_pick_frag_glsl[] =
1681 "#else\n" 1617 "#else\n"
1682 " uniform vec4 uColorPick;\n" 1618 " uniform vec4 uColorPick;\n"
1683 "#endif\n" 1619 "#endif\n"
1684 "#ifdef GL_ES\n"
1685 "uniform int uAlphaTestComparison;\n" 1620 "uniform int uAlphaTestComparison;\n"
1686 "uniform float uAlphaTestRefValue;\n" 1621 "uniform float uAlphaTestRefValue;\n"
1687 "#endif //GL_ES\n"
1688 "void main()\n" 1622 "void main()\n"
1689 "{\n" 1623 "{\n"
1690 " vec4 color;\n" 1624 " vec4 color;\n"
@@ -1694,8 +1628,7 @@ static const char color_pick_frag_glsl[] =
1694 " color = uColorPick;\n" 1628 " color = uColorPick;\n"
1695 "#endif\n" 1629 "#endif\n"
1696 "#ifdef ALPHA_TEST_ENABLED\n" 1630 "#ifdef ALPHA_TEST_ENABLED\n"
1697 " #ifdef GL_ES\n" 1631 " /*uAlphaTestComparison is value of the Evas_3D_Comparison type*/\n"
1698 "/*uAlphaTestComparison is value of the Evas_3D_Comparison type*/\n"
1699 " const float p = 1000000.0;\n" 1632 " const float p = 1000000.0;\n"
1700 " float acolor = floor(color.a * p);\n" 1633 " float acolor = floor(color.a * p);\n"
1701 " float refvalue = floor(uAlphaTestRefValue * p);\n" 1634 " float refvalue = floor(uAlphaTestRefValue * p);\n"
@@ -1733,9 +1666,6 @@ static const char color_pick_frag_glsl[] =
1733 " else if (uAlphaTestComparison == 7) ;\n" 1666 " else if (uAlphaTestComparison == 7) ;\n"
1734 "#else\n" 1667 "#else\n"
1735 " gl_FragColor = color;\n" 1668 " gl_FragColor = color;\n"
1736 "#endif //GL_ES\n"
1737 "#else\n"
1738 " gl_FragColor = color;\n"
1739 "#endif //ALPHA_TEST_ENABLED\n" 1669 "#endif //ALPHA_TEST_ENABLED\n"
1740 "}\n"; 1670 "}\n";
1741 1671
@@ -1891,9 +1821,7 @@ static const char parallax_occlusion_frag_glsl[] =
1891 "uniform sampler2D uShadowMap;\n" 1821 "uniform sampler2D uShadowMap;\n"
1892 "uniform float uShadowsPCFStep;\n" 1822 "uniform float uShadowsPCFStep;\n"
1893 "uniform float uShadowsPCFSize;\n" 1823 "uniform float uShadowsPCFSize;\n"
1894 "#ifdef GL_ES\n"
1895 "uniform float uShadowsConstantBias;\n" 1824 "uniform float uShadowsConstantBias;\n"
1896 "#endif //GL_ES\n"
1897 "float shadow;\n" 1825 "float shadow;\n"
1898 "float pcf(vec4 lpos)\n" 1826 "float pcf(vec4 lpos)\n"
1899 "{\n" 1827 "{\n"
@@ -1902,11 +1830,6 @@ static const char parallax_occlusion_frag_glsl[] =
1902 " q = floor(uShadowsPCFStep * 2.0);\n" 1830 " q = floor(uShadowsPCFStep * 2.0);\n"
1903 " c = floor(uShadowsPCFStep * uShadowsPCFStep * 4.0);\n" 1831 " c = floor(uShadowsPCFStep * uShadowsPCFStep * 4.0);\n"
1904 " shadow = 0.0;\n" 1832 " shadow = 0.0;\n"
1905 "#ifndef GL_ES\n"
1906 " for (i = -uShadowsPCFStep; i < uShadowsPCFStep; i += 1.0)\n"
1907 " for (j = -uShadowsPCFStep; j < uShadowsPCFStep; j += 1.0)\n"
1908 " shadow += float(smcoord.z <= texture2D(uShadowMap, smcoord.xy + vec2(i / q, j / q) * uShadowsPCFSize).x);\n"
1909 "#else\n"
1910 " const vec4 unpack = vec4(1.0 / (256.0 * 256.0 * 256.0), 1.0 / (256.0 * 256.0), 1.0 / 256.0, 1.0);\n" 1833 " const vec4 unpack = vec4(1.0 / (256.0 * 256.0 * 256.0), 1.0 / (256.0 * 256.0), 1.0 / 256.0, 1.0);\n"
1911 " for (i = -uShadowsPCFStep; i < uShadowsPCFStep; i += 1.0)\n" 1834 " for (i = -uShadowsPCFStep; i < uShadowsPCFStep; i += 1.0)\n"
1912 " for (j = -uShadowsPCFStep; j < uShadowsPCFStep; j += 1.0)\n" 1835 " for (j = -uShadowsPCFStep; j < uShadowsPCFStep; j += 1.0)\n"
@@ -1914,7 +1837,6 @@ static const char parallax_occlusion_frag_glsl[] =
1914 " vec4 zvalue = texture2D(uShadowMap, smcoord.xy + vec2(i / q, j / q) * uShadowsPCFSize);\n" 1837 " vec4 zvalue = texture2D(uShadowMap, smcoord.xy + vec2(i / q, j / q) * uShadowsPCFSize);\n"
1915 " shadow += float(smcoord.z < dot(zvalue, unpack) + uShadowsConstantBias);\n" 1838 " shadow += float(smcoord.z < dot(zvalue, unpack) + uShadowsConstantBias);\n"
1916 " }\n" 1839 " }\n"
1917 "#endif //GL_ES\n"
1918 " return shadow / c;\n" 1840 " return shadow / c;\n"
1919 "}\n" 1841 "}\n"
1920 "#endif //SHADOWED\n" 1842 "#endif //SHADOWED\n"
@@ -1994,10 +1916,8 @@ static const char parallax_occlusion_frag_glsl[] =
1994 "#ifdef LIGHT_ATTENUATION\n" 1916 "#ifdef LIGHT_ATTENUATION\n"
1995 "varying float vLightDist;\n" 1917 "varying float vLightDist;\n"
1996 "#endif //LIGHT_ATTENUATION\n" 1918 "#endif //LIGHT_ATTENUATION\n"
1997 "#ifdef GL_ES\n"
1998 "uniform int uAlphaTestComparison;\n" 1919 "uniform int uAlphaTestComparison;\n"
1999 "uniform float uAlphaTestRefValue;\n" 1920 "uniform float uAlphaTestRefValue;\n"
2000 "#endif //GL_ES\n"
2001 "const float parallaxScale = 0.2;\n" 1921 "const float parallaxScale = 0.2;\n"
2002 "vec2 parallaxMapping(in vec3 view, in vec2 tex, out float parallaxHeight)\n" 1922 "vec2 parallaxMapping(in vec3 view, in vec2 tex, out float parallaxHeight)\n"
2003 "{\n" 1923 "{\n"
@@ -2147,8 +2067,7 @@ static const char parallax_occlusion_frag_glsl[] =
2147 "#endif //SHADOWED\n" 2067 "#endif //SHADOWED\n"
2148 " color = fragmentParallaxMap();\n" 2068 " color = fragmentParallaxMap();\n"
2149 "#ifdef ALPHA_TEST_ENABLED\n" 2069 "#ifdef ALPHA_TEST_ENABLED\n"
2150 " #ifdef GL_ES\n" 2070 " /*uAlphaTestComparison is value of the Evas_3D_Comparison type*/\n"
2151 "/*uAlphaTestComparison is value of the Evas_3D_Comparison type*/\n"
2152 " const float p = 1000000.0;\n" 2071 " const float p = 1000000.0;\n"
2153 " float acolor = floor(color.a * p);\n" 2072 " float acolor = floor(color.a * p);\n"
2154 " float refvalue = floor(uAlphaTestRefValue * p);\n" 2073 " float refvalue = floor(uAlphaTestRefValue * p);\n"
@@ -2186,9 +2105,6 @@ static const char parallax_occlusion_frag_glsl[] =
2186 " else if (uAlphaTestComparison == 7) ;\n" 2105 " else if (uAlphaTestComparison == 7) ;\n"
2187 "#else\n" 2106 "#else\n"
2188 " gl_FragColor = color;\n" 2107 " gl_FragColor = color;\n"
2189 "#endif //GL_ES\n"
2190 "#else\n"
2191 " gl_FragColor = color;\n"
2192 "#endif //ALPHA_TEST_ENABLED\n" 2108 "#endif //ALPHA_TEST_ENABLED\n"
2193 " \n" 2109 " \n"
2194 "#ifdef FOG_ENABLED\n" 2110 "#ifdef FOG_ENABLED\n"
diff --git a/src/modules/evas/engines/gl_common/shader_3d/include.shd b/src/modules/evas/engines/gl_common/shader_3d/include.shd
index 28a99556a9..03afe259cf 100644
--- a/src/modules/evas/engines/gl_common/shader_3d/include.shd
+++ b/src/modules/evas/engines/gl_common/shader_3d/include.shd
@@ -29,12 +29,9 @@ define(`FRAGMENT_SHADER_USE_FOG', `
29uniform float uFogFactor; 29uniform float uFogFactor;
30uniform vec4 uFogColor; 30uniform vec4 uFogColor;
31#endif //FOG_ENABLED') 31#endif //FOG_ENABLED')
32 32define(`FRAGMENT_SHADER_USE_ALPHA_TEST_GLES',
33define(`FRAGMENT_SHADER_USE_ALPHA_TEST_GLES', `
34#ifdef GL_ES
35uniform int uAlphaTestComparison; 33uniform int uAlphaTestComparison;
36uniform float uAlphaTestRefValue; 34uniform float uAlphaTestRefValue;)
37#endif //GL_ES')
38 35
39define(`FRAGMENT_SHADER_USE_SHADOWS', ` 36define(`FRAGMENT_SHADER_USE_SHADOWS', `
40#ifdef SHADOWED 37#ifdef SHADOWED
@@ -42,9 +39,7 @@ varying vec4 vLightPosition;
42uniform sampler2D uShadowMap; 39uniform sampler2D uShadowMap;
43uniform float uShadowsPCFStep; 40uniform float uShadowsPCFStep;
44uniform float uShadowsPCFSize; 41uniform float uShadowsPCFSize;
45#ifdef GL_ES
46uniform float uShadowsConstantBias; 42uniform float uShadowsConstantBias;
47#endif //GL_ES
48float shadow; 43float shadow;
49float pcf(vec4 lpos) 44float pcf(vec4 lpos)
50{ 45{
@@ -53,11 +48,6 @@ float pcf(vec4 lpos)
53 q = floor(uShadowsPCFStep * 2.0); 48 q = floor(uShadowsPCFStep * 2.0);
54 c = floor(uShadowsPCFStep * uShadowsPCFStep * 4.0); 49 c = floor(uShadowsPCFStep * uShadowsPCFStep * 4.0);
55 shadow = 0.0; 50 shadow = 0.0;
56#ifndef GL_ES
57 for (i = -uShadowsPCFStep; i < uShadowsPCFStep; i += 1.0)
58 for (j = -uShadowsPCFStep; j < uShadowsPCFStep; j += 1.0)
59 shadow += float(smcoord.z <= texture2D(uShadowMap, smcoord.xy + vec2(i / q, j / q) * uShadowsPCFSize).x);
60#else
61 const vec4 unpack = vec4(1.0 / (256.0 * 256.0 * 256.0), 1.0 / (256.0 * 256.0), 1.0 / 256.0, 1.0); 51 const vec4 unpack = vec4(1.0 / (256.0 * 256.0 * 256.0), 1.0 / (256.0 * 256.0), 1.0 / 256.0, 1.0);
62 for (i = -uShadowsPCFStep; i < uShadowsPCFStep; i += 1.0) 52 for (i = -uShadowsPCFStep; i < uShadowsPCFStep; i += 1.0)
63 for (j = -uShadowsPCFStep; j < uShadowsPCFStep; j += 1.0) 53 for (j = -uShadowsPCFStep; j < uShadowsPCFStep; j += 1.0)
@@ -65,7 +55,6 @@ float pcf(vec4 lpos)
65 vec4 zvalue = texture2D(uShadowMap, smcoord.xy + vec2(i / q, j / q) * uShadowsPCFSize); 55 vec4 zvalue = texture2D(uShadowMap, smcoord.xy + vec2(i / q, j / q) * uShadowsPCFSize);
66 shadow += float(smcoord.z < dot(zvalue, unpack) + uShadowsConstantBias); 56 shadow += float(smcoord.z < dot(zvalue, unpack) + uShadowsConstantBias);
67 } 57 }
68#endif //GL_ES
69 return shadow / c; 58 return shadow / c;
70} 59}
71#endif //SHADOWED') 60#endif //SHADOWED')
@@ -130,7 +119,6 @@ FRAGMENT_SHADER_USE_TEXTURE(DIFFUSE, Diffuse)
130`#endif //DIFFUSE') 119`#endif //DIFFUSE')
131 120
132define(`FRAGMENT_SHADER_ALPHA_TEST_GLES_APPLY', 121define(`FRAGMENT_SHADER_ALPHA_TEST_GLES_APPLY',
133`#ifdef GL_ES'
134/*uAlphaTestComparison is value of the Evas_3D_Comparison type*/ 122/*uAlphaTestComparison is value of the Evas_3D_Comparison type*/
135 const float p = 1000000.0; 123 const float p = 1000000.0;
136 float acolor = floor($1.a * p); 124 float acolor = floor($1.a * p);
@@ -166,10 +154,7 @@ define(`FRAGMENT_SHADER_ALPHA_TEST_GLES_APPLY',
166 if (acolor >= refvalue) gl_FragColor = $1; 154 if (acolor >= refvalue) gl_FragColor = $1;
167 else discard; 155 else discard;
168 } 156 }
169 else if (uAlphaTestComparison == 7) ; 157 else if (uAlphaTestComparison == 7) ;)
170`#else'
171 gl_FragColor = $1;
172`#endif //GL_ES')
173 158
174 159
175define(`VERTEX_SHADER_NEED_TEX_COORD', 160define(`VERTEX_SHADER_NEED_TEX_COORD',
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 bdb16e59bb..c464730853 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
@@ -50,9 +50,7 @@ void main() {
50 FRAGMENT_SHADER_ALPHA_TEST_GLES_APPLY(color) 50 FRAGMENT_SHADER_ALPHA_TEST_GLES_APPLY(color)
51 51
52#endif //ALPHA_TEST_ENABLED 52#endif //ALPHA_TEST_ENABLED
53#ifndef GL_ES 53
54 gl_FragColor.r = gl_FragCoord.z;
55#else
56 const vec4 pack = vec4(256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0); 54 const vec4 pack = vec4(256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0);
57 const vec4 mask = vec4(0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0); 55 const vec4 mask = vec4(0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0);
58 vec4 depthcolor; 56 vec4 depthcolor;
@@ -61,5 +59,4 @@ void main() {
61 depthcolor = vec4(fract(pack * normdist)); 59 depthcolor = vec4(fract(pack * normdist));
62 depthcolor -= depthcolor.xxyz * mask; 60 depthcolor -= depthcolor.xxyz * mask;
63 gl_FragColor = depthcolor; 61 gl_FragColor = depthcolor;
64#endif
65} 62}