summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2015-05-21 17:03:24 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2015-05-21 17:03:36 +0900
commitce7a6e710643069c895aed1d2dd9a1417389a742 (patch)
treed33ac6e1873b13451d4a1de93ac1824f20fc51d2
parent344f17a03de8799b5b6008f11008bb079a8fac67 (diff)
update shaders
-rw-r--r--src/modules/evas/engines/gl_common/shader_3d/evas_gl_3d_shaders.x585
1 files changed, 498 insertions, 87 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 7685aa8ac0..4185c44eb7 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
@@ -54,9 +54,56 @@ static const char vertex_color_frag_glsl[] =
54 "uniform float uFogFactor;\n" 54 "uniform float uFogFactor;\n"
55 "uniform vec4 uFogColor;\n" 55 "uniform vec4 uFogColor;\n"
56 "#endif //FOG_ENABLED\n" 56 "#endif //FOG_ENABLED\n"
57 "#ifdef GL_ES\n"
58 "uniform int uAlphaTestComparison;\n"
59 "uniform float uAlphaTestRefValue;\n"
60 "#endif //GL_ES\n"
57 "void main()\n" 61 "void main()\n"
58 "{\n" 62 "{\n"
63 "#ifdef ALPHA_TEST_ENABLED\n"
64 " #ifdef GL_ES\n"
65 "/*uAlphaTestComparison is value of the Evas_3D_Comparison type*/\n"
66 " const float p = 1000000.0;\n"
67 " float acolor = floor(vColor.a * p);\n"
68 " float refvalue = floor(uAlphaTestRefValue * p);\n"
69 " if (uAlphaTestComparison == 0) discard;\n"
70 " else if (uAlphaTestComparison == 1)\n"
71 " {\n"
72 " if (acolor < refvalue) gl_FragColor = vColor;\n"
73 " else discard;\n"
74 " }\n"
75 " else if (uAlphaTestComparison == 2)\n"
76 " {\n"
77 " if (acolor == refvalue) gl_FragColor = vColor;\n"
78 " else discard;\n"
79 " }\n"
80 " else if (uAlphaTestComparison == 3)\n"
81 " {\n"
82 " if (acolor <= refvalue) gl_FragColor = vColor;\n"
83 " else discard;\n"
84 " }\n"
85 " else if (uAlphaTestComparison == 4)\n"
86 " {\n"
87 " if (acolor > refvalue) gl_FragColor = vColor;\n"
88 " else discard;\n"
89 " }\n"
90 " else if (uAlphaTestComparison == 5)\n"
91 " {\n"
92 " if (acolor != refvalue) gl_FragColor = vColor;\n"
93 " else discard;\n"
94 " }\n"
95 " else if (uAlphaTestComparison == 6)\n"
96 " {\n"
97 " if (acolor >= refvalue) gl_FragColor = vColor;\n"
98 " else discard;\n"
99 " }\n"
100 " else if (uAlphaTestComparison == 7) ;\n"
101 "#else\n"
59 " gl_FragColor = vColor;\n" 102 " gl_FragColor = vColor;\n"
103 "#endif //GL_ES\n"
104 "#else\n"
105 " gl_FragColor = vColor;\n"
106 "#endif //ALPHA_TEST_ENABLED\n"
60 " \n" 107 " \n"
61 "#ifdef FOG_ENABLED\n" 108 "#ifdef FOG_ENABLED\n"
62 " float z = gl_FragCoord.z / gl_FragCoord.w;\n" 109 " float z = gl_FragCoord.z / gl_FragCoord.w;\n"
@@ -129,17 +176,21 @@ static const char diffuse_frag_glsl[] =
129 "#ifdef DIFFUSE_TEXTURE\n" 176 "#ifdef DIFFUSE_TEXTURE\n"
130 "uniform sampler2D uTextureDiffuse0;\n" 177 "uniform sampler2D uTextureDiffuse0;\n"
131 "uniform mat3 uTextureMatrixTransformDiffuse0;\n" 178 "uniform mat3 uTextureMatrixTransformDiffuse0;\n"
132 "vec3 Tex0CoordDiffuse = \n" 179 "vec3 Tex0CoordDiffuse =\n"
133 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformDiffuse0;\n" 180 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformDiffuse0;\n"
134 "#endif //DIFFUSE_TEXTURE\n" 181 "#endif //DIFFUSE_TEXTURE\n"
135 "#ifdef DIFFUSE_TEXTURE_BLEND\n" 182 "#ifdef DIFFUSE_TEXTURE_BLEND\n"
136 "uniform sampler2D uTextureDiffuse1;\n" 183 "uniform sampler2D uTextureDiffuse1;\n"
137 "uniform float uTextureDiffuseWeight;\n" 184 "uniform float uTextureDiffuseWeight;\n"
138 "uniform mat3 uTextureMatrixTransformDiffuse1;\n" 185 "uniform mat3 uTextureMatrixTransformDiffuse1;\n"
139 "vec3 Tex1CoordDiffuse = \n" 186 "vec3 Tex1CoordDiffuse =\n"
140 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformDiffuse1;\n" 187 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformDiffuse1;\n"
141 "#endif //DIFFUSE_TEXTURE_BLEND\n" 188 "#endif //DIFFUSE_TEXTURE_BLEND\n"
142 "#endif //DIFFUSE\n" 189 "#endif //DIFFUSE\n"
190 "#ifdef GL_ES\n"
191 "uniform int uAlphaTestComparison;\n"
192 "uniform float uAlphaTestRefValue;\n"
193 "#endif //GL_ES\n"
143 "void main() {\n" 194 "void main() {\n"
144 " vec4 color;\n" 195 " vec4 color;\n"
145 " \n" 196 " \n"
@@ -154,7 +205,50 @@ static const char diffuse_frag_glsl[] =
154 " color = uMaterialDiffuse;\n" 205 " color = uMaterialDiffuse;\n"
155 "#endif //DIFFUSE_TEXTURE\n" 206 "#endif //DIFFUSE_TEXTURE\n"
156 "#endif //DIFFUSE_TEXTURE_BLEND\n" 207 "#endif //DIFFUSE_TEXTURE_BLEND\n"
208 "#ifdef ALPHA_TEST_ENABLED\n"
209 " #ifdef GL_ES\n"
210 "/*uAlphaTestComparison is value of the Evas_3D_Comparison type*/\n"
211 " const float p = 1000000.0;\n"
212 " float acolor = floor(color.a * p);\n"
213 " float refvalue = floor(uAlphaTestRefValue * p);\n"
214 " if (uAlphaTestComparison == 0) discard;\n"
215 " else if (uAlphaTestComparison == 1)\n"
216 " {\n"
217 " if (acolor < refvalue) gl_FragColor = color;\n"
218 " else discard;\n"
219 " }\n"
220 " else if (uAlphaTestComparison == 2)\n"
221 " {\n"
222 " if (acolor == refvalue) gl_FragColor = color;\n"
223 " else discard;\n"
224 " }\n"
225 " else if (uAlphaTestComparison == 3)\n"
226 " {\n"
227 " if (acolor <= refvalue) gl_FragColor = color;\n"
228 " else discard;\n"
229 " }\n"
230 " else if (uAlphaTestComparison == 4)\n"
231 " {\n"
232 " if (acolor > refvalue) gl_FragColor = color;\n"
233 " else discard;\n"
234 " }\n"
235 " else if (uAlphaTestComparison == 5)\n"
236 " {\n"
237 " if (acolor != refvalue) gl_FragColor = color;\n"
238 " else discard;\n"
239 " }\n"
240 " else if (uAlphaTestComparison == 6)\n"
241 " {\n"
242 " if (acolor >= refvalue) gl_FragColor = color;\n"
243 " else discard;\n"
244 " }\n"
245 " else if (uAlphaTestComparison == 7) ;\n"
246 "#else\n"
247 " gl_FragColor = color;\n"
248 "#endif //GL_ES\n"
249 "#else\n"
157 " gl_FragColor = color;\n" 250 " gl_FragColor = color;\n"
251 "#endif //ALPHA_TEST_ENABLED\n"
158 " \n" 252 " \n"
159 "#ifdef FOG_ENABLED\n" 253 "#ifdef FOG_ENABLED\n"
160 " float z = gl_FragCoord.z / gl_FragCoord.w;\n" 254 " float z = gl_FragCoord.z / gl_FragCoord.w;\n"
@@ -309,6 +403,7 @@ static const char flat_frag_glsl[] =
309 "float shadow;\n" 403 "float shadow;\n"
310 "float pcf(vec4 lpos, float size)\n" 404 "float pcf(vec4 lpos, float size)\n"
311 " {\n" 405 " {\n"
406 "#ifndef GL_ES\n"
312 " vec3 smcoord = lpos.xyz / lpos.w * 0.5 + 0.5;\n" 407 " vec3 smcoord = lpos.xyz / lpos.w * 0.5 + 0.5;\n"
313 " float i, j, randx, randy, shadow;\n" 408 " float i, j, randx, randy, shadow;\n"
314 " shadow = 0.0;\n" 409 " shadow = 0.0;\n"
@@ -316,6 +411,10 @@ static const char flat_frag_glsl[] =
316 " for (j = -4.0; j < 4.0; j++)\n" 411 " for (j = -4.0; j < 4.0; j++)\n"
317 " shadow += float(smcoord.z <= texture2D(uShadowMap, smcoord.xy + vec2(i / 8.0, j / 8.0) * size).x);\n" 412 " shadow += float(smcoord.z <= texture2D(uShadowMap, smcoord.xy + vec2(i / 8.0, j / 8.0) * size).x);\n"
318 " return shadow / 64.0;\n" 413 " return shadow / 64.0;\n"
414 "#else\n"
415 " /*TODO Add algorithm generate shadow*/\n"
416 " return 1.0;\n"
417 "#endif //GL_ES\n"
319 "}\n" 418 "}\n"
320 "#endif //SHADOWED\n" 419 "#endif //SHADOWED\n"
321 "#ifdef DIFFUSE\n" 420 "#ifdef DIFFUSE\n"
@@ -324,14 +423,14 @@ static const char flat_frag_glsl[] =
324 "#ifdef DIFFUSE_TEXTURE\n" 423 "#ifdef DIFFUSE_TEXTURE\n"
325 "uniform sampler2D uTextureDiffuse0;\n" 424 "uniform sampler2D uTextureDiffuse0;\n"
326 "uniform mat3 uTextureMatrixTransformDiffuse0;\n" 425 "uniform mat3 uTextureMatrixTransformDiffuse0;\n"
327 "vec3 Tex0CoordDiffuse = \n" 426 "vec3 Tex0CoordDiffuse =\n"
328 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformDiffuse0;\n" 427 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformDiffuse0;\n"
329 "#endif //DIFFUSE_TEXTURE\n" 428 "#endif //DIFFUSE_TEXTURE\n"
330 "#ifdef DIFFUSE_TEXTURE_BLEND\n" 429 "#ifdef DIFFUSE_TEXTURE_BLEND\n"
331 "uniform sampler2D uTextureDiffuse1;\n" 430 "uniform sampler2D uTextureDiffuse1;\n"
332 "uniform float uTextureDiffuseWeight;\n" 431 "uniform float uTextureDiffuseWeight;\n"
333 "uniform mat3 uTextureMatrixTransformDiffuse1;\n" 432 "uniform mat3 uTextureMatrixTransformDiffuse1;\n"
334 "vec3 Tex1CoordDiffuse = \n" 433 "vec3 Tex1CoordDiffuse =\n"
335 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformDiffuse1;\n" 434 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformDiffuse1;\n"
336 "#endif //DIFFUSE_TEXTURE_BLEND\n" 435 "#endif //DIFFUSE_TEXTURE_BLEND\n"
337 "#endif //DIFFUSE\n" 436 "#endif //DIFFUSE\n"
@@ -342,14 +441,14 @@ static const char flat_frag_glsl[] =
342 "#ifdef SPECULAR_TEXTURE\n" 441 "#ifdef SPECULAR_TEXTURE\n"
343 "uniform sampler2D uTextureSpecular0;\n" 442 "uniform sampler2D uTextureSpecular0;\n"
344 "uniform mat3 uTextureMatrixTransformSpecular0;\n" 443 "uniform mat3 uTextureMatrixTransformSpecular0;\n"
345 "vec3 Tex0CoordSpecular = \n" 444 "vec3 Tex0CoordSpecular =\n"
346 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformSpecular0;\n" 445 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformSpecular0;\n"
347 "#endif //SPECULAR_TEXTURE\n" 446 "#endif //SPECULAR_TEXTURE\n"
348 "#ifdef SPECULAR_TEXTURE_BLEND\n" 447 "#ifdef SPECULAR_TEXTURE_BLEND\n"
349 "uniform sampler2D uTextureSpecular1;\n" 448 "uniform sampler2D uTextureSpecular1;\n"
350 "uniform float uTextureSpecularWeight;\n" 449 "uniform float uTextureSpecularWeight;\n"
351 "uniform mat3 uTextureMatrixTransformSpecular1;\n" 450 "uniform mat3 uTextureMatrixTransformSpecular1;\n"
352 "vec3 Tex1CoordSpecular = \n" 451 "vec3 Tex1CoordSpecular =\n"
353 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformSpecular1;\n" 452 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformSpecular1;\n"
354 "#endif //SPECULAR_TEXTURE_BLEND\n" 453 "#endif //SPECULAR_TEXTURE_BLEND\n"
355 "#endif //SPECULAR\n" 454 "#endif //SPECULAR\n"
@@ -359,14 +458,14 @@ static const char flat_frag_glsl[] =
359 "#ifdef AMBIENT_TEXTURE\n" 458 "#ifdef AMBIENT_TEXTURE\n"
360 "uniform sampler2D uTextureAmbient0;\n" 459 "uniform sampler2D uTextureAmbient0;\n"
361 "uniform mat3 uTextureMatrixTransformAmbient0;\n" 460 "uniform mat3 uTextureMatrixTransformAmbient0;\n"
362 "vec3 Tex0CoordAmbient = \n" 461 "vec3 Tex0CoordAmbient =\n"
363 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformAmbient0;\n" 462 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformAmbient0;\n"
364 "#endif //AMBIENT_TEXTURE\n" 463 "#endif //AMBIENT_TEXTURE\n"
365 "#ifdef AMBIENT_TEXTURE_BLEND\n" 464 "#ifdef AMBIENT_TEXTURE_BLEND\n"
366 "uniform sampler2D uTextureAmbient1;\n" 465 "uniform sampler2D uTextureAmbient1;\n"
367 "uniform float uTextureAmbientWeight;\n" 466 "uniform float uTextureAmbientWeight;\n"
368 "uniform mat3 uTextureMatrixTransformAmbient1;\n" 467 "uniform mat3 uTextureMatrixTransformAmbient1;\n"
369 "vec3 Tex1CoordAmbient = \n" 468 "vec3 Tex1CoordAmbient =\n"
370 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformAmbient1;\n" 469 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformAmbient1;\n"
371 "#endif //AMBIENT_TEXTURE_BLEND\n" 470 "#endif //AMBIENT_TEXTURE_BLEND\n"
372 "#endif //AMBIENT\n" 471 "#endif //AMBIENT\n"
@@ -375,20 +474,25 @@ static const char flat_frag_glsl[] =
375 "#ifdef EMISSION_TEXTURE\n" 474 "#ifdef EMISSION_TEXTURE\n"
376 "uniform sampler2D uTextureEmission0;\n" 475 "uniform sampler2D uTextureEmission0;\n"
377 "uniform mat3 uTextureMatrixTransformEmission0;\n" 476 "uniform mat3 uTextureMatrixTransformEmission0;\n"
378 "vec3 Tex0CoordEmission = \n" 477 "vec3 Tex0CoordEmission =\n"
379 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformEmission0;\n" 478 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformEmission0;\n"
380 "#endif //EMISSION_TEXTURE\n" 479 "#endif //EMISSION_TEXTURE\n"
381 "#ifdef EMISSION_TEXTURE_BLEND\n" 480 "#ifdef EMISSION_TEXTURE_BLEND\n"
382 "uniform sampler2D uTextureEmission1;\n" 481 "uniform sampler2D uTextureEmission1;\n"
383 "uniform float uTextureEmissionWeight;\n" 482 "uniform float uTextureEmissionWeight;\n"
384 "uniform mat3 uTextureMatrixTransformEmission1;\n" 483 "uniform mat3 uTextureMatrixTransformEmission1;\n"
385 "vec3 Tex1CoordEmission = \n" 484 "vec3 Tex1CoordEmission =\n"
386 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformEmission1;\n" 485 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformEmission1;\n"
387 "#endif //EMISSION_TEXTURE_BLEND\n" 486 "#endif //EMISSION_TEXTURE_BLEND\n"
388 "#endif //EMISSION\n" 487 "#endif //EMISSION\n"
389 "void fragmentFlat()\n" 488 "#ifdef GL_ES\n"
489 "uniform int uAlphaTestComparison;\n"
490 "uniform float uAlphaTestRefValue;\n"
491 "#endif //GL_ES\n"
492 "vec4 fragmentFlat()\n"
390 "{\n" 493 "{\n"
391 " vec4 color;\n" 494 " vec4 color;\n"
495 " vec4 fragcolor;\n"
392 "#ifdef DIFFUSE\n" 496 "#ifdef DIFFUSE\n"
393 " \n" 497 " \n"
394 "#ifdef DIFFUSE_TEXTURE_BLEND\n" 498 "#ifdef DIFFUSE_TEXTURE_BLEND\n"
@@ -402,9 +506,9 @@ static const char flat_frag_glsl[] =
402 " color = uMaterialDiffuse;\n" 506 " color = uMaterialDiffuse;\n"
403 "#endif //DIFFUSE_TEXTURE\n" 507 "#endif //DIFFUSE_TEXTURE\n"
404 "#endif //DIFFUSE_TEXTURE_BLEND\n" 508 "#endif //DIFFUSE_TEXTURE_BLEND\n"
405 " gl_FragColor = uLightDiffuse * color * vFactor.x;\n" 509 " fragcolor = uLightDiffuse * color * vFactor.x;\n"
406 "#else\n" 510 "#else\n"
407 " gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n" 511 " fragcolor = vec4(0.0, 0.0, 0.0, 0.0);\n"
408 "#endif //DIFFUSE\n" 512 "#endif //DIFFUSE\n"
409 "#ifdef SPECULAR\n" 513 "#ifdef SPECULAR\n"
410 " \n" 514 " \n"
@@ -419,10 +523,10 @@ static const char flat_frag_glsl[] =
419 " color = uMaterialSpecular;\n" 523 " color = uMaterialSpecular;\n"
420 "#endif //SPECULAR_TEXTURE\n" 524 "#endif //SPECULAR_TEXTURE\n"
421 "#endif //SPECULAR_TEXTURE_BLEND\n" 525 "#endif //SPECULAR_TEXTURE_BLEND\n"
422 " gl_FragColor += uLightSpecular * color * vFactor.y;\n" 526 " fragcolor += uLightSpecular * color * vFactor.y;\n"
423 "#endif //SPECULAR\n" 527 "#endif //SPECULAR\n"
424 "#ifdef SHADOWED\n" 528 "#ifdef SHADOWED\n"
425 " gl_FragColor *= shadow;\n" 529 " fragcolor *= shadow;\n"
426 "#endif //SHADOWED\n" 530 "#endif //SHADOWED\n"
427 "#ifdef AMBIENT\n" 531 "#ifdef AMBIENT\n"
428 " \n" 532 " \n"
@@ -437,7 +541,7 @@ static const char flat_frag_glsl[] =
437 " color = uMaterialAmbient;\n" 541 " color = uMaterialAmbient;\n"
438 "#endif //AMBIENT_TEXTURE\n" 542 "#endif //AMBIENT_TEXTURE\n"
439 "#endif //AMBIENT_TEXTURE_BLEND\n" 543 "#endif //AMBIENT_TEXTURE_BLEND\n"
440 " gl_FragColor += uLightAmbient * color;\n" 544 " fragcolor += uLightAmbient * color;\n"
441 "#endif //AMBIENT\n" 545 "#endif //AMBIENT\n"
442 "#ifdef EMISSION\n" 546 "#ifdef EMISSION\n"
443 " \n" 547 " \n"
@@ -452,14 +556,60 @@ static const char flat_frag_glsl[] =
452 " color = uMaterialEmission;\n" 556 " color = uMaterialEmission;\n"
453 "#endif //EMISSION_TEXTURE\n" 557 "#endif //EMISSION_TEXTURE\n"
454 "#endif //EMISSION_TEXTURE_BLEND\n" 558 "#endif //EMISSION_TEXTURE_BLEND\n"
455 " gl_FragColor += color;\n" 559 " fragcolor += color;\n"
456 "#endif //EMISSION\n" 560 "#endif //EMISSION\n"
561 " return fragcolor;\n"
457 "}\n" 562 "}\n"
458 "void main() {\n" 563 "void main() {\n"
564 " vec4 color;\n"
459 "#ifdef SHADOWED\n" 565 "#ifdef SHADOWED\n"
460 " shadow = pcf(vLightPosition, 1.0 / 200.0);\n" 566 " shadow = pcf(vLightPosition, 1.0 / 200.0);\n"
461 "#endif //SHADOWED\n" 567 "#endif //SHADOWED\n"
462 " fragmentFlat();\n" 568 " color = fragmentFlat();\n"
569 "#ifdef ALPHA_TEST_ENABLED\n"
570 " #ifdef GL_ES\n"
571 "/*uAlphaTestComparison is value of the Evas_3D_Comparison type*/\n"
572 " const float p = 1000000.0;\n"
573 " float acolor = floor(color.a * p);\n"
574 " float refvalue = floor(uAlphaTestRefValue * p);\n"
575 " if (uAlphaTestComparison == 0) discard;\n"
576 " else if (uAlphaTestComparison == 1)\n"
577 " {\n"
578 " if (acolor < refvalue) gl_FragColor = color;\n"
579 " else discard;\n"
580 " }\n"
581 " else if (uAlphaTestComparison == 2)\n"
582 " {\n"
583 " if (acolor == refvalue) gl_FragColor = color;\n"
584 " else discard;\n"
585 " }\n"
586 " else if (uAlphaTestComparison == 3)\n"
587 " {\n"
588 " if (acolor <= refvalue) gl_FragColor = color;\n"
589 " else discard;\n"
590 " }\n"
591 " else if (uAlphaTestComparison == 4)\n"
592 " {\n"
593 " if (acolor > refvalue) gl_FragColor = color;\n"
594 " else discard;\n"
595 " }\n"
596 " else if (uAlphaTestComparison == 5)\n"
597 " {\n"
598 " if (acolor != refvalue) gl_FragColor = color;\n"
599 " else discard;\n"
600 " }\n"
601 " else if (uAlphaTestComparison == 6)\n"
602 " {\n"
603 " if (acolor >= refvalue) gl_FragColor = color;\n"
604 " else discard;\n"
605 " }\n"
606 " else if (uAlphaTestComparison == 7) ;\n"
607 "#else\n"
608 " gl_FragColor = color;\n"
609 "#endif //GL_ES\n"
610 "#else\n"
611 " gl_FragColor = color;\n"
612 "#endif //ALPHA_TEST_ENABLED\n"
463 " \n" 613 " \n"
464 "#ifdef FOG_ENABLED\n" 614 "#ifdef FOG_ENABLED\n"
465 " float z = gl_FragCoord.z / gl_FragCoord.w;\n" 615 " float z = gl_FragCoord.z / gl_FragCoord.w;\n"
@@ -584,6 +734,7 @@ static const char phong_frag_glsl[] =
584 "float shadow;\n" 734 "float shadow;\n"
585 "float pcf(vec4 lpos, float size)\n" 735 "float pcf(vec4 lpos, float size)\n"
586 " {\n" 736 " {\n"
737 "#ifndef GL_ES\n"
587 " vec3 smcoord = lpos.xyz / lpos.w * 0.5 + 0.5;\n" 738 " vec3 smcoord = lpos.xyz / lpos.w * 0.5 + 0.5;\n"
588 " float i, j, randx, randy, shadow;\n" 739 " float i, j, randx, randy, shadow;\n"
589 " shadow = 0.0;\n" 740 " shadow = 0.0;\n"
@@ -591,6 +742,10 @@ static const char phong_frag_glsl[] =
591 " for (j = -4.0; j < 4.0; j++)\n" 742 " for (j = -4.0; j < 4.0; j++)\n"
592 " shadow += float(smcoord.z <= texture2D(uShadowMap, smcoord.xy + vec2(i / 8.0, j / 8.0) * size).x);\n" 743 " shadow += float(smcoord.z <= texture2D(uShadowMap, smcoord.xy + vec2(i / 8.0, j / 8.0) * size).x);\n"
593 " return shadow / 64.0;\n" 744 " return shadow / 64.0;\n"
745 "#else\n"
746 " /*TODO Add algorithm generate shadow*/\n"
747 " return 1.0;\n"
748 "#endif //GL_ES\n"
594 "}\n" 749 "}\n"
595 "#endif //SHADOWED\n" 750 "#endif //SHADOWED\n"
596 "#ifdef DIFFUSE\n" 751 "#ifdef DIFFUSE\n"
@@ -599,14 +754,14 @@ static const char phong_frag_glsl[] =
599 "#ifdef DIFFUSE_TEXTURE\n" 754 "#ifdef DIFFUSE_TEXTURE\n"
600 "uniform sampler2D uTextureDiffuse0;\n" 755 "uniform sampler2D uTextureDiffuse0;\n"
601 "uniform mat3 uTextureMatrixTransformDiffuse0;\n" 756 "uniform mat3 uTextureMatrixTransformDiffuse0;\n"
602 "vec3 Tex0CoordDiffuse = \n" 757 "vec3 Tex0CoordDiffuse =\n"
603 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformDiffuse0;\n" 758 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformDiffuse0;\n"
604 "#endif //DIFFUSE_TEXTURE\n" 759 "#endif //DIFFUSE_TEXTURE\n"
605 "#ifdef DIFFUSE_TEXTURE_BLEND\n" 760 "#ifdef DIFFUSE_TEXTURE_BLEND\n"
606 "uniform sampler2D uTextureDiffuse1;\n" 761 "uniform sampler2D uTextureDiffuse1;\n"
607 "uniform float uTextureDiffuseWeight;\n" 762 "uniform float uTextureDiffuseWeight;\n"
608 "uniform mat3 uTextureMatrixTransformDiffuse1;\n" 763 "uniform mat3 uTextureMatrixTransformDiffuse1;\n"
609 "vec3 Tex1CoordDiffuse = \n" 764 "vec3 Tex1CoordDiffuse =\n"
610 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformDiffuse1;\n" 765 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformDiffuse1;\n"
611 "#endif //DIFFUSE_TEXTURE_BLEND\n" 766 "#endif //DIFFUSE_TEXTURE_BLEND\n"
612 "#endif //DIFFUSE\n" 767 "#endif //DIFFUSE\n"
@@ -617,14 +772,14 @@ static const char phong_frag_glsl[] =
617 "#ifdef SPECULAR_TEXTURE\n" 772 "#ifdef SPECULAR_TEXTURE\n"
618 "uniform sampler2D uTextureSpecular0;\n" 773 "uniform sampler2D uTextureSpecular0;\n"
619 "uniform mat3 uTextureMatrixTransformSpecular0;\n" 774 "uniform mat3 uTextureMatrixTransformSpecular0;\n"
620 "vec3 Tex0CoordSpecular = \n" 775 "vec3 Tex0CoordSpecular =\n"
621 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformSpecular0;\n" 776 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformSpecular0;\n"
622 "#endif //SPECULAR_TEXTURE\n" 777 "#endif //SPECULAR_TEXTURE\n"
623 "#ifdef SPECULAR_TEXTURE_BLEND\n" 778 "#ifdef SPECULAR_TEXTURE_BLEND\n"
624 "uniform sampler2D uTextureSpecular1;\n" 779 "uniform sampler2D uTextureSpecular1;\n"
625 "uniform float uTextureSpecularWeight;\n" 780 "uniform float uTextureSpecularWeight;\n"
626 "uniform mat3 uTextureMatrixTransformSpecular1;\n" 781 "uniform mat3 uTextureMatrixTransformSpecular1;\n"
627 "vec3 Tex1CoordSpecular = \n" 782 "vec3 Tex1CoordSpecular =\n"
628 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformSpecular1;\n" 783 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformSpecular1;\n"
629 "#endif //SPECULAR_TEXTURE_BLEND\n" 784 "#endif //SPECULAR_TEXTURE_BLEND\n"
630 "#endif //SPECULAR\n" 785 "#endif //SPECULAR\n"
@@ -634,14 +789,14 @@ static const char phong_frag_glsl[] =
634 "#ifdef AMBIENT_TEXTURE\n" 789 "#ifdef AMBIENT_TEXTURE\n"
635 "uniform sampler2D uTextureAmbient0;\n" 790 "uniform sampler2D uTextureAmbient0;\n"
636 "uniform mat3 uTextureMatrixTransformAmbient0;\n" 791 "uniform mat3 uTextureMatrixTransformAmbient0;\n"
637 "vec3 Tex0CoordAmbient = \n" 792 "vec3 Tex0CoordAmbient =\n"
638 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformAmbient0;\n" 793 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformAmbient0;\n"
639 "#endif //AMBIENT_TEXTURE\n" 794 "#endif //AMBIENT_TEXTURE\n"
640 "#ifdef AMBIENT_TEXTURE_BLEND\n" 795 "#ifdef AMBIENT_TEXTURE_BLEND\n"
641 "uniform sampler2D uTextureAmbient1;\n" 796 "uniform sampler2D uTextureAmbient1;\n"
642 "uniform float uTextureAmbientWeight;\n" 797 "uniform float uTextureAmbientWeight;\n"
643 "uniform mat3 uTextureMatrixTransformAmbient1;\n" 798 "uniform mat3 uTextureMatrixTransformAmbient1;\n"
644 "vec3 Tex1CoordAmbient = \n" 799 "vec3 Tex1CoordAmbient =\n"
645 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformAmbient1;\n" 800 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformAmbient1;\n"
646 "#endif //AMBIENT_TEXTURE_BLEND\n" 801 "#endif //AMBIENT_TEXTURE_BLEND\n"
647 "#endif //AMBIENT\n" 802 "#endif //AMBIENT\n"
@@ -650,14 +805,14 @@ static const char phong_frag_glsl[] =
650 "#ifdef EMISSION_TEXTURE\n" 805 "#ifdef EMISSION_TEXTURE\n"
651 "uniform sampler2D uTextureEmission0;\n" 806 "uniform sampler2D uTextureEmission0;\n"
652 "uniform mat3 uTextureMatrixTransformEmission0;\n" 807 "uniform mat3 uTextureMatrixTransformEmission0;\n"
653 "vec3 Tex0CoordEmission = \n" 808 "vec3 Tex0CoordEmission =\n"
654 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformEmission0;\n" 809 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformEmission0;\n"
655 "#endif //EMISSION_TEXTURE\n" 810 "#endif //EMISSION_TEXTURE\n"
656 "#ifdef EMISSION_TEXTURE_BLEND\n" 811 "#ifdef EMISSION_TEXTURE_BLEND\n"
657 "uniform sampler2D uTextureEmission1;\n" 812 "uniform sampler2D uTextureEmission1;\n"
658 "uniform float uTextureEmissionWeight;\n" 813 "uniform float uTextureEmissionWeight;\n"
659 "uniform mat3 uTextureMatrixTransformEmission1;\n" 814 "uniform mat3 uTextureMatrixTransformEmission1;\n"
660 "vec3 Tex1CoordEmission = \n" 815 "vec3 Tex1CoordEmission =\n"
661 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformEmission1;\n" 816 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformEmission1;\n"
662 "#endif //EMISSION_TEXTURE_BLEND\n" 817 "#endif //EMISSION_TEXTURE_BLEND\n"
663 "#endif //EMISSION\n" 818 "#endif //EMISSION\n"
@@ -669,12 +824,17 @@ static const char phong_frag_glsl[] =
669 "#ifdef LIGHT_ATTENUATION\n" 824 "#ifdef LIGHT_ATTENUATION\n"
670 "varying float vLightDist;\n" 825 "varying float vLightDist;\n"
671 "#endif //LIGHT_ATTENUATION\n" 826 "#endif //LIGHT_ATTENUATION\n"
672 "void fragmentPhong()\n" 827 "#ifdef GL_ES\n"
828 "uniform int uAlphaTestComparison;\n"
829 "uniform float uAlphaTestRefValue;\n"
830 "#endif //GL_ES\n"
831 "vec4 fragmentPhong()\n"
673 "{\n" 832 "{\n"
674 " vec3 normal = normalize(vNormal);\n" 833 " vec3 normal = normalize(vNormal);\n"
675 " vec3 lv = normalize(vLightVector);\n" 834 " vec3 lv = normalize(vLightVector);\n"
676 " float factor = dot(lv, normal);\n" 835 " float factor = dot(lv, normal);\n"
677 " vec4 color;\n" 836 " vec4 color;\n"
837 " vec4 fragcolor;\n"
678 "#ifdef LIGHT_SPOT\n" 838 "#ifdef LIGHT_SPOT\n"
679 " float f = dot(-lv, normalize(uLightSpotDir));\n" 839 " float f = dot(-lv, normalize(uLightSpotDir));\n"
680 " if (f > uLightSpotCutoffCos)\n" 840 " if (f > uLightSpotCutoffCos)\n"
@@ -698,9 +858,9 @@ static const char phong_frag_glsl[] =
698 " color = uMaterialDiffuse;\n" 858 " color = uMaterialDiffuse;\n"
699 "#endif //DIFFUSE_TEXTURE\n" 859 "#endif //DIFFUSE_TEXTURE\n"
700 "#endif //DIFFUSE_TEXTURE_BLEND\n" 860 "#endif //DIFFUSE_TEXTURE_BLEND\n"
701 " gl_FragColor = uLightDiffuse * color * factor;\n" 861 " fragcolor = uLightDiffuse * color * factor;\n"
702 "#else\n" 862 "#else\n"
703 " gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n" 863 " fragcolor = vec4(0.0, 0.0, 0.0, 0.0);\n"
704 "#endif //DIFFUSE\n" 864 "#endif //DIFFUSE\n"
705 " /* Specular term. */\n" 865 " /* Specular term. */\n"
706 "#ifdef SPECULAR\n" 866 "#ifdef SPECULAR\n"
@@ -720,14 +880,14 @@ static const char phong_frag_glsl[] =
720 " color = uMaterialSpecular;\n" 880 " color = uMaterialSpecular;\n"
721 "#endif //SPECULAR_TEXTURE\n" 881 "#endif //SPECULAR_TEXTURE\n"
722 "#endif //SPECULAR_TEXTURE_BLEND\n" 882 "#endif //SPECULAR_TEXTURE_BLEND\n"
723 " gl_FragColor += uLightSpecular * color * factor;\n" 883 " fragcolor += uLightSpecular * color * factor;\n"
724 " }\n" 884 " }\n"
725 "#endif\n" 885 "#endif\n"
726 " }\n" 886 " }\n"
727 " else\n" 887 " else\n"
728 " gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n" 888 " fragcolor = vec4(0.0, 0.0, 0.0, 0.0);\n"
729 "#ifdef SHADOWED\n" 889 "#ifdef SHADOWED\n"
730 " gl_FragColor *= shadow;\n" 890 " fragcolor *= shadow;\n"
731 "#endif //SHADOWED\n" 891 "#endif //SHADOWED\n"
732 "#ifdef AMBIENT\n" 892 "#ifdef AMBIENT\n"
733 " \n" 893 " \n"
@@ -742,11 +902,11 @@ static const char phong_frag_glsl[] =
742 " color = uMaterialAmbient;\n" 902 " color = uMaterialAmbient;\n"
743 "#endif //AMBIENT_TEXTURE\n" 903 "#endif //AMBIENT_TEXTURE\n"
744 "#endif //AMBIENT_TEXTURE_BLEND\n" 904 "#endif //AMBIENT_TEXTURE_BLEND\n"
745 " gl_FragColor += uLightAmbient * color;\n" 905 " fragcolor += uLightAmbient * color;\n"
746 "#endif\n" 906 "#endif\n"
747 " /* Light attenuation. */\n" 907 " /* Light attenuation. */\n"
748 "#ifdef LIGHT_ATTENUATION\n" 908 "#ifdef LIGHT_ATTENUATION\n"
749 " gl_FragColor /= dot(uLightAtten, vec3(1.0, vLightDist, vLightDist * vLightDist));\n" 909 " fragcolor /= dot(uLightAtten, vec3(1.0, vLightDist, vLightDist * vLightDist));\n"
750 "#endif\n" 910 "#endif\n"
751 " /* Emission term. */\n" 911 " /* Emission term. */\n"
752 "#ifdef EMISSION\n" 912 "#ifdef EMISSION\n"
@@ -762,15 +922,61 @@ static const char phong_frag_glsl[] =
762 " color = uMaterialEmission;\n" 922 " color = uMaterialEmission;\n"
763 "#endif //EMISSION_TEXTURE\n" 923 "#endif //EMISSION_TEXTURE\n"
764 "#endif //EMISSION_TEXTURE_BLEND\n" 924 "#endif //EMISSION_TEXTURE_BLEND\n"
765 " gl_FragColor += color;\n" 925 " fragcolor += color;\n"
766 "#endif\n" 926 "#endif\n"
927 " return fragcolor;\n"
767 "}\n" 928 "}\n"
768 "void main()\n" 929 "void main()\n"
769 "{\n" 930 "{\n"
931 " vec4 color;\n"
770 "#ifdef SHADOWED\n" 932 "#ifdef SHADOWED\n"
771 " shadow = pcf(vLightPosition, 1.0 / 300.0);\n" 933 " shadow = pcf(vLightPosition, 1.0 / 300.0);\n"
772 "#endif //SHADOWED\n" 934 "#endif //SHADOWED\n"
773 " fragmentPhong();\n" 935 " color = fragmentPhong();\n"
936 "#ifdef ALPHA_TEST_ENABLED\n"
937 " #ifdef GL_ES\n"
938 "/*uAlphaTestComparison is value of the Evas_3D_Comparison type*/\n"
939 " const float p = 1000000.0;\n"
940 " float acolor = floor(color.a * p);\n"
941 " float refvalue = floor(uAlphaTestRefValue * p);\n"
942 " if (uAlphaTestComparison == 0) discard;\n"
943 " else if (uAlphaTestComparison == 1)\n"
944 " {\n"
945 " if (acolor < refvalue) gl_FragColor = color;\n"
946 " else discard;\n"
947 " }\n"
948 " else if (uAlphaTestComparison == 2)\n"
949 " {\n"
950 " if (acolor == refvalue) gl_FragColor = color;\n"
951 " else discard;\n"
952 " }\n"
953 " else if (uAlphaTestComparison == 3)\n"
954 " {\n"
955 " if (acolor <= refvalue) gl_FragColor = color;\n"
956 " else discard;\n"
957 " }\n"
958 " else if (uAlphaTestComparison == 4)\n"
959 " {\n"
960 " if (acolor > refvalue) gl_FragColor = color;\n"
961 " else discard;\n"
962 " }\n"
963 " else if (uAlphaTestComparison == 5)\n"
964 " {\n"
965 " if (acolor != refvalue) gl_FragColor = color;\n"
966 " else discard;\n"
967 " }\n"
968 " else if (uAlphaTestComparison == 6)\n"
969 " {\n"
970 " if (acolor >= refvalue) gl_FragColor = color;\n"
971 " else discard;\n"
972 " }\n"
973 " else if (uAlphaTestComparison == 7) ;\n"
974 "#else\n"
975 " gl_FragColor = color;\n"
976 "#endif //GL_ES\n"
977 "#else\n"
978 " gl_FragColor = color;\n"
979 "#endif //ALPHA_TEST_ENABLED\n"
774 " \n" 980 " \n"
775 "#ifdef FOG_ENABLED\n" 981 "#ifdef FOG_ENABLED\n"
776 " float z = gl_FragCoord.z / gl_FragCoord.w;\n" 982 " float z = gl_FragCoord.z / gl_FragCoord.w;\n"
@@ -952,6 +1158,7 @@ static const char normal_map_frag_glsl[] =
952 "float shadow;\n" 1158 "float shadow;\n"
953 "float pcf(vec4 lpos, float size)\n" 1159 "float pcf(vec4 lpos, float size)\n"
954 " {\n" 1160 " {\n"
1161 "#ifndef GL_ES\n"
955 " vec3 smcoord = lpos.xyz / lpos.w * 0.5 + 0.5;\n" 1162 " vec3 smcoord = lpos.xyz / lpos.w * 0.5 + 0.5;\n"
956 " float i, j, randx, randy, shadow;\n" 1163 " float i, j, randx, randy, shadow;\n"
957 " shadow = 0.0;\n" 1164 " shadow = 0.0;\n"
@@ -959,21 +1166,29 @@ static const char normal_map_frag_glsl[] =
959 " for (j = -4.0; j < 4.0; j++)\n" 1166 " for (j = -4.0; j < 4.0; j++)\n"
960 " shadow += float(smcoord.z <= texture2D(uShadowMap, smcoord.xy + vec2(i / 8.0, j / 8.0) * size).x);\n" 1167 " shadow += float(smcoord.z <= texture2D(uShadowMap, smcoord.xy + vec2(i / 8.0, j / 8.0) * size).x);\n"
961 " return shadow / 64.0;\n" 1168 " return shadow / 64.0;\n"
1169 "#else\n"
1170 " /*TODO Add algorithm generate shadow*/\n"
1171 " return 1.0;\n"
1172 "#endif //GL_ES\n"
962 "}\n" 1173 "}\n"
963 "#endif //SHADOWED\n" 1174 "#endif //SHADOWED\n"
964 "#ifdef NORMAL_TEXTURE\n" 1175 "#ifdef NORMAL_TEXTURE\n"
965 "uniform sampler2D uTextureNormal0;\n" 1176 "uniform sampler2D uTextureNormal0;\n"
966 "uniform mat3 uTextureMatrixTransformNormal0;\n" 1177 "uniform mat3 uTextureMatrixTransformNormal0;\n"
967 "vec3 Tex0CoordNormal = \n" 1178 "vec3 Tex0CoordNormal =\n"
968 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformNormal0;\n" 1179 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformNormal0;\n"
969 "#endif //NORMAL_TEXTURE\n" 1180 "#endif //NORMAL_TEXTURE\n"
970 "#ifdef NORMAL_TEXTURE_BLEND\n" 1181 "#ifdef NORMAL_TEXTURE_BLEND\n"
971 "uniform sampler2D uTextureNormal1;\n" 1182 "uniform sampler2D uTextureNormal1;\n"
972 "uniform float uTextureNormalWeight;\n" 1183 "uniform float uTextureNormalWeight;\n"
973 "uniform mat3 uTextureMatrixTransformNormal1;\n" 1184 "uniform mat3 uTextureMatrixTransformNormal1;\n"
974 "vec3 Tex1CoordNormal = \n" 1185 "vec3 Tex1CoordNormal =\n"
975 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformNormal1;\n" 1186 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformNormal1;\n"
976 "#endif //NORMAL_TEXTURE_BLEND\n" 1187 "#endif //NORMAL_TEXTURE_BLEND\n"
1188 "#ifdef GL_ES\n"
1189 "uniform int uAlphaTestComparison;\n"
1190 "uniform float uAlphaTestRefValue;\n"
1191 "#endif //GL_ES\n"
977 "#ifndef VERTEX_TANGENT\n" 1192 "#ifndef VERTEX_TANGENT\n"
978 "varying vec3 vNormal;\n" 1193 "varying vec3 vNormal;\n"
979 "#endif //VERTEX_TANGENT\n" 1194 "#endif //VERTEX_TANGENT\n"
@@ -983,14 +1198,14 @@ static const char normal_map_frag_glsl[] =
983 "#ifdef DIFFUSE_TEXTURE\n" 1198 "#ifdef DIFFUSE_TEXTURE\n"
984 "uniform sampler2D uTextureDiffuse0;\n" 1199 "uniform sampler2D uTextureDiffuse0;\n"
985 "uniform mat3 uTextureMatrixTransformDiffuse0;\n" 1200 "uniform mat3 uTextureMatrixTransformDiffuse0;\n"
986 "vec3 Tex0CoordDiffuse = \n" 1201 "vec3 Tex0CoordDiffuse =\n"
987 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformDiffuse0;\n" 1202 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformDiffuse0;\n"
988 "#endif //DIFFUSE_TEXTURE\n" 1203 "#endif //DIFFUSE_TEXTURE\n"
989 "#ifdef DIFFUSE_TEXTURE_BLEND\n" 1204 "#ifdef DIFFUSE_TEXTURE_BLEND\n"
990 "uniform sampler2D uTextureDiffuse1;\n" 1205 "uniform sampler2D uTextureDiffuse1;\n"
991 "uniform float uTextureDiffuseWeight;\n" 1206 "uniform float uTextureDiffuseWeight;\n"
992 "uniform mat3 uTextureMatrixTransformDiffuse1;\n" 1207 "uniform mat3 uTextureMatrixTransformDiffuse1;\n"
993 "vec3 Tex1CoordDiffuse = \n" 1208 "vec3 Tex1CoordDiffuse =\n"
994 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformDiffuse1;\n" 1209 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformDiffuse1;\n"
995 "#endif //DIFFUSE_TEXTURE_BLEND\n" 1210 "#endif //DIFFUSE_TEXTURE_BLEND\n"
996 "#endif //DIFFUSE\n" 1211 "#endif //DIFFUSE\n"
@@ -1001,14 +1216,14 @@ static const char normal_map_frag_glsl[] =
1001 "#ifdef SPECULAR_TEXTURE\n" 1216 "#ifdef SPECULAR_TEXTURE\n"
1002 "uniform sampler2D uTextureSpecular0;\n" 1217 "uniform sampler2D uTextureSpecular0;\n"
1003 "uniform mat3 uTextureMatrixTransformSpecular0;\n" 1218 "uniform mat3 uTextureMatrixTransformSpecular0;\n"
1004 "vec3 Tex0CoordSpecular = \n" 1219 "vec3 Tex0CoordSpecular =\n"
1005 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformSpecular0;\n" 1220 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformSpecular0;\n"
1006 "#endif //SPECULAR_TEXTURE\n" 1221 "#endif //SPECULAR_TEXTURE\n"
1007 "#ifdef SPECULAR_TEXTURE_BLEND\n" 1222 "#ifdef SPECULAR_TEXTURE_BLEND\n"
1008 "uniform sampler2D uTextureSpecular1;\n" 1223 "uniform sampler2D uTextureSpecular1;\n"
1009 "uniform float uTextureSpecularWeight;\n" 1224 "uniform float uTextureSpecularWeight;\n"
1010 "uniform mat3 uTextureMatrixTransformSpecular1;\n" 1225 "uniform mat3 uTextureMatrixTransformSpecular1;\n"
1011 "vec3 Tex1CoordSpecular = \n" 1226 "vec3 Tex1CoordSpecular =\n"
1012 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformSpecular1;\n" 1227 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformSpecular1;\n"
1013 "#endif //SPECULAR_TEXTURE_BLEND\n" 1228 "#endif //SPECULAR_TEXTURE_BLEND\n"
1014 "#endif //SPECULAR\n" 1229 "#endif //SPECULAR\n"
@@ -1018,14 +1233,14 @@ static const char normal_map_frag_glsl[] =
1018 "#ifdef AMBIENT_TEXTURE\n" 1233 "#ifdef AMBIENT_TEXTURE\n"
1019 "uniform sampler2D uTextureAmbient0;\n" 1234 "uniform sampler2D uTextureAmbient0;\n"
1020 "uniform mat3 uTextureMatrixTransformAmbient0;\n" 1235 "uniform mat3 uTextureMatrixTransformAmbient0;\n"
1021 "vec3 Tex0CoordAmbient = \n" 1236 "vec3 Tex0CoordAmbient =\n"
1022 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformAmbient0;\n" 1237 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformAmbient0;\n"
1023 "#endif //AMBIENT_TEXTURE\n" 1238 "#endif //AMBIENT_TEXTURE\n"
1024 "#ifdef AMBIENT_TEXTURE_BLEND\n" 1239 "#ifdef AMBIENT_TEXTURE_BLEND\n"
1025 "uniform sampler2D uTextureAmbient1;\n" 1240 "uniform sampler2D uTextureAmbient1;\n"
1026 "uniform float uTextureAmbientWeight;\n" 1241 "uniform float uTextureAmbientWeight;\n"
1027 "uniform mat3 uTextureMatrixTransformAmbient1;\n" 1242 "uniform mat3 uTextureMatrixTransformAmbient1;\n"
1028 "vec3 Tex1CoordAmbient = \n" 1243 "vec3 Tex1CoordAmbient =\n"
1029 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformAmbient1;\n" 1244 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformAmbient1;\n"
1030 "#endif //AMBIENT_TEXTURE_BLEND\n" 1245 "#endif //AMBIENT_TEXTURE_BLEND\n"
1031 "#endif //AMBIENT\n" 1246 "#endif //AMBIENT\n"
@@ -1034,14 +1249,14 @@ static const char normal_map_frag_glsl[] =
1034 "#ifdef EMISSION_TEXTURE\n" 1249 "#ifdef EMISSION_TEXTURE\n"
1035 "uniform sampler2D uTextureEmission0;\n" 1250 "uniform sampler2D uTextureEmission0;\n"
1036 "uniform mat3 uTextureMatrixTransformEmission0;\n" 1251 "uniform mat3 uTextureMatrixTransformEmission0;\n"
1037 "vec3 Tex0CoordEmission = \n" 1252 "vec3 Tex0CoordEmission =\n"
1038 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformEmission0;\n" 1253 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformEmission0;\n"
1039 "#endif //EMISSION_TEXTURE\n" 1254 "#endif //EMISSION_TEXTURE\n"
1040 "#ifdef EMISSION_TEXTURE_BLEND\n" 1255 "#ifdef EMISSION_TEXTURE_BLEND\n"
1041 "uniform sampler2D uTextureEmission1;\n" 1256 "uniform sampler2D uTextureEmission1;\n"
1042 "uniform float uTextureEmissionWeight;\n" 1257 "uniform float uTextureEmissionWeight;\n"
1043 "uniform mat3 uTextureMatrixTransformEmission1;\n" 1258 "uniform mat3 uTextureMatrixTransformEmission1;\n"
1044 "vec3 Tex1CoordEmission = \n" 1259 "vec3 Tex1CoordEmission =\n"
1045 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformEmission1;\n" 1260 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformEmission1;\n"
1046 "#endif //EMISSION_TEXTURE_BLEND\n" 1261 "#endif //EMISSION_TEXTURE_BLEND\n"
1047 "#endif //EMISSION\n" 1262 "#endif //EMISSION\n"
@@ -1073,11 +1288,12 @@ static const char normal_map_frag_glsl[] =
1073 " return normalize(tbn * normal);\n" 1288 " return normalize(tbn * normal);\n"
1074 "}\n" 1289 "}\n"
1075 "#endif //VERTEX_TANGENT\n" 1290 "#endif //VERTEX_TANGENT\n"
1076 "void fragmentNormalMap()\n" 1291 "vec4 fragmentNormalMap()\n"
1077 "{\n" 1292 "{\n"
1078 " float factor;\n" 1293 " float factor;\n"
1079 " vec3 normal;\n" 1294 " vec3 normal;\n"
1080 " vec4 color;\n" 1295 " vec4 color;\n"
1296 " vec4 fragcolor;\n"
1081 "#ifdef NORMAL_TEXTURE_BLEND\n" 1297 "#ifdef NORMAL_TEXTURE_BLEND\n"
1082 " normal = texture2D(uTextureNormal0, vec2(Tex0CoordNormal)).rgb * uTextureNormalWeight / texture2D(uTextureNormal0, vec2(Tex0CoordNormal)).a;\n" 1298 " normal = texture2D(uTextureNormal0, vec2(Tex0CoordNormal)).rgb * uTextureNormalWeight / texture2D(uTextureNormal0, vec2(Tex0CoordNormal)).a;\n"
1083 " normal += texture2D(uTextureNormal1, vec2(Tex1CoordNormal)).rgb / texture2D(uTextureNormal1, vec2(Tex1CoordNormal)).a *\n" 1299 " normal += texture2D(uTextureNormal1, vec2(Tex1CoordNormal)).rgb / texture2D(uTextureNormal1, vec2(Tex1CoordNormal)).a *\n"
@@ -1114,9 +1330,9 @@ static const char normal_map_frag_glsl[] =
1114 " color = uMaterialDiffuse;\n" 1330 " color = uMaterialDiffuse;\n"
1115 "#endif //DIFFUSE_TEXTURE\n" 1331 "#endif //DIFFUSE_TEXTURE\n"
1116 "#endif //DIFFUSE_TEXTURE_BLEND\n" 1332 "#endif //DIFFUSE_TEXTURE_BLEND\n"
1117 " gl_FragColor = uLightDiffuse * color * factor;\n" 1333 " fragcolor = uLightDiffuse * color * factor;\n"
1118 "#else\n" 1334 "#else\n"
1119 " gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n" 1335 " fragcolor = vec4(0.0, 0.0, 0.0, 0.0);\n"
1120 "#endif //DIFFUSE\n" 1336 "#endif //DIFFUSE\n"
1121 "#ifdef SPECULAR\n" 1337 "#ifdef SPECULAR\n"
1122 " factor = dot(normalize(vLightHalfVector), normal);\n" 1338 " factor = dot(normalize(vLightHalfVector), normal);\n"
@@ -1135,15 +1351,15 @@ static const char normal_map_frag_glsl[] =
1135 " color = uMaterialSpecular;\n" 1351 " color = uMaterialSpecular;\n"
1136 "#endif //SPECULAR_TEXTURE\n" 1352 "#endif //SPECULAR_TEXTURE\n"
1137 "#endif //SPECULAR_TEXTURE_BLEND\n" 1353 "#endif //SPECULAR_TEXTURE_BLEND\n"
1138 " gl_FragColor += uLightSpecular * color * factor;\n" 1354 " fragcolor += uLightSpecular * color * factor;\n"
1139 " }\n" 1355 " }\n"
1140 "#endif //SPECULAR\n" 1356 "#endif //SPECULAR\n"
1141 "#ifdef SHADOWED\n" 1357 "#ifdef SHADOWED\n"
1142 " gl_FragColor *= shadow;\n" 1358 " fragcolor *= shadow;\n"
1143 "#endif //SHADOWED\n" 1359 "#endif //SHADOWED\n"
1144 " }\n" 1360 " }\n"
1145 " else\n" 1361 " else\n"
1146 " gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n" 1362 " fragcolor = vec4(0.0, 0.0, 0.0, 0.0);\n"
1147 "#ifdef AMBIENT\n" 1363 "#ifdef AMBIENT\n"
1148 " \n" 1364 " \n"
1149 "#ifdef AMBIENT_TEXTURE_BLEND\n" 1365 "#ifdef AMBIENT_TEXTURE_BLEND\n"
@@ -1157,10 +1373,10 @@ static const char normal_map_frag_glsl[] =
1157 " color = uMaterialAmbient;\n" 1373 " color = uMaterialAmbient;\n"
1158 "#endif //AMBIENT_TEXTURE\n" 1374 "#endif //AMBIENT_TEXTURE\n"
1159 "#endif //AMBIENT_TEXTURE_BLEND\n" 1375 "#endif //AMBIENT_TEXTURE_BLEND\n"
1160 " gl_FragColor += uLightAmbient * color;\n" 1376 " fragcolor += uLightAmbient * color;\n"
1161 "#endif //AMBIENT\n" 1377 "#endif //AMBIENT\n"
1162 "#ifdef LIGHT_ATTENUATION\n" 1378 "#ifdef LIGHT_ATTENUATION\n"
1163 " gl_FragColor /= dot(uLightAtten, vec3(1.0, vLightDist, vLightDist * vLightDist));\n" 1379 " fragcolor /= dot(uLightAtten, vec3(1.0, vLightDist, vLightDist * vLightDist));\n"
1164 "#endif //LIGHT_ATTENUATION\n" 1380 "#endif //LIGHT_ATTENUATION\n"
1165 "#ifdef EMISSION\n" 1381 "#ifdef EMISSION\n"
1166 " \n" 1382 " \n"
@@ -1175,14 +1391,60 @@ static const char normal_map_frag_glsl[] =
1175 " color = uMaterialEmission;\n" 1391 " color = uMaterialEmission;\n"
1176 "#endif //EMISSION_TEXTURE\n" 1392 "#endif //EMISSION_TEXTURE\n"
1177 "#endif //EMISSION_TEXTURE_BLEND\n" 1393 "#endif //EMISSION_TEXTURE_BLEND\n"
1178 " gl_FragColor += color;\n" 1394 " fragcolor += color;\n"
1179 "#endif //EMISSION\n" 1395 "#endif //EMISSION\n"
1396 " return fragcolor;\n"
1180 "}\n" 1397 "}\n"
1181 "void main() {\n" 1398 "void main() {\n"
1399 " vec4 color;\n"
1182 "#ifdef SHADOWED\n" 1400 "#ifdef SHADOWED\n"
1183 " shadow = pcf(vLightPosition, 1.0 / 200.0);\n" 1401 " shadow = pcf(vLightPosition, 1.0 / 200.0);\n"
1184 "#endif //SHADOWED\n" 1402 "#endif //SHADOWED\n"
1185 " fragmentNormalMap();\n" 1403 " color = fragmentNormalMap();\n"
1404 "#ifdef ALPHA_TEST_ENABLED\n"
1405 " #ifdef GL_ES\n"
1406 "/*uAlphaTestComparison is value of the Evas_3D_Comparison type*/\n"
1407 " const float p = 1000000.0;\n"
1408 " float acolor = floor(color.a * p);\n"
1409 " float refvalue = floor(uAlphaTestRefValue * p);\n"
1410 " if (uAlphaTestComparison == 0) discard;\n"
1411 " else if (uAlphaTestComparison == 1)\n"
1412 " {\n"
1413 " if (acolor < refvalue) gl_FragColor = color;\n"
1414 " else discard;\n"
1415 " }\n"
1416 " else if (uAlphaTestComparison == 2)\n"
1417 " {\n"
1418 " if (acolor == refvalue) gl_FragColor = color;\n"
1419 " else discard;\n"
1420 " }\n"
1421 " else if (uAlphaTestComparison == 3)\n"
1422 " {\n"
1423 " if (acolor <= refvalue) gl_FragColor = color;\n"
1424 " else discard;\n"
1425 " }\n"
1426 " else if (uAlphaTestComparison == 4)\n"
1427 " {\n"
1428 " if (acolor > refvalue) gl_FragColor = color;\n"
1429 " else discard;\n"
1430 " }\n"
1431 " else if (uAlphaTestComparison == 5)\n"
1432 " {\n"
1433 " if (acolor != refvalue) gl_FragColor = color;\n"
1434 " else discard;\n"
1435 " }\n"
1436 " else if (uAlphaTestComparison == 6)\n"
1437 " {\n"
1438 " if (acolor >= refvalue) gl_FragColor = color;\n"
1439 " else discard;\n"
1440 " }\n"
1441 " else if (uAlphaTestComparison == 7) ;\n"
1442 "#else\n"
1443 " gl_FragColor = color;\n"
1444 "#endif //GL_ES\n"
1445 "#else\n"
1446 " gl_FragColor = color;\n"
1447 "#endif //ALPHA_TEST_ENABLED\n"
1186 "#ifdef FOG_ENABLED\n" 1448 "#ifdef FOG_ENABLED\n"
1187 " float z = gl_FragCoord.z / gl_FragCoord.w;\n" 1449 " float z = gl_FragCoord.z / gl_FragCoord.w;\n"
1188 " float fogFactor = exp2(-uFogFactor * uFogFactor * z * z * 1.44);\n" 1450 " float fogFactor = exp2(-uFogFactor * uFogFactor * z * z * 1.44);\n"
@@ -1249,6 +1511,10 @@ static const char shadow_map_frag_glsl[] =
1249 "#ifdef NEED_TEX_COORD\n" 1511 "#ifdef NEED_TEX_COORD\n"
1250 "varying vec2 vTexCoord;\n" 1512 "varying vec2 vTexCoord;\n"
1251 "#endif //TEX_COORD\n" 1513 "#endif //TEX_COORD\n"
1514 "#ifdef GL_ES\n"
1515 "uniform int uAlphaTestComparison;\n"
1516 "uniform float uAlphaTestRefValue;\n"
1517 "#endif //GL_ES\n"
1252 "#ifdef DIFFUSE\n" 1518 "#ifdef DIFFUSE\n"
1253 "#ifdef DIFFUSE_TEXTURE\n" 1519 "#ifdef DIFFUSE_TEXTURE\n"
1254 "uniform sampler2D uTextureDiffuse0;\n" 1520 "uniform sampler2D uTextureDiffuse0;\n"
@@ -1266,21 +1532,62 @@ static const char shadow_map_frag_glsl[] =
1266 "#endif //DIFFUSE\n" 1532 "#endif //DIFFUSE\n"
1267 "#endif //ALPHA_TEST_ENABLED\n" 1533 "#endif //ALPHA_TEST_ENABLED\n"
1268 "void main() {\n" 1534 "void main() {\n"
1535 " vec4 color;\n"
1269 "#ifndef NEED_TEX_COORD\n" 1536 "#ifndef NEED_TEX_COORD\n"
1270 " gl_FragColor = vec4(1);\n" 1537 " gl_FragColor = vec4(1);\n"
1271 "#endif\n" 1538 "#endif\n"
1272 "#ifdef ALPHA_TEST_ENABLED\n" 1539 "#ifdef ALPHA_TEST_ENABLED\n"
1273 "#ifdef DIFFUSE_TEXTURE_BLEND\n" 1540 "#ifdef DIFFUSE_TEXTURE_BLEND\n"
1274 " gl_FragColor = (texture2D(uTextureDiffuse0, vec2(Tex0CoordDiffuse)) *\n" 1541 " color = (texture2D(uTextureDiffuse0, vec2(Tex0CoordDiffuse)) *\n"
1275 " uTextureDiffuseWeight + texture2D(uTextureDiffuse1, vec2(Tex1CoordDiffuse)) *\n" 1542 " uTextureDiffuseWeight + texture2D(uTextureDiffuse1, vec2(Tex1CoordDiffuse)) *\n"
1276 " (1.0 - uTextureDiffuseWeight));\n" 1543 " (1.0 - uTextureDiffuseWeight));\n"
1277 "#else\n" 1544 "#else\n"
1278 "#ifdef DIFFUSE_TEXTURE\n" 1545 "#ifdef DIFFUSE_TEXTURE\n"
1279 " gl_FragColor = texture2D(uTextureDiffuse0, vec2(Tex0CoordDiffuse)) ;\n" 1546 " color = texture2D(uTextureDiffuse0, vec2(Tex0CoordDiffuse)) ;\n"
1280 "#else\n" 1547 "#else\n"
1281 " gl_FragColor = vec4(1);\n" 1548 " color = vec4(1);\n"
1282 "#endif //DIFFUSE_TEXTURE\n" 1549 "#endif //DIFFUSE_TEXTURE\n"
1283 "#endif //DIFFUSE_TEXTURE_BLEND\n" 1550 "#endif //DIFFUSE_TEXTURE_BLEND\n"
1551 " #ifdef GL_ES\n"
1552 "/*uAlphaTestComparison is value of the Evas_3D_Comparison type*/\n"
1553 " const float p = 1000000.0;\n"
1554 " float acolor = floor(color.a * p);\n"
1555 " float refvalue = floor(uAlphaTestRefValue * p);\n"
1556 " if (uAlphaTestComparison == 0) discard;\n"
1557 " else if (uAlphaTestComparison == 1)\n"
1558 " {\n"
1559 " if (acolor < refvalue) gl_FragColor = color;\n"
1560 " else discard;\n"
1561 " }\n"
1562 " else if (uAlphaTestComparison == 2)\n"
1563 " {\n"
1564 " if (acolor == refvalue) gl_FragColor = color;\n"
1565 " else discard;\n"
1566 " }\n"
1567 " else if (uAlphaTestComparison == 3)\n"
1568 " {\n"
1569 " if (acolor <= refvalue) gl_FragColor = color;\n"
1570 " else discard;\n"
1571 " }\n"
1572 " else if (uAlphaTestComparison == 4)\n"
1573 " {\n"
1574 " if (acolor > refvalue) gl_FragColor = color;\n"
1575 " else discard;\n"
1576 " }\n"
1577 " else if (uAlphaTestComparison == 5)\n"
1578 " {\n"
1579 " if (acolor != refvalue) gl_FragColor = color;\n"
1580 " else discard;\n"
1581 " }\n"
1582 " else if (uAlphaTestComparison == 6)\n"
1583 " {\n"
1584 " if (acolor >= refvalue) gl_FragColor = color;\n"
1585 " else discard;\n"
1586 " }\n"
1587 " else if (uAlphaTestComparison == 7) ;\n"
1588 "#else\n"
1589 " gl_FragColor = color;\n"
1590 "#endif //GL_ES\n"
1284 "#endif //ALPHA_TEST_ENABLED\n" 1591 "#endif //ALPHA_TEST_ENABLED\n"
1285 " gl_FragColor.r = gl_FragCoord.z;\n" 1592 " gl_FragColor.r = gl_FragCoord.z;\n"
1286 "}\n"; 1593 "}\n";
@@ -1319,9 +1626,57 @@ static const char color_pick_frag_glsl[] =
1319 "precision lowp sampler2D;\n" 1626 "precision lowp sampler2D;\n"
1320 "#endif\n" 1627 "#endif\n"
1321 "uniform float uColorPick;\n" 1628 "uniform float uColorPick;\n"
1629 "#ifdef GL_ES\n"
1630 "uniform int uAlphaTestComparison;\n"
1631 "uniform float uAlphaTestRefValue;\n"
1632 "#endif //GL_ES\n"
1322 "void main()\n" 1633 "void main()\n"
1323 "{\n" 1634 "{\n"
1324 " gl_FragColor = vec4(uColorPick);\n" 1635 " vec4 color = vec4(uColorPick);\n"
1636 "#ifdef ALPHA_TEST_ENABLED\n"
1637 " #ifdef GL_ES\n"
1638 "/*uAlphaTestComparison is value of the Evas_3D_Comparison type*/\n"
1639 " const float p = 1000000.0;\n"
1640 " float acolor = floor(color.a * p);\n"
1641 " float refvalue = floor(uAlphaTestRefValue * p);\n"
1642 " if (uAlphaTestComparison == 0) discard;\n"
1643 " else if (uAlphaTestComparison == 1)\n"
1644 " {\n"
1645 " if (acolor < refvalue) gl_FragColor = color;\n"
1646 " else discard;\n"
1647 " }\n"
1648 " else if (uAlphaTestComparison == 2)\n"
1649 " {\n"
1650 " if (acolor == refvalue) gl_FragColor = color;\n"
1651 " else discard;\n"
1652 " }\n"
1653 " else if (uAlphaTestComparison == 3)\n"
1654 " {\n"
1655 " if (acolor <= refvalue) gl_FragColor = color;\n"
1656 " else discard;\n"
1657 " }\n"
1658 " else if (uAlphaTestComparison == 4)\n"
1659 " {\n"
1660 " if (acolor > refvalue) gl_FragColor = color;\n"
1661 " else discard;\n"
1662 " }\n"
1663 " else if (uAlphaTestComparison == 5)\n"
1664 " {\n"
1665 " if (acolor != refvalue) gl_FragColor = color;\n"
1666 " else discard;\n"
1667 " }\n"
1668 " else if (uAlphaTestComparison == 6)\n"
1669 " {\n"
1670 " if (acolor >= refvalue) gl_FragColor = color;\n"
1671 " else discard;\n"
1672 " }\n"
1673 " else if (uAlphaTestComparison == 7) ;\n"
1674 "#else\n"
1675 " gl_FragColor = color;\n"
1676 "#endif //GL_ES\n"
1677 "#else\n"
1678 " gl_FragColor = color;\n"
1679 "#endif //ALPHA_TEST_ENABLED\n"
1325 "}\n"; 1680 "}\n";
1326 1681
1327static const char parallax_occlusion_vert_glsl[] = 1682static const char parallax_occlusion_vert_glsl[] =
@@ -1454,12 +1809,19 @@ static const char parallax_occlusion_frag_glsl[] =
1454 "varying vec3 vLightHalfVector;\n" 1809 "varying vec3 vLightHalfVector;\n"
1455 "varying vec3 vEyeVector;\n" 1810 "varying vec3 vEyeVector;\n"
1456 "uniform sampler2D uTextureNormal0;\n" 1811 "uniform sampler2D uTextureNormal0;\n"
1457 "uniform mat3 uTextureMatrixTransformNormal0;\n" 1812 "uniform mat3 uTextureMatrixTransformNormal0;\n"
1458 "#ifdef NEED_TEX_COORD\n" 1813 "#ifdef NEED_TEX_COORD\n"
1459 "varying vec2 vTexCoord;\n" 1814 "varying vec2 vTexCoord;\n"
1460 "vec3 Tex0CoordNormal = \n" 1815 "vec3 Tex0CoordNormal =\n"
1461 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformNormal0;\n" 1816 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformNormal0;\n"
1462 "#endif //TEX_COORD\n" 1817 "#endif //TEX_COORD\n"
1818 "#ifdef NORMAL_TEXTURE_BLEND\n"
1819 "uniform sampler2D uTextureNormal1;\n"
1820 "uniform float uTextureNormalWeight;\n"
1821 "uniform mat3 uTextureMatrixTransformNormal1;\n"
1822 "vec3 Tex1CoordNormal =\n"
1823 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformNormal1;\n"
1824 "#endif //NORMAL_TEXTURE_BLEND\n"
1463 "#ifdef FOG_ENABLED\n" 1825 "#ifdef FOG_ENABLED\n"
1464 "uniform float uFogFactor;\n" 1826 "uniform float uFogFactor;\n"
1465 "uniform vec4 uFogColor;\n" 1827 "uniform vec4 uFogColor;\n"
@@ -1470,6 +1832,7 @@ static const char parallax_occlusion_frag_glsl[] =
1470 "float shadow;\n" 1832 "float shadow;\n"
1471 "float pcf(vec4 lpos, float size)\n" 1833 "float pcf(vec4 lpos, float size)\n"
1472 " {\n" 1834 " {\n"
1835 "#ifndef GL_ES\n"
1473 " vec3 smcoord = lpos.xyz / lpos.w * 0.5 + 0.5;\n" 1836 " vec3 smcoord = lpos.xyz / lpos.w * 0.5 + 0.5;\n"
1474 " float i, j, randx, randy, shadow;\n" 1837 " float i, j, randx, randy, shadow;\n"
1475 " shadow = 0.0;\n" 1838 " shadow = 0.0;\n"
@@ -1477,29 +1840,26 @@ static const char parallax_occlusion_frag_glsl[] =
1477 " for (j = -4.0; j < 4.0; j++)\n" 1840 " for (j = -4.0; j < 4.0; j++)\n"
1478 " shadow += float(smcoord.z <= texture2D(uShadowMap, smcoord.xy + vec2(i / 8.0, j / 8.0) * size).x);\n" 1841 " shadow += float(smcoord.z <= texture2D(uShadowMap, smcoord.xy + vec2(i / 8.0, j / 8.0) * size).x);\n"
1479 " return shadow / 64.0;\n" 1842 " return shadow / 64.0;\n"
1843 "#else\n"
1844 " /*TODO Add algorithm generate shadow*/\n"
1845 " return 1.0;\n"
1846 "#endif //GL_ES\n"
1480 "}\n" 1847 "}\n"
1481 "#endif //SHADOWED\n" 1848 "#endif //SHADOWED\n"
1482 "#ifdef NORMAL_TEXTURE_BLEND\n"
1483 "uniform sampler2D uTextureNormal1;\n"
1484 "uniform float uTextureNormalWeight;\n"
1485 "uniform mat3 uTextureMatrixTransformNormal1;\n"
1486 "vec3 Tex1CoordNormal = \n"
1487 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformNormal1;\n"
1488 "#endif //NORMAL_TEXTURE_BLEND\n"
1489 "#ifdef DIFFUSE\n" 1849 "#ifdef DIFFUSE\n"
1490 "uniform vec4 uMaterialDiffuse;\n" 1850 "uniform vec4 uMaterialDiffuse;\n"
1491 "uniform vec4 uLightDiffuse;\n" 1851 "uniform vec4 uLightDiffuse;\n"
1492 "#ifdef DIFFUSE_TEXTURE\n" 1852 "#ifdef DIFFUSE_TEXTURE\n"
1493 "uniform sampler2D uTextureDiffuse0;\n" 1853 "uniform sampler2D uTextureDiffuse0;\n"
1494 "uniform mat3 uTextureMatrixTransformDiffuse0;\n" 1854 "uniform mat3 uTextureMatrixTransformDiffuse0;\n"
1495 "vec3 Tex0CoordDiffuse = \n" 1855 "vec3 Tex0CoordDiffuse =\n"
1496 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformDiffuse0;\n" 1856 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformDiffuse0;\n"
1497 "#endif //DIFFUSE_TEXTURE\n" 1857 "#endif //DIFFUSE_TEXTURE\n"
1498 "#ifdef DIFFUSE_TEXTURE_BLEND\n" 1858 "#ifdef DIFFUSE_TEXTURE_BLEND\n"
1499 "uniform sampler2D uTextureDiffuse1;\n" 1859 "uniform sampler2D uTextureDiffuse1;\n"
1500 "uniform float uTextureDiffuseWeight;\n" 1860 "uniform float uTextureDiffuseWeight;\n"
1501 "uniform mat3 uTextureMatrixTransformDiffuse1;\n" 1861 "uniform mat3 uTextureMatrixTransformDiffuse1;\n"
1502 "vec3 Tex1CoordDiffuse = \n" 1862 "vec3 Tex1CoordDiffuse =\n"
1503 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformDiffuse1;\n" 1863 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformDiffuse1;\n"
1504 "#endif //DIFFUSE_TEXTURE_BLEND\n" 1864 "#endif //DIFFUSE_TEXTURE_BLEND\n"
1505 "#endif //DIFFUSE\n" 1865 "#endif //DIFFUSE\n"
@@ -1510,14 +1870,14 @@ static const char parallax_occlusion_frag_glsl[] =
1510 "#ifdef SPECULAR_TEXTURE\n" 1870 "#ifdef SPECULAR_TEXTURE\n"
1511 "uniform sampler2D uTextureSpecular0;\n" 1871 "uniform sampler2D uTextureSpecular0;\n"
1512 "uniform mat3 uTextureMatrixTransformSpecular0;\n" 1872 "uniform mat3 uTextureMatrixTransformSpecular0;\n"
1513 "vec3 Tex0CoordSpecular = \n" 1873 "vec3 Tex0CoordSpecular =\n"
1514 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformSpecular0;\n" 1874 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformSpecular0;\n"
1515 "#endif //SPECULAR_TEXTURE\n" 1875 "#endif //SPECULAR_TEXTURE\n"
1516 "#ifdef SPECULAR_TEXTURE_BLEND\n" 1876 "#ifdef SPECULAR_TEXTURE_BLEND\n"
1517 "uniform sampler2D uTextureSpecular1;\n" 1877 "uniform sampler2D uTextureSpecular1;\n"
1518 "uniform float uTextureSpecularWeight;\n" 1878 "uniform float uTextureSpecularWeight;\n"
1519 "uniform mat3 uTextureMatrixTransformSpecular1;\n" 1879 "uniform mat3 uTextureMatrixTransformSpecular1;\n"
1520 "vec3 Tex1CoordSpecular = \n" 1880 "vec3 Tex1CoordSpecular =\n"
1521 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformSpecular1;\n" 1881 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformSpecular1;\n"
1522 "#endif //SPECULAR_TEXTURE_BLEND\n" 1882 "#endif //SPECULAR_TEXTURE_BLEND\n"
1523 "#endif //SPECULAR\n" 1883 "#endif //SPECULAR\n"
@@ -1527,14 +1887,14 @@ static const char parallax_occlusion_frag_glsl[] =
1527 "#ifdef AMBIENT_TEXTURE\n" 1887 "#ifdef AMBIENT_TEXTURE\n"
1528 "uniform sampler2D uTextureAmbient0;\n" 1888 "uniform sampler2D uTextureAmbient0;\n"
1529 "uniform mat3 uTextureMatrixTransformAmbient0;\n" 1889 "uniform mat3 uTextureMatrixTransformAmbient0;\n"
1530 "vec3 Tex0CoordAmbient = \n" 1890 "vec3 Tex0CoordAmbient =\n"
1531 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformAmbient0;\n" 1891 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformAmbient0;\n"
1532 "#endif //AMBIENT_TEXTURE\n" 1892 "#endif //AMBIENT_TEXTURE\n"
1533 "#ifdef AMBIENT_TEXTURE_BLEND\n" 1893 "#ifdef AMBIENT_TEXTURE_BLEND\n"
1534 "uniform sampler2D uTextureAmbient1;\n" 1894 "uniform sampler2D uTextureAmbient1;\n"
1535 "uniform float uTextureAmbientWeight;\n" 1895 "uniform float uTextureAmbientWeight;\n"
1536 "uniform mat3 uTextureMatrixTransformAmbient1;\n" 1896 "uniform mat3 uTextureMatrixTransformAmbient1;\n"
1537 "vec3 Tex1CoordAmbient = \n" 1897 "vec3 Tex1CoordAmbient =\n"
1538 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformAmbient1;\n" 1898 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformAmbient1;\n"
1539 "#endif //AMBIENT_TEXTURE_BLEND\n" 1899 "#endif //AMBIENT_TEXTURE_BLEND\n"
1540 "#endif //AMBIENT\n" 1900 "#endif //AMBIENT\n"
@@ -1543,14 +1903,14 @@ static const char parallax_occlusion_frag_glsl[] =
1543 "#ifdef EMISSION_TEXTURE\n" 1903 "#ifdef EMISSION_TEXTURE\n"
1544 "uniform sampler2D uTextureEmission0;\n" 1904 "uniform sampler2D uTextureEmission0;\n"
1545 "uniform mat3 uTextureMatrixTransformEmission0;\n" 1905 "uniform mat3 uTextureMatrixTransformEmission0;\n"
1546 "vec3 Tex0CoordEmission = \n" 1906 "vec3 Tex0CoordEmission =\n"
1547 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformEmission0;\n" 1907 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformEmission0;\n"
1548 "#endif //EMISSION_TEXTURE\n" 1908 "#endif //EMISSION_TEXTURE\n"
1549 "#ifdef EMISSION_TEXTURE_BLEND\n" 1909 "#ifdef EMISSION_TEXTURE_BLEND\n"
1550 "uniform sampler2D uTextureEmission1;\n" 1910 "uniform sampler2D uTextureEmission1;\n"
1551 "uniform float uTextureEmissionWeight;\n" 1911 "uniform float uTextureEmissionWeight;\n"
1552 "uniform mat3 uTextureMatrixTransformEmission1;\n" 1912 "uniform mat3 uTextureMatrixTransformEmission1;\n"
1553 "vec3 Tex1CoordEmission = \n" 1913 "vec3 Tex1CoordEmission =\n"
1554 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformEmission1;\n" 1914 " vec3(vTexCoord, 1.0) * uTextureMatrixTransformEmission1;\n"
1555 "#endif //EMISSION_TEXTURE_BLEND\n" 1915 "#endif //EMISSION_TEXTURE_BLEND\n"
1556 "#endif //EMISSION\n" 1916 "#endif //EMISSION\n"
@@ -1562,6 +1922,10 @@ static const char parallax_occlusion_frag_glsl[] =
1562 "#ifdef LIGHT_ATTENUATION\n" 1922 "#ifdef LIGHT_ATTENUATION\n"
1563 "varying float vLightDist;\n" 1923 "varying float vLightDist;\n"
1564 "#endif //LIGHT_ATTENUATION\n" 1924 "#endif //LIGHT_ATTENUATION\n"
1925 "#ifdef GL_ES\n"
1926 "uniform int uAlphaTestComparison;\n"
1927 "uniform float uAlphaTestRefValue;\n"
1928 "#endif //GL_ES\n"
1565 "const float parallaxScale = 0.2;\n" 1929 "const float parallaxScale = 0.2;\n"
1566 "vec2 parallaxMapping(in vec3 view, in vec2 tex, out float parallaxHeight)\n" 1930 "vec2 parallaxMapping(in vec3 view, in vec2 tex, out float parallaxHeight)\n"
1567 "{\n" 1931 "{\n"
@@ -1606,11 +1970,12 @@ static const char parallax_occlusion_frag_glsl[] =
1606 " parallaxHeight = curLayerHeight + prevH * weight + nextH * (1.0 - weight);\n" 1970 " parallaxHeight = curLayerHeight + prevH * weight + nextH * (1.0 - weight);\n"
1607 " return finalTexCoords;\n" 1971 " return finalTexCoords;\n"
1608 "}\n" 1972 "}\n"
1609 "void fragmentParallaxMap()\n" 1973 "vec4 fragmentParallaxMap()\n"
1610 "{\n" 1974 "{\n"
1611 " float factor;\n" 1975 " float factor;\n"
1612 " vec3 normal;\n" 1976 " vec3 normal;\n"
1613 " vec4 color;\n" 1977 " vec4 color;\n"
1978 " vec4 fragcolor;\n"
1614 " float parallaxHeight;\n" 1979 " float parallaxHeight;\n"
1615 " vec2 tex = parallaxMapping(vEyeVector, vec2(Tex0CoordNormal), parallaxHeight);\n" 1980 " vec2 tex = parallaxMapping(vEyeVector, vec2(Tex0CoordNormal), parallaxHeight);\n"
1616 " vec3 lv = normalize(vLightVector);\n" 1981 " vec3 lv = normalize(vLightVector);\n"
@@ -1644,9 +2009,9 @@ static const char parallax_occlusion_frag_glsl[] =
1644 " color = uMaterialDiffuse;\n" 2009 " color = uMaterialDiffuse;\n"
1645 "#endif //DIFFUSE_TEXTURE\n" 2010 "#endif //DIFFUSE_TEXTURE\n"
1646 "#endif //DIFFUSE_TEXTURE_BLEND\n" 2011 "#endif //DIFFUSE_TEXTURE_BLEND\n"
1647 " gl_FragColor = uLightDiffuse * color * factor;\n" 2012 " fragcolor = uLightDiffuse * color * factor;\n"
1648 "#else\n" 2013 "#else\n"
1649 " gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n" 2014 " fragcolor = vec4(0.0, 0.0, 0.0, 0.0);\n"
1650 "#endif //DIFFUSE\n" 2015 "#endif //DIFFUSE\n"
1651 "#ifdef SPECULAR\n" 2016 "#ifdef SPECULAR\n"
1652 " factor = dot(normalize(vLightHalfVector), normal);\n" 2017 " factor = dot(normalize(vLightHalfVector), normal);\n"
@@ -1663,15 +2028,15 @@ static const char parallax_occlusion_frag_glsl[] =
1663 " color = uMaterialSpecular;\n" 2028 " color = uMaterialSpecular;\n"
1664 "#endif //SPECULAR_TEXTURE\n" 2029 "#endif //SPECULAR_TEXTURE\n"
1665 "#endif //SPECULAR_TEXTURE_BLEND\n" 2030 "#endif //SPECULAR_TEXTURE_BLEND\n"
1666 " gl_FragColor += uLightSpecular * color * factor;\n" 2031 " fragcolor += uLightSpecular * color * factor;\n"
1667 " }\n" 2032 " }\n"
1668 "#endif //SPECULAR\n" 2033 "#endif //SPECULAR\n"
1669 "#ifdef SHADOWED\n" 2034 "#ifdef SHADOWED\n"
1670 " gl_FragColor *= shadow;\n" 2035 " fragcolor *= shadow;\n"
1671 "#endif //SHADOWED\n" 2036 "#endif //SHADOWED\n"
1672 " }\n" 2037 " }\n"
1673 " else\n" 2038 " else\n"
1674 " gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n" 2039 " fragcolor = vec4(0.0, 0.0, 0.0, 0.0);\n"
1675 "#ifdef AMBIENT\n" 2040 "#ifdef AMBIENT\n"
1676 "#ifdef AMBIENT_TEXTURE_BLEND\n" 2041 "#ifdef AMBIENT_TEXTURE_BLEND\n"
1677 " color = texture2D(uTextureAmbient0, tex) * uTextureAmbientWeight +\n" 2042 " color = texture2D(uTextureAmbient0, tex) * uTextureAmbientWeight +\n"
@@ -1683,10 +2048,10 @@ static const char parallax_occlusion_frag_glsl[] =
1683 " color = uMaterialAmbient;\n" 2048 " color = uMaterialAmbient;\n"
1684 "#endif //AMBIENT_TEXTURE\n" 2049 "#endif //AMBIENT_TEXTURE\n"
1685 "#endif //AMBIENT_TEXTURE_BLEND\n" 2050 "#endif //AMBIENT_TEXTURE_BLEND\n"
1686 " gl_FragColor += uLightAmbient * color;\n" 2051 " fragcolor += uLightAmbient * color;\n"
1687 "#endif //AMBIENT\n" 2052 "#endif //AMBIENT\n"
1688 "#ifdef LIGHT_ATTENUATION\n" 2053 "#ifdef LIGHT_ATTENUATION\n"
1689 " gl_FragColor /= dot(uLightAtten, vec3(1.0, vLightDist, vLightDist * vLightDist));\n" 2054 " fragcolor /= dot(uLightAtten, vec3(1.0, vLightDist, vLightDist * vLightDist));\n"
1690 "#endif //LIGHT_ATTENUATION\n" 2055 "#endif //LIGHT_ATTENUATION\n"
1691 "#ifdef EMISSION\n" 2056 "#ifdef EMISSION\n"
1692 "#ifdef EMISSION_TEXTURE_BLEND\n" 2057 "#ifdef EMISSION_TEXTURE_BLEND\n"
@@ -1699,14 +2064,60 @@ static const char parallax_occlusion_frag_glsl[] =
1699 " color = uMaterialEmission;\n" 2064 " color = uMaterialEmission;\n"
1700 "#endif //EMISSION_TEXTURE\n" 2065 "#endif //EMISSION_TEXTURE\n"
1701 "#endif //EMISSION_TEXTURE_BLEND\n" 2066 "#endif //EMISSION_TEXTURE_BLEND\n"
1702 " gl_FragColor += color;\n" 2067 " fragcolor += color;\n"
1703 "#endif //EMISSION\n" 2068 "#endif //EMISSION\n"
2069 " return fragcolor;\n"
1704 "}\n" 2070 "}\n"
1705 "void main() {\n" 2071 "void main() {\n"
2072 " vec4 color;\n"
1706 "#ifdef SHADOWED\n" 2073 "#ifdef SHADOWED\n"
1707 " shadow = pcf(vLightPosition, 1.0 / 200.0);\n" 2074 " shadow = pcf(vLightPosition, 1.0 / 200.0);\n"
1708 "#endif //SHADOWED\n" 2075 "#endif //SHADOWED\n"
1709 " fragmentParallaxMap();\n" 2076 " color = fragmentParallaxMap();\n"
2077 "#ifdef ALPHA_TEST_ENABLED\n"
2078 " #ifdef GL_ES\n"
2079 "/*uAlphaTestComparison is value of the Evas_3D_Comparison type*/\n"
2080 " const float p = 1000000.0;\n"
2081 " float acolor = floor(color.a * p);\n"
2082 " float refvalue = floor(uAlphaTestRefValue * p);\n"
2083 " if (uAlphaTestComparison == 0) discard;\n"
2084 " else if (uAlphaTestComparison == 1)\n"
2085 " {\n"
2086 " if (acolor < refvalue) gl_FragColor = color;\n"
2087 " else discard;\n"
2088 " }\n"
2089 " else if (uAlphaTestComparison == 2)\n"
2090 " {\n"
2091 " if (acolor == refvalue) gl_FragColor = color;\n"
2092 " else discard;\n"
2093 " }\n"
2094 " else if (uAlphaTestComparison == 3)\n"
2095 " {\n"
2096 " if (acolor <= refvalue) gl_FragColor = color;\n"
2097 " else discard;\n"
2098 " }\n"
2099 " else if (uAlphaTestComparison == 4)\n"
2100 " {\n"
2101 " if (acolor > refvalue) gl_FragColor = color;\n"
2102 " else discard;\n"
2103 " }\n"
2104 " else if (uAlphaTestComparison == 5)\n"
2105 " {\n"
2106 " if (acolor != refvalue) gl_FragColor = color;\n"
2107 " else discard;\n"
2108 " }\n"
2109 " else if (uAlphaTestComparison == 6)\n"
2110 " {\n"
2111 " if (acolor >= refvalue) gl_FragColor = color;\n"
2112 " else discard;\n"
2113 " }\n"
2114 " else if (uAlphaTestComparison == 7) ;\n"
2115 "#else\n"
2116 " gl_FragColor = color;\n"
2117 "#endif //GL_ES\n"
2118 "#else\n"
2119 " gl_FragColor = color;\n"
2120 "#endif //ALPHA_TEST_ENABLED\n"
1710 " \n" 2121 " \n"
1711 "#ifdef FOG_ENABLED\n" 2122 "#ifdef FOG_ENABLED\n"
1712 " float z = gl_FragCoord.z / gl_FragCoord.w;\n" 2123 " float z = gl_FragCoord.z / gl_FragCoord.w;\n"