evas: apparently some configuration can't generate this file correctly, so putting...
authorCedric BAIL <cedric@osg.samsung.com>
Thu, 19 Feb 2015 22:48:52 +0000 (23:48 +0100)
committerCedric BAIL <cedric@osg.samsung.com>
Thu, 19 Feb 2015 22:48:52 +0000 (23:48 +0100)
.gitignore
src/modules/evas/engines/gl_common/shader_3d/evas_gl_3d_shaders.x [new file with mode: 0644]

index 96345bf..4f04840 100644 (file)
@@ -67,5 +67,4 @@ tags
 /config.rpath
 /coverage
 /src/lib/ecore_x/ecore_x_vsync
-/src/modules/evas/engines/gl_common/shader_3d/evas_gl_3d_shaders.x
 Session.vim
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
new file mode 100644 (file)
index 0000000..f1d347e
--- /dev/null
@@ -0,0 +1,1128 @@
+/* DO NOT MODIFY THIS FILE AS IT IS AUTO-GENERATED
+ * See: modules/evas/engines/gl_common/shader_3d/gen_shaders_3d.sh */
+
+static const char const vertex_color_vert_glsl[] =
+   "uniform     mat4  uMatrixMvp;\n"
+   "varying     vec4  vColor;\n"
+   "#ifdef VERTEX_POSITION\n"
+   "attribute   vec4  aPosition0;\n"
+   "#endif //VERTEX_POSITION\n"
+   "#ifdef VERTEX_POSITION_BLEND\n"
+   "attribute   vec4  aPosition1;\n"
+   "uniform     float uPositionWeight;\n"
+   "#endif //VERTEX_POSITION_BLEND\n"
+   "#ifdef VERTEX_COLOR\n"
+   "attribute   vec4  aColor0;\n"
+   "#endif //VERTEX_COLOR\n"
+   "#ifdef VERTEX_COLOR_BLEND\n"
+   "attribute   vec4  aColor1;\n"
+   "uniform     float uColorWeight;\n"
+   "#endif //VERTEX_COLOR_BLEND\n"
+   "void main()\n"
+   "{\n"
+   "#ifdef VERTEX_POSITION_BLEND\n"
+   "   vec4 position = aPosition0 * uPositionWeight +\n"
+   "   aPosition1 * (1.0 - uPositionWeight);\n"
+   "   position = vec4(position.xyz, 1.0);\n"
+   "#else\n"
+   "#ifdef VERTEX_POSITION\n"
+   "   vec4 position = vec4(aPosition0.xyz, 1.0);\n"
+   "#endif // VERTEX_POSITION\n"
+   "#endif //VERTEX_POSITION_BLEND\n"
+   "#ifdef VERTEX_COLOR_BLEND\n"
+   "   vec4 color = aColor0 * uColorWeight + aColor1 * (1.0 - uColorWeight);\n"
+   "#else\n"
+   "#ifdef VERTEX_COLOR\n"
+   "   vec4 color = aColor0;\n"
+   "#endif //VERTEX_COLOR\n"
+   "#endif //VERTEX_COLOR_BLEND\n"
+   "   vColor = color;\n"
+   "   gl_Position = uMatrixMvp * position;\n"
+   "}\n";
+
+static const char const vertex_color_frag_glsl[] =
+   "varying  vec4        vColor;\n"
+   "#ifdef FOG_ENABLED\n"
+   "uniform float uFogFactor;\n"
+   "uniform vec4  uFogColor;\n"
+   "#endif //FOG_ENABLED\n"
+   "void main()\n"
+   "{\n"
+   "   gl_FragColor = vColor;\n"
+   "#ifdef FOG_ENABLED\n"
+   "   float z = gl_FragCoord.z / gl_FragCoord.w;\n"
+   "   float fogFactor = exp2( -uFogFactor * uFogFactor * z * z * 1.44);\n"
+   "   fogFactor = clamp(fogFactor, 0.0, 1.0);\n"
+   "   gl_FragColor = mix(uFogColor, gl_FragColor, fogFactor);\n"
+   "#endif //FOG_ENABLED\n"
+   "}\n";
+
+static const char const diffuse_vert_glsl[] =
+   "uniform mat4  uMatrixMvp;\n"
+   "#ifdef VERTEX_POSITION\n"
+   "attribute   vec4  aPosition0;\n"
+   "#endif //VERTEX_POSITION\n"
+   "#ifdef VERTEX_POSITION_BLEND\n"
+   "attribute   vec4  aPosition1;\n"
+   "uniform     float uPositionWeight;\n"
+   "#endif //VERTEX_POSITION_BLEND\n"
+   "#ifdef VERTEX_TEXCOORD\n"
+   "attribute   vec4  aTexCoord0;\n"
+   "#endif //VERTEX_TEXCOORD\n"
+   "#ifdef VERTEX_TEXCOORD_BLEND\n"
+   "attribute   vec4  aTexCoord1;\n"
+   "uniform     float uTexCoordWeight;\n"
+   "#endif //VERTEX_TEXCOORD_BLEND\n"
+   "#ifdef NEED_TEX_COORD\n"
+   "varying vec2 vTexCoord;\n"
+   "#endif //NEED_TEX_COORD\n"
+   "void main()\n"
+   "{\n"
+   "#ifdef VERTEX_POSITION_BLEND\n"
+   "   vec4 position = aPosition0 * uPositionWeight +\n"
+   "   aPosition1 * (1.0 - uPositionWeight);\n"
+   "   position = vec4(position.xyz, 1.0);\n"
+   "#else\n"
+   "#ifdef VERTEX_POSITION\n"
+   "   vec4 position = vec4(aPosition0.xyz, 1.0);\n"
+   "#endif // VERTEX_POSITION\n"
+   "#endif //VERTEX_POSITION_BLEND\n"
+   "#ifdef VERTEX_TEXCOORD_BLEND\n"
+   "   vTexCoord = aTexCoord0.st * uTexCoordWeight +\n"
+   "   aTexCoord1.st * (1.0 - uTexCoordWeight);\n"
+   "#else\n"
+   "#ifdef VERTEX_TEXCOORD\n"
+   "   vTexCoord = aTexCoord0.st;\n"
+   "#endif //VERTEX_TEXCOORD\n"
+   "#endif //VERTEX_TEXCOORD_BLEND\n"
+   "   gl_Position = uMatrixMvp * position;\n"
+   "}\n";
+
+static const char const diffuse_frag_glsl[] =
+   "#ifdef NEED_TEX_COORD\n"
+   "varying vec2   vTexCoord;\n"
+   "#endif //TEX_COORD\n"
+   "#ifdef FOG_ENABLED\n"
+   "uniform float uFogFactor;\n"
+   "uniform vec4  uFogColor;\n"
+   "#endif //FOG_ENABLED\n"
+   "#ifdef DIFFUSE\n"
+   "uniform   vec4        uMaterialDiffuse;\n"
+   "#ifdef DIFFUSE_TEXTURE\n"
+   "uniform sampler2D  uTextureDiffuse0;\n"
+   "#endif //DIFFUSE_TEXTURE\n"
+   "#ifdef DIFFUSE_TEXTURE_BLEND\n"
+   "uniform sampler2D  uTextureDiffuse1;\n"
+   "uniform float      uTextureDiffuseWeight;\n"
+   "#endif //DIFFUSE_TEXTURE_BLEND\n"
+   "#endif //DIFFUSE\n"
+   "void main() {\n"
+   "#ifdef DIFFUSE_TEXTURE_BLEND\n"
+   "   gl_FragColor = (texture2D(uTextureDiffuse0, vTexCoord) *\n"
+   "   uTextureDiffuseWeight + texture2D(uTextureDiffuse1, vTexCoord) *\n"
+   "   (1.0 - uTextureDiffuseWeight)) * uMaterialDiffuse;\n"
+   "#else\n"
+   "#ifdef DIFFUSE_TEXTURE\n"
+   "   gl_FragColor = texture2D(uTextureDiffuse0, vTexCoord) * uMaterialDiffuse;\n"
+   "#else\n"
+   "   gl_FragColor = uMaterialDiffuse;\n"
+   "#endif //DIFFUSE_TEXTURE\n"
+   "#endif //DIFFUSE_TEXTURE_BLEND\n"
+   "#ifdef FOG_ENABLED\n"
+   "   float z = gl_FragCoord.z / gl_FragCoord.w;\n"
+   "   float fogFactor = exp2( -uFogFactor * uFogFactor * z * z * 1.44);\n"
+   "   fogFactor = clamp(fogFactor, 0.0, 1.0);\n"
+   "   gl_FragColor = mix(uFogColor, gl_FragColor, fogFactor);\n"
+   "#endif //FOG_ENABLED\n"
+   "}\n";
+
+static const char const flat_vert_glsl[] =
+   "uniform   mat4  uMatrixMvp;\n"
+   "uniform   mat3  uMatrixNormal;\n"
+   "uniform   mat4  uMatrixModelview;\n"
+   "uniform   vec4  uLightPosition;\n"
+   "varying   vec2  vFactor;\n"
+   "#ifdef SHADOWED\n"
+   "uniform mat4 uMatrixLight;\n"
+   "varying vec4 vLightPosition;\n"
+   "#endif //SHADOWED\n"
+   "#ifdef VERTEX_POSITION\n"
+   "attribute   vec4  aPosition0;\n"
+   "#endif //VERTEX_POSITION\n"
+   "#ifdef VERTEX_POSITION_BLEND\n"
+   "attribute   vec4  aPosition1;\n"
+   "uniform     float uPositionWeight;\n"
+   "#endif //VERTEX_POSITION_BLEND\n"
+   "#ifdef VERTEX_NORMAL\n"
+   "attribute   vec4  aNormal0;\n"
+   "#endif //VERTEX_NORMAL\n"
+   "#ifdef VERTEX_NORMAL_BLEND\n"
+   "attribute   vec4  aNormal1;\n"
+   "uniform     float uNormalWeight;\n"
+   "#endif //VERTEX_NORMAL_BLEND\n"
+   "#ifdef VERTEX_TEXCOORD\n"
+   "attribute   vec4  aTexCoord0;\n"
+   "#endif //VERTEX_TEXCOORD\n"
+   "#ifdef VERTEX_TEXCOORD_BLEND\n"
+   "attribute   vec4  aTexCoord1;\n"
+   "uniform     float uTexCoordWeight;\n"
+   "#endif //VERTEX_TEXCOORD_BLEND\n"
+   "#ifdef NEED_TEX_COORD\n"
+   "varying vec2 vTexCoord;\n"
+   "#endif //NEED_TEX_COORD\n"
+   "#ifdef LIGHT_SPOT\n"
+   "uniform   vec3  uLightSpotDir;\n"
+   "uniform   float uLightSpotExp;\n"
+   "uniform   float uLightSpotCutoffCos;\n"
+   "#endif //LIGHT_SPOT\n"
+   "#ifdef SPECULAR\n"
+   "uniform float   uMaterialShininess;\n"
+   "#endif //SPECULAR\n"
+   "#ifdef LIGHT_ATTENUATION\n"
+   "uniform   vec3  uLightAtten;\n"
+   "#endif //LIGHT_ATTENUATION\n"
+   "void vertexFlat(vec4 position, vec3 normal)\n"
+   "{\n"
+   "   vec3  lv;\n"
+   "   float factor;\n"
+   "   normal = uMatrixNormal * normal;\n"
+   "   position = uMatrixModelview * position;\n"
+   "#ifdef NORMALIZE_NORMALS\n"
+   "   normal = normalize(normal);\n"
+   "#endif //NORMALIZE_NORMALS\n"
+   "#ifdef LIGHT_DIRECTIONAL\n"
+   "   lv = uLightPosition.xyz;\n"
+   "#else\n"
+   "   lv = uLightPosition.xyz - position.xyz;\n"
+   "   lv = normalize(lv);\n"
+   "#endif //LIGHT_DIRECTIONAL\n"
+   "   factor = max(dot(lv, normal), 0.0);\n"
+   "#ifdef LIGHT_SPOT\n"
+   "   float f = dot(-lv, uLightSpotDir);\n"
+   "   if (f > uLightSpotCutoffCos)\n"
+   "     factor *= pow(f, uLightSpotExp);\n"
+   "   else\n"
+   "      factor = 0.0;\n"
+   "#endif //LIGHT_SPOT\n"
+   "   if (factor > 0.0)\n"
+   "     {\n"
+   "#ifdef DIFFUSE\n"
+   "        vFactor.x = factor;\n"
+   "#else\n"
+   "        vFactor.x = 0.0;\n"
+   "#endif //DIFFUSE\n"
+   "#ifdef SPECULAR\n"
+   "        vec3  hv = normalize(normalize(-position.xyz) + lv);\n"
+   "        factor = pow(max(dot(hv, normal), 0.0), uMaterialShininess);\n"
+   "        vFactor.y = factor;\n"
+   "#endif //SPECULAR\n"
+   "     }\n"
+   "   else\n"
+   "     vFactor = vec2(0.0, 0.0);\n"
+   "   /* Light attenuation. */\n"
+   "#ifdef LIGHT_ATTENUATION\n"
+   "   float dist = length(lv);\n"
+   "   vFactor /= dot(uLightAtten, vec3(1.0, dist, dist * dist));\n"
+   "#endif //LIGHT_ATTENUATION\n"
+   "}\n"
+   "void main()\n"
+   "{\n"
+   "#ifdef VERTEX_POSITION_BLEND\n"
+   "   vec4 position = aPosition0 * uPositionWeight +\n"
+   "   aPosition1 * (1.0 - uPositionWeight);\n"
+   "   position = vec4(position.xyz, 1.0);\n"
+   "#else\n"
+   "#ifdef VERTEX_POSITION\n"
+   "   vec4 position = vec4(aPosition0.xyz, 1.0);\n"
+   "#endif // VERTEX_POSITION\n"
+   "#endif //VERTEX_POSITION_BLEND\n"
+   "#ifdef VERTEX_NORMAL_BLEND\n"
+   "   vec3 normal = aNormal0.xyz * uNormalWeight +\n"
+   "   aNormal1.xyz * (1.0 - uNormalWeight);\n"
+   "#else\n"
+   "#ifdef VERTEX_NORMAL\n"
+   "   vec3 normal = aNormal0.xyz;\n"
+   "#endif //VERTEX_NORMAL\n"
+   "#endif //VERTEX_NORMAL_BLEND\n"
+   "#ifdef VERTEX_TEXCOORD_BLEND\n"
+   "   vTexCoord = aTexCoord0.st * uTexCoordWeight +\n"
+   "   aTexCoord1.st * (1.0 - uTexCoordWeight);\n"
+   "#else\n"
+   "#ifdef VERTEX_TEXCOORD\n"
+   "   vTexCoord = aTexCoord0.st;\n"
+   "#endif //VERTEX_TEXCOORD\n"
+   "#endif //VERTEX_TEXCOORD_BLEND\n"
+   "   gl_Position = uMatrixMvp * position;\n"
+   "   vertexFlat(position, normal);\n"
+   "#ifdef SHADOWED\n"
+   "   vLightPosition = uMatrixLight * position;\n"
+   "#endif\n"
+   "}\n";
+
+static const char const flat_frag_glsl[] =
+   "varying vec2   vFactor;\n"
+   "#ifdef NEED_TEX_COORD\n"
+   "varying vec2   vTexCoord;\n"
+   "#endif //TEX_COORD\n"
+   "#ifdef FOG_ENABLED\n"
+   "uniform float uFogFactor;\n"
+   "uniform vec4  uFogColor;\n"
+   "#endif //FOG_ENABLED\n"
+   "#ifdef  SHADOWED\n"
+   "varying vec4 vLightPosition;\n"
+   "uniform sampler2D uShadowMap;\n"
+   "float shadow;\n"
+   "#endif //SHADOWED\n"
+   "#ifdef DIFFUSE\n"
+   "uniform   vec4        uMaterialDiffuse;\n"
+   "uniform   vec4        uLightDiffuse;\n"
+   "#ifdef DIFFUSE_TEXTURE\n"
+   "uniform sampler2D  uTextureDiffuse0;\n"
+   "#endif //DIFFUSE_TEXTURE\n"
+   "#ifdef DIFFUSE_TEXTURE_BLEND\n"
+   "uniform sampler2D  uTextureDiffuse1;\n"
+   "uniform float      uTextureDiffuseWeight;\n"
+   "#endif //DIFFUSE_TEXTURE_BLEND\n"
+   "#endif //DIFFUSE\n"
+   "#ifdef SPECULAR\n"
+   "uniform   vec4     uLightSpecular;\n"
+   "uniform   float    uMaterialShininess;\n"
+   "uniform   vec4     uMaterialSpecular;\n"
+   "#ifdef SPECULAR_TEXTURE\n"
+   "uniform sampler2D  uTextureSpecular0;\n"
+   "#endif //SPECULAR_TEXTURE\n"
+   "#ifdef SPECULAR_TEXTURE_BLEND\n"
+   "uniform sampler2D  uTextureSpecular1;\n"
+   "uniform float      uTextureSpecularWeight;\n"
+   "#endif //SPECULAR_TEXTURE_BLEND\n"
+   "#endif //SPECULAR\n"
+   "#ifdef AMBIENT\n"
+   "uniform  vec4       uMaterialAmbient;\n"
+   "uniform  vec4       uLightAmbient;\n"
+   "#ifdef AMBIENT_TEXTURE\n"
+   "uniform sampler2D  uTextureAmbient0;\n"
+   "#endif //AMBIENT_TEXTURE\n"
+   "#ifdef AMBIENT_TEXTURE_BLEND\n"
+   "uniform sampler2D  uTextureAmbient1;\n"
+   "uniform float      uTextureAmbientWeight;\n"
+   "#endif //AMBIENT_TEXTURE_BLEND\n"
+   "#endif //AMBIENT\n"
+   "#ifdef EMISSION\n"
+   "uniform vec4       uMaterialEmission;\n"
+   "#ifdef EMISSION_TEXTURE\n"
+   "uniform sampler2D  uTextureEmission0;\n"
+   "#endif //EMISSION_TEXTURE\n"
+   "#ifdef EMISSION_TEXTURE_BLEND\n"
+   "uniform sampler2D  uTextureEmission1;\n"
+   "uniform float      uTextureEmissionWeight;\n"
+   "#endif //EMISSION_TEXTURE_BLEND\n"
+   "#endif //EMISSION\n"
+   "#ifdef  SHADOWED\n"
+   "float pcf(vec4 lpos, float size)\n"
+   "{\n"
+   "   vec3 smcoord = lpos.xyz / lpos.w * 0.5 + 0.5;\n"
+   "   float i, j, randx, randy, shadow;\n"
+   "   shadow = 0.0;\n"
+   "   for (i = -4.0; i < 4.0; i++)\n"
+   "     for (j = -4.0; j < 4.0; j++)\n"
+   "        shadow += float(smcoord.z <= texture2D(uShadowMap, smcoord.xy +vec2(i / 8.0, j / 8.0)*size).x);\n"
+   "   return shadow / 64.0;\n"
+   "}\n"
+   "#endif //SHADOWED\n"
+   "void fragmentFlat()\n"
+   "{\n"
+   "   vec4 color;\n"
+   "#ifdef DIFFUSE\n"
+   "#ifdef DIFFUSE_TEXTURE_BLEND\n"
+   "        color = texture2D(uTextureDiffuse0, vTexCoord) * uTextureDiffuseWeight +\n"
+   "        texture2D(uTextureDiffuse1, vTexCoord) * (1.0 - uTextureDiffuseWeight);\n"
+   "        color *= uMaterialDiffuse;\n"
+   "#else\n"
+   "#ifdef  DIFFUSE_TEXTURE\n"
+   "        color = texture2D(uTextureDiffuse0, vTexCoord)  * uMaterialDiffuse;\n"
+   "#else\n"
+   "        color = uMaterialDiffuse;\n"
+   "#endif //DIFFUSE_TEXTURE\n"
+   "#endif //DIFFUSE_TEXTURE_BLEND\n"
+   "        gl_FragColor = uLightDiffuse * color * vFactor.x;\n"
+   "#else\n"
+   "        gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n"
+   "#endif //DIFFUSE\n"
+   "#ifdef SPECULAR\n"
+   "#ifdef SPECULAR_TEXTURE_BLEND\n"
+   "   color = texture2D(uTextureSpecular0, vTexCoord) * uTextureSpecularWeight +\n"
+   "   texture2D(uTextureSpecular1, vTexCoord) * (1.0 - uTextureSpecularWeight);\n"
+   "   color *= uMaterialSpecular;\n"
+   "#else\n"
+   "#ifdef SPECULAR_TEXTURE\n"
+   "   color = texture2D(uTextureSpecular0, vTexCoord) * uMaterialSpecular;\n"
+   "#else\n"
+   "   color = uMaterialSpecular;\n"
+   "#endif //SPECULAR_TEXTURE\n"
+   "#endif //SPECULAR_TEXTURE_BLEND\n"
+   "   gl_FragColor += uLightSpecular * color * vFactor.y;\n"
+   "#endif //SPECULAR\n"
+   "#ifdef SHADOWED\n"
+   "   gl_FragColor *= shadow;\n"
+   "#endif //SHADOWED\n"
+   "#ifdef E3D_SHADER_FLAG_AMBIENT\n"
+   "#ifdef AMBIENT_TEXTURE_BLEND\n"
+   "   color = texture2D(uTextureAmbient0, vTexCoord) * uTextureAmbientWeight +\n"
+   "   texture2D(uTextureAmbient1, vTexCoord) * (1.0 - uTextureAmbientWeight);\n"
+   "   color *= uMaterialAmbient;\n"
+   "#else\n"
+   "#ifdef AMBIENT_TEXTURE\n"
+   "   color = texture2D(uTextureAmbient0, vTexCoord) * uMaterialAmbient;\n"
+   "#else\n"
+   "   color = uMaterialAmbient;\n"
+   "#endif //AMBIENT_TEXTURE\n"
+   "#endif //AMBIENT_TEXTURE_BLEND\n"
+   "   gl_FragColor += uLightAmbient * color;\n"
+   "#endif //AMBIENT\n"
+   "#ifdef EMISSION\n"
+   "#ifdef EMISSION_TEXTURE_BLEND\n"
+   "   color = texture2D(uTextureEmission0, vTexCoord) * uTextureEmissionWeight +\n"
+   "   texture2D(uTextureEmission1, vTexCoord) * (1.0 - uTextureEmissionWeight);\n"
+   "   color *= uMaterialEmission;\n"
+   "#else\n"
+   "#ifdef EMISSION_TEXTURE\n"
+   "   color = texture2D(uTextureEmission0, vTexCoord) * uMaterialEmission;\n"
+   "#else\n"
+   "   color = uMaterialEmission;\n"
+   "#endif //EMISSION_TEXTURE\n"
+   "#endif //EMISSION_TEXTURE_BLEND\n"
+   "   gl_FragColor += color;\n"
+   "#endif //EMISSION\n"
+   "}\n"
+   "void main() {\n"
+   "#ifdef SHADOWED\n"
+   "   shadow = pcf(vLightPosition, 1.0 / 200.0);\n"
+   "#endif //SHADOWED\n"
+   "   fragmentFlat();\n"
+   "#ifdef FOG_ENABLED\n"
+   "   float z = gl_FragCoord.z / gl_FragCoord.w;\n"
+   "   float fogFactor = exp2( -uFogFactor * uFogFactor * z * z * 1.44);\n"
+   "   fogFactor = clamp(fogFactor, 0.0, 1.0);\n"
+   "   gl_FragColor = mix(uFogColor, gl_FragColor, fogFactor);\n"
+   "#endif //FOG_ENABLED\n"
+   "}\n";
+
+static const char const phong_vert_glsl[] =
+   "uniform  mat4  uMatrixMvp;\n"
+   "uniform  mat3  uMatrixNormal;\n"
+   "uniform  mat4  uMatrixModelview;\n"
+   "uniform  vec4  uLightPosition;\n"
+   "varying  vec3  vLightVector;\n"
+   "varying  vec3  vLightHalfVector;\n"
+   "varying  vec3  vNormal;\n"
+   "#ifdef SHADOWED\n"
+   "uniform mat4 uMatrixLight;\n"
+   "varying vec4 vLightPosition;\n"
+   "#endif //SHADOWED\n"
+   "#ifdef VERTEX_POSITION\n"
+   "attribute   vec4  aPosition0;\n"
+   "#endif //VERTEX_POSITION\n"
+   "#ifdef VERTEX_POSITION_BLEND\n"
+   "attribute   vec4  aPosition1;\n"
+   "uniform     float uPositionWeight;\n"
+   "#endif //VERTEX_POSITION_BLEND\n"
+   "#ifdef VERTEX_NORMAL\n"
+   "attribute   vec4  aNormal0;\n"
+   "#endif //VERTEX_NORMAL\n"
+   "#ifdef VERTEX_NORMAL_BLEND\n"
+   "attribute   vec4  aNormal1;\n"
+   "uniform     float uNormalWeight;\n"
+   "#endif //VERTEX_NORMAL_BLEND\n"
+   "#ifdef VERTEX_TEXCOORD\n"
+   "attribute   vec4  aTexCoord0;\n"
+   "#endif //VERTEX_TEXCOORD\n"
+   "#ifdef VERTEX_TEXCOORD_BLEND\n"
+   "attribute   vec4  aTexCoord1;\n"
+   "uniform     float uTexCoordWeight;\n"
+   "#endif //VERTEX_TEXCOORD_BLEND\n"
+   "#ifdef NEED_TEX_COORD\n"
+   "varying vec2 vTexCoord;\n"
+   "#endif //NEED_TEX_COORD\n"
+   "#ifdef LIGHT_ATTENUATION\n"
+   "varying  float vLightDist;\n"
+   "#endif //LIGHT_ATTENUATION\n"
+   "void vertexPhong(vec4 position, vec3 normal)\n"
+   "{\n"
+   "   normal = uMatrixNormal * normal;\n"
+   "   position = uMatrixModelview * position;\n"
+   "#ifdef NORMALIZE_NORMALS\n"
+   "   normal = normalize(normal);\n"
+   "#endif //NORMALIZE_NORMALS\n"
+   "#ifdef LIGHT_DIRECTIONAL\n"
+   "   vLightVector = uLightPosition.xyz;\n"
+   "#else\n"
+   "   vLightVector = uLightPosition.xyz - position.xyz;\n"
+   "#ifdef LIGHT_ATTENUATION\n"
+   "   vLightDist = length(vLightVector);\n"
+   "#endif //LIGHT_ATTENUATION\n"
+   "   vLightVector = normalize(vLightVector);\n"
+   "#endif //LIGHT_DIRECTIONAL\n"
+   "   vLightHalfVector = normalize(normalize(-position.xyz) + vLightVector);\n"
+   "   vNormal = normal;\n"
+   "}\n"
+   "void main() {\n"
+   "#ifdef VERTEX_POSITION_BLEND\n"
+   "   vec4 position = aPosition0 * uPositionWeight +\n"
+   "   aPosition1 * (1.0 - uPositionWeight);\n"
+   "   position = vec4(position.xyz, 1.0);\n"
+   "#else\n"
+   "#ifdef VERTEX_POSITION\n"
+   "   vec4 position = vec4(aPosition0.xyz, 1.0);\n"
+   "#endif // VERTEX_POSITION\n"
+   "#endif //VERTEX_POSITION_BLEND\n"
+   "#ifdef VERTEX_NORMAL_BLEND\n"
+   "   vec3 normal = aNormal0.xyz * uNormalWeight +\n"
+   "   aNormal1.xyz * (1.0 - uNormalWeight);\n"
+   "#else\n"
+   "#ifdef VERTEX_NORMAL\n"
+   "   vec3 normal = aNormal0.xyz;\n"
+   "#endif //VERTEX_NORMAL\n"
+   "#endif //VERTEX_NORMAL_BLEND\n"
+   "#ifdef VERTEX_TEXCOORD_BLEND\n"
+   "   vTexCoord = aTexCoord0.st * uTexCoordWeight +\n"
+   "   aTexCoord1.st * (1.0 - uTexCoordWeight);\n"
+   "#else\n"
+   "#ifdef VERTEX_TEXCOORD\n"
+   "   vTexCoord = aTexCoord0.st;\n"
+   "#endif //VERTEX_TEXCOORD\n"
+   "#endif //VERTEX_TEXCOORD_BLEND\n"
+   "   gl_Position = uMatrixMvp * position;\n"
+   "   vertexPhong(position, normal);\n"
+   "#ifdef SHADOWED\n"
+   "   vLightPosition = uMatrixLight * position;\n"
+   "#endif //SHADOWED\n"
+   "}\n";
+
+static const char const phong_frag_glsl[] =
+   "varying  vec3        vLightVector;\n"
+   "varying  vec3        vLightHalfVector;\n"
+   "varying  vec3        vNormal;\n"
+   "#ifdef NEED_TEX_COORD\n"
+   "varying vec2   vTexCoord;\n"
+   "#endif //TEX_COORD\n"
+   "#ifdef FOG_ENABLED\n"
+   "uniform float uFogFactor;\n"
+   "uniform vec4  uFogColor;\n"
+   "#endif //FOG_ENABLED\n"
+   "#ifdef  SHADOWED\n"
+   "varying vec4 vLightPosition;\n"
+   "uniform sampler2D uShadowMap;\n"
+   "float shadow;\n"
+   "#endif //SHADOWED\n"
+   "#ifdef DIFFUSE\n"
+   "uniform   vec4        uMaterialDiffuse;\n"
+   "uniform   vec4        uLightDiffuse;\n"
+   "#ifdef DIFFUSE_TEXTURE\n"
+   "uniform sampler2D  uTextureDiffuse0;\n"
+   "#endif //DIFFUSE_TEXTURE\n"
+   "#ifdef DIFFUSE_TEXTURE_BLEND\n"
+   "uniform sampler2D  uTextureDiffuse1;\n"
+   "uniform float      uTextureDiffuseWeight;\n"
+   "#endif //DIFFUSE_TEXTURE_BLEND\n"
+   "#endif //DIFFUSE\n"
+   "#ifdef SPECULAR\n"
+   "uniform   vec4     uLightSpecular;\n"
+   "uniform   float    uMaterialShininess;\n"
+   "uniform   vec4     uMaterialSpecular;\n"
+   "#ifdef SPECULAR_TEXTURE\n"
+   "uniform sampler2D  uTextureSpecular0;\n"
+   "#endif //SPECULAR_TEXTURE\n"
+   "#ifdef SPECULAR_TEXTURE_BLEND\n"
+   "uniform sampler2D  uTextureSpecular1;\n"
+   "uniform float      uTextureSpecularWeight;\n"
+   "#endif //SPECULAR_TEXTURE_BLEND\n"
+   "#endif //SPECULAR\n"
+   "#ifdef AMBIENT\n"
+   "uniform  vec4       uMaterialAmbient;\n"
+   "uniform  vec4       uLightAmbient;\n"
+   "#ifdef AMBIENT_TEXTURE\n"
+   "uniform sampler2D  uTextureAmbient0;\n"
+   "#endif //AMBIENT_TEXTURE\n"
+   "#ifdef AMBIENT_TEXTURE_BLEND\n"
+   "uniform sampler2D  uTextureAmbient1;\n"
+   "uniform float      uTextureAmbientWeight;\n"
+   "#endif //AMBIENT_TEXTURE_BLEND\n"
+   "#endif //AMBIENT\n"
+   "#ifdef EMISSION\n"
+   "uniform vec4       uMaterialEmission;\n"
+   "#ifdef EMISSION_TEXTURE\n"
+   "uniform sampler2D  uTextureEmission0;\n"
+   "#endif //EMISSION_TEXTURE\n"
+   "#ifdef EMISSION_TEXTURE_BLEND\n"
+   "uniform sampler2D  uTextureEmission1;\n"
+   "uniform float      uTextureEmissionWeight;\n"
+   "#endif //EMISSION_TEXTURE_BLEND\n"
+   "#endif //EMISSION\n"
+   "#ifdef LIGHT_SPOT\n"
+   "uniform   vec3  uLightSpotDir;\n"
+   "uniform   float uLightSpotExp;\n"
+   "uniform   float uLightSpotCutoffCos;\n"
+   "#endif //LIGHT_SPOT\n"
+   "#ifdef LIGHT_ATTENUATION\n"
+   "varying   float    vLightDist;\n"
+   "#endif //LIGHT_ATTENUATION\n"
+   "void fragmentPhong()\n"
+   "{\n"
+   "   vec3  normal = normalize(vNormal);\n"
+   "   vec3  lv = normalize(vLightVector);\n"
+   "   float factor = dot(lv, normal);\n"
+   "   vec4  color;\n"
+   "#ifdef  LIGHT_SPOT\n"
+   "   float f = dot(-lv, normalize(uLightSpotDir));\n"
+   "   if (f > uLightSpotCutoffCos)\n"
+   "      factor *= pow(f, uLightSpotExp);\n"
+   "   else\n"
+   "     factor = 0.0;\n"
+   "#endif //LIGHT_SPOT\n"
+   "   if (factor > 0.0)\n"
+   "     {\n"
+   "   /* Diffuse term. */\n"
+   "#ifdef  DIFFUSE\n"
+   "#ifdef  DIFFUSE_TEXTURE_BLEND\n"
+   "        color = texture2D(uTextureDiffuse0, vTexCoord) * uTextureDiffuseWeight +\n"
+   "        texture2D(uTextureDiffuse1, vTexCoord) * (1.0 - uTextureDiffuseWeight);\n"
+   "#else\n"
+   "#ifdef  DIFFUSE_TEXTURE\n"
+   "        color = texture2D(uTextureDiffuse0, vTexCoord);\n"
+   "#else\n"
+   "        color = uMaterialDiffuse;\n"
+   "#endif //DIFFUSE_TEXTURE\n"
+   "#endif //DIFFUSE_TEXTURE_BLEND\n"
+   "        gl_FragColor = uLightDiffuse * color * factor;\n"
+   "#else\n"
+   "        gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n"
+   "#endif //DIFFUSE\n"
+   "   /* Specular term. */\n"
+   "#ifdef SPECULAR\n"
+   "        factor = dot(normalize(vLightHalfVector), normal);\n"
+   "        if (factor > 0.0)\n"
+   "          {\n"
+   "             factor = pow(factor, uMaterialShininess);\n"
+   "#ifdef  SPECULAR_TEXTURE_BLEND\n"
+   "             color = texture2D(uTextureSpecular0, vTexCoord) * uTextureSpecularWeight +\n"
+   "             texture2D(uTextureSpecular1, vTexCoord) * (1.0 - uTextureSpecularWeight);\n"
+   "#else\n"
+   "#ifdef   SPECULAR_TEXTURE\n"
+   "             color = texture2D(uTextureSpecular0, vTexCoord);\n"
+   "#else\n"
+   "             color = uMaterialSpecular;\n"
+   "#endif\n"
+   "#endif\n"
+   "             gl_FragColor += uLightSpecular * color * factor;\n"
+   "          }\n"
+   "#endif\n"
+   "     }\n"
+   "   else\n"
+   "     gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n"
+   "#ifdef  SHADOWED\n"
+   "   gl_FragColor *= shadow;\n"
+   "#endif //SHADOWED\n"
+   "#ifdef AMBIENT\n"
+   "#ifdef AMBIENT_TEXTURE_BLEND\n"
+   "   color = texture2D(uTextureAmbient0, vTexCoord) * uTextureAmbientWeight +\n"
+   "   texture2D(uTextureAmbient1, vTexCoord) * (1.0 - uTextureAmbientWeight);\n"
+   "#else\n"
+   "#ifdef AMBIENT_TEXTURE\n"
+   "   color = texture2D(uTextureAmbient0, vTexCoord);\n"
+   "#else\n"
+   "   color = uMaterialAmbient;\n"
+   "#endif\n"
+   "#endif\n"
+   "   gl_FragColor += uLightAmbient * color;\n"
+   "#endif\n"
+   "   /* Light attenuation. */\n"
+   "#ifdef  LIGHT_ATTENUATION\n"
+   "   gl_FragColor /= dot(uLightAtten, vec3(1.0, vLightDist, vLightDist * vLightDist));\n"
+   "#endif\n"
+   "   /* Emission term. */\n"
+   "#ifdef  EMISSION\n"
+   "#ifdef  EMISSION_TEXTURE_BLEND\n"
+   "   color = texture2D(uTextureEmission0, vTexCoord) * uTextureEmissionWeight +\n"
+   "   texture2D(uTextureEmission1, vTexCoord) * (1.0 - uTextureEmissionWeight);\n"
+   "#else\n"
+   "#ifdef  EMISSION_TEXTURE\n"
+   "   color = texture2D(uTextureEmission0, vTexCoord);\n"
+   "#else\n"
+   "   color = uMaterialEmission;\n"
+   "#endif\n"
+   "#endif\n"
+   "   gl_FragColor += color;\n"
+   "#endif\n"
+   "}\n"
+   "#ifdef  SHADOWED\n"
+   "float pcf(vec4 lpos, float size)\n"
+   "{\n"
+   "   vec3 smcoord = lpos.xyz / lpos.w * 0.5 + 0.5;\n"
+   "   float i, j, randx, randy, shadow;\n"
+   "   shadow = 0.0;\n"
+   "   for (i = -4.0; i < 4.0; i++)\n"
+   "     for (j = -4.0; j < 4.0; j++)\n"
+   "        shadow += float(smcoord.z <= texture2D(uShadowMap, smcoord.xy +vec2(i / 8.0, j / 8.0)*size).x);\n"
+   "   return shadow / 64.0;\n"
+   "}\n"
+   "#endif //SHADOWED\n"
+   "void main()\n"
+   "{\n"
+   "#ifdef SHADOWED\n"
+   "   shadow = pcf(vLightPosition, 1.0 / 300.0);\n"
+   "#endif //SHADOWED\n"
+   "   fragmentPhong();\n"
+   "#ifdef FOG_ENABLED\n"
+   "   float z = gl_FragCoord.z / gl_FragCoord.w;\n"
+   "   float fogFactor = exp2( -uFogFactor * uFogFactor * z * z * 1.44);\n"
+   "   fogFactor = clamp(fogFactor, 0.0, 1.0);\n"
+   "   gl_FragColor = mix(uFogColor, gl_FragColor, fogFactor);\n"
+   "#endif //FOG_ENABLED\n"
+   "}\n";
+
+static const char const normal_map_vert_glsl[] =
+   "uniform  mat4  uMatrixMvp;\n"
+   "uniform  mat3  uMatrixNormal;\n"
+   "uniform  mat4  uMatrixModelview;\n"
+   "uniform  vec4  uLightPosition;\n"
+   "varying  vec3  vLightVector;\n"
+   "varying  vec3  vLightHalfVector;\n"
+   "varying  vec3  vEyeVector;\n"
+   "#ifndef VERTEX_TANGENT\n"
+   "varying  vec3  vNormal;\n"
+   "#endif //VERTEX_TANGENT\n"
+   "#ifdef SHADOWED\n"
+   "uniform mat4 uMatrixLight;\n"
+   "varying vec4 vLightPosition;\n"
+   "#endif //SHADOWED\n"
+   "#ifdef VERTEX_POSITION\n"
+   "attribute   vec4  aPosition0;\n"
+   "#endif //VERTEX_POSITION\n"
+   "#ifdef VERTEX_POSITION_BLEND\n"
+   "attribute   vec4  aPosition1;\n"
+   "uniform     float uPositionWeight;\n"
+   "#endif //VERTEX_POSITION_BLEND\n"
+   "#ifdef VERTEX_NORMAL\n"
+   "attribute   vec4  aNormal0;\n"
+   "#endif //VERTEX_NORMAL\n"
+   "#ifdef VERTEX_NORMAL_BLEND\n"
+   "attribute   vec4  aNormal1;\n"
+   "uniform     float uNormalWeight;\n"
+   "#endif //VERTEX_NORMAL_BLEND\n"
+   "#ifdef VERTEX_TANGENT\n"
+   "attribute   vec4  aTangent0;\n"
+   "#endif //VERTEX_TANGENT\n"
+   "#ifdef VERTEX_TANGENT_BLEND\n"
+   "attribute   vec4  aTangent1;\n"
+   "uniform     float uTangentWeight;\n"
+   "#endif //VERTEX_TANGENT_BLEND\n"
+   "#ifdef VERTEX_TEXCOORD\n"
+   "attribute   vec4  aTexCoord0;\n"
+   "#endif //VERTEX_TEXCOORD\n"
+   "#ifdef VERTEX_TEXCOORD_BLEND\n"
+   "attribute   vec4  aTexCoord1;\n"
+   "uniform     float uTexCoordWeight;\n"
+   "#endif //VERTEX_TEXCOORD_BLEND\n"
+   "#ifdef NEED_TEX_COORD\n"
+   "varying vec2 vTexCoord;\n"
+   "#endif //NEED_TEX_COORD\n"
+   "#ifdef LIGHT_ATTENUATION\n"
+   "varying  float vLightDist;\n"
+   "#endif //LIGHT_ATTENUATION\n"
+   "#ifndef VERTEX_TANGENT\n"
+   "void vertexNormalMap(vec4 position, vec3 normal)\n"
+   "{\n"
+   "   normal = uMatrixNormal * normal;\n"
+   "   position = uMatrixModelview * position;\n"
+   "   vEyeVector = normalize(-position.xyz);\n"
+   "#ifdef NORMALIZE_NORMALS\n"
+   "   normal = normalize(normal);\n"
+   "#endif //NORMALIZE_NORMALS\n"
+   "#ifdef LIGHT_DIRECTIONAL\n"
+   "   vLightVector = uLightPosition.xyz;\n"
+   "#else\n"
+   "   vLightVector = uLightPosition.xyz - position.xyz;\n"
+   "#ifdef LIGHT_ATTENUATION\n"
+   "   vLightDist = length(vLightVector);\n"
+   "#endif //LIGHT_ATTENUATION\n"
+   "   vLightVector = normalize(vLightVector);\n"
+   "#endif //LIGHT_DIRECTIONAL\n"
+   "   vLightHalfVector = normalize(vEyeVector + vLightVector);\n"
+   "   vNormal = normal;\n"
+   "}\n"
+   "#else\n"
+   "void vertexNormalMap(vec4 position, vec3 normal, vec3 tangent)\n"
+   "{\n"
+   "   vec3 n = normalize(uMatrixNormal * normal);\n"
+   "   vec3 t = normalize(uMatrixNormal * tangent);\n"
+   "   vec3 b = cross(n, t);\n"
+   "   vec3 tmp;\n"
+   "   position = uMatrixModelview * position;\n"
+   "#ifdef LIGHT_DIRECTIONAL\n"
+   "   vec3 lightDir = uLightPosition.xyz;\n"
+   "#else\n"
+   "   vec3 lightDir = uLightPosition.xyz - position.xyz;\n"
+   "#ifdef LIGHT_ATTENUATION\n"
+   "   vLightDist = length(lightDir);\n"
+   "#endif //LIGHT_ATTENUATION\n"
+   "   lightDir = normalize(lightDir);\n"
+   "#endif //LIGHT_DIRECTIONAL\n"
+   "   tmp.x = dot(lightDir, t);\n"
+   "   tmp.y = dot(lightDir, b);\n"
+   "   tmp.z = dot(lightDir, n);\n"
+   "   vLightVector = tmp;\n"
+   "   tmp.x = dot(position.xyz, t);\n"
+   "   tmp.y = dot(position.xyz, b);\n"
+   "   tmp.z = dot(position.xyz, n);\n"
+   "   vEyeVector = normalize(tmp);\n"
+   "   vec3 hv = normalize(normalize(-position.xyz) + lightDir);\n"
+   "   tmp.x = dot(hv, t);\n"
+   "   tmp.y = dot(hv, b);\n"
+   "   tmp.z = dot(hv, n);\n"
+   "   vLightHalfVector = tmp;\n"
+   "}\n"
+   "#endif //VERTEX_TANGENT\n"
+   "void main()\n"
+   "{\n"
+   "#ifdef VERTEX_POSITION_BLEND\n"
+   "   vec4 position = aPosition0 * uPositionWeight +\n"
+   "   aPosition1 * (1.0 - uPositionWeight);\n"
+   "   position = vec4(position.xyz, 1.0);\n"
+   "#else\n"
+   "#ifdef VERTEX_POSITION\n"
+   "   vec4 position = vec4(aPosition0.xyz, 1.0);\n"
+   "#endif // VERTEX_POSITION\n"
+   "#endif //VERTEX_POSITION_BLEND\n"
+   "#ifdef VERTEX_NORMAL_BLEND\n"
+   "   vec3 normal = aNormal0.xyz * uNormalWeight +\n"
+   "   aNormal1.xyz * (1.0 - uNormalWeight);\n"
+   "#else\n"
+   "#ifdef VERTEX_NORMAL\n"
+   "   vec3 normal = aNormal0.xyz;\n"
+   "#endif //VERTEX_NORMAL\n"
+   "#endif //VERTEX_NORMAL_BLEND\n"
+   "#ifdef VERTEX_TANGENT_BLEND\n"
+   "   vec3 tangent = aTangent0.xyz * uTangentWeight +\n"
+   "   aTangent1.xyz * (1.0 - uTangentWeight);\n"
+   "#else\n"
+   "#ifdef VERTEX_TANGENT\n"
+   "   vec3 tangent = aTangent0.xyz;\n"
+   "#endif //VERTEX_TANGENT\n"
+   "#endif //VERTEX_TANGENT_BLEND\n"
+   "#ifdef VERTEX_TEXCOORD_BLEND\n"
+   "   vTexCoord = aTexCoord0.st * uTexCoordWeight +\n"
+   "   aTexCoord1.st * (1.0 - uTexCoordWeight);\n"
+   "#else\n"
+   "#ifdef VERTEX_TEXCOORD\n"
+   "   vTexCoord = aTexCoord0.st;\n"
+   "#endif //VERTEX_TEXCOORD\n"
+   "#endif //VERTEX_TEXCOORD_BLEND\n"
+   "   gl_Position = uMatrixMvp * position;\n"
+   "#ifdef  VERTEX_TANGENT\n"
+   "   vertexNormalMap(position, normal, tangent);\n"
+   "#else\n"
+   "   vertexNormalMap(position, normal);\n"
+   "#endif //VERTEX_TANGENT\n"
+   "#ifdef SHADOWED\n"
+   "   vLightPosition = uMatrixLight * position;\n"
+   "#endif\n"
+   "}\n";
+
+static const char const normal_map_frag_glsl[] =
+   "varying  vec3        vLightVector;\n"
+   "varying  vec3        vLightHalfVector;\n"
+   "uniform  sampler2D   uTextureNormal0;\n"
+   "varying  vec3        vEyeVector;\n"
+   "#ifdef NEED_TEX_COORD\n"
+   "varying vec2   vTexCoord;\n"
+   "#endif //TEX_COORD\n"
+   "#ifdef FOG_ENABLED\n"
+   "uniform float uFogFactor;\n"
+   "uniform vec4  uFogColor;\n"
+   "#endif //FOG_ENABLED\n"
+   "#ifdef  SHADOWED\n"
+   "varying vec4 vLightPosition;\n"
+   "uniform sampler2D uShadowMap;\n"
+   "float shadow;\n"
+   "#endif //SHADOWED\n"
+   "#ifdef NORMAL_TEXTURE_BLEND\n"
+   "uniform  sampler2D  uTextureNormal1;\n"
+   "uniform  float      uTextureNormalWeight;\n"
+   "#endif //NORMAL_TEXTURE_BLEND\n"
+   "#ifndef VERTEX_TANGENT\n"
+   "varying  vec3        vNormal;\n"
+   "#endif //VERTEX_TANGENT\n"
+   "#ifdef DIFFUSE\n"
+   "uniform   vec4        uMaterialDiffuse;\n"
+   "uniform   vec4        uLightDiffuse;\n"
+   "#ifdef DIFFUSE_TEXTURE\n"
+   "uniform sampler2D  uTextureDiffuse0;\n"
+   "#endif //DIFFUSE_TEXTURE\n"
+   "#ifdef DIFFUSE_TEXTURE_BLEND\n"
+   "uniform sampler2D  uTextureDiffuse1;\n"
+   "uniform float      uTextureDiffuseWeight;\n"
+   "#endif //DIFFUSE_TEXTURE_BLEND\n"
+   "#endif //DIFFUSE\n"
+   "#ifdef SPECULAR\n"
+   "uniform   vec4     uLightSpecular;\n"
+   "uniform   float    uMaterialShininess;\n"
+   "uniform   vec4     uMaterialSpecular;\n"
+   "#ifdef SPECULAR_TEXTURE\n"
+   "uniform sampler2D  uTextureSpecular0;\n"
+   "#endif //SPECULAR_TEXTURE\n"
+   "#ifdef SPECULAR_TEXTURE_BLEND\n"
+   "uniform sampler2D  uTextureSpecular1;\n"
+   "uniform float      uTextureSpecularWeight;\n"
+   "#endif //SPECULAR_TEXTURE_BLEND\n"
+   "#endif //SPECULAR\n"
+   "#ifdef AMBIENT\n"
+   "uniform  vec4       uMaterialAmbient;\n"
+   "uniform  vec4       uLightAmbient;\n"
+   "#ifdef AMBIENT_TEXTURE\n"
+   "uniform sampler2D  uTextureAmbient0;\n"
+   "#endif //AMBIENT_TEXTURE\n"
+   "#ifdef AMBIENT_TEXTURE_BLEND\n"
+   "uniform sampler2D  uTextureAmbient1;\n"
+   "uniform float      uTextureAmbientWeight;\n"
+   "#endif //AMBIENT_TEXTURE_BLEND\n"
+   "#endif //AMBIENT\n"
+   "#ifdef EMISSION\n"
+   "uniform vec4       uMaterialEmission;\n"
+   "#ifdef EMISSION_TEXTURE\n"
+   "uniform sampler2D  uTextureEmission0;\n"
+   "#endif //EMISSION_TEXTURE\n"
+   "#ifdef EMISSION_TEXTURE_BLEND\n"
+   "uniform sampler2D  uTextureEmission1;\n"
+   "uniform float      uTextureEmissionWeight;\n"
+   "#endif //EMISSION_TEXTURE_BLEND\n"
+   "#endif //EMISSION\n"
+   "#ifdef LIGHT_SPOT\n"
+   "uniform   vec3  uLightSpotDir;\n"
+   "uniform   float uLightSpotExp;\n"
+   "uniform   float uLightSpotCutoffCos;\n"
+   "#endif //LIGHT_SPOT\n"
+   "#ifdef LIGHT_ATTENUATION\n"
+   "varying   float    vLightDist;\n"
+   "#endif //LIGHT_ATTENUATION\n"
+   "#ifndef VERTEX_TANGENT\n"
+   "mat3 cotangent_frame(vec3 n, vec3 p, vec2 uv)\n"
+   "{\n"
+   "   vec3 dp1 = dFdx(p);\n"
+   "   vec3 dp2 = dFdy(p);\n"
+   "   vec2 duv1 = dFdx(uv);\n"
+   "   vec2 duv2 = dFdy(uv);\n"
+   "   vec3 dp2perp = cross(dp2, n);\n"
+   "   vec3 dp1perp = cross(n, dp1);\n"
+   "   vec3 t = dp2perp * duv1.x + dp1perp * duv2.x;\n"
+   "   vec3 b = dp2perp * duv1.y + dp1perp * duv2.y;\n"
+   "   float invmax = inversesqrt(max(dot(t, t), dot(b, b)));\n"
+   "   return mat3(t * invmax, b * invmax, n);\n"
+   "}\n"
+   "vec3 perturb_normal(vec3 normal)\n"
+   "{\n"
+   "   mat3 tbn = cotangent_frame(vNormal, -vEyeVector, vTexCoord);\n"
+   "   return normalize(tbn * normal);\n"
+   "}\n"
+   "#endif //VERTEX_TANGENT\n"
+   "void fragmentNormalMap()\n"
+   "{\n"
+   "   float factor;\n"
+   "   vec3  normal;\n"
+   "   vec4  color;\n"
+   "#ifdef NORMAL_TEXTURE_BLEND\n"
+   "   normal = texture2D(uTextureNormal0, vTexCoord).rgb * uTextureNormalWeight;\n"
+   "   normal += texture2D(uTextureNormal1, vTexCoord).rgb *\n"
+   "   (1.0 - uTextureNormalWeight);\n"
+   "#else\n"
+   "   normal = texture2D(uTextureNormal0, vTexCoord).rgb;\n"
+   "#endif //NORMAL_TEXTURE_BLEND\n"
+   "   normal = 2.0 * normal - 1.0;\n"
+   "#ifndef VERTEX_TANGENT\n"
+   "   normal = perturb_normal(normal);\n"
+   "#endif //VERTEX_TANGENT\n"
+   "   vec3  lv = normalize(vLightVector);\n"
+   "   normal = normalize(normal);\n"
+   "   factor = dot(lv, normal);\n"
+   "#ifdef LIGHT_SPOT\n"
+   "   float f = dot(-lv, normalize(uLightSpotDir));\n"
+   "   if (f > uLightSpotCutoffCos)\n"
+   "     factor *= pow(f, uLightSpotExp);\n"
+   "   else\n"
+   "     factor = 0.0;\n"
+   "#endif //LIGHT_SPOT\n"
+   "   if (factor > 0.0)\n"
+   "     {\n"
+   "#ifdef DIFFUSE\n"
+   "#ifdef DIFFUSE_TEXTURE_BLEND\n"
+   "        color = texture2D(uTextureDiffuse0, vTexCoord) * uTextureDiffuseWeight +\n"
+   "        texture2D(uTextureDiffuse1, vTexCoord) * (1.0 - uTextureDiffuseWeight);\n"
+   "#else\n"
+   "#ifdef DIFFUSE_TEXTURE\n"
+   "        color = texture2D(uTextureDiffuse0, vTexCoord);\n"
+   "#else\n"
+   "        color = uMaterialDiffuse;\n"
+   "#endif //DIFFUSE_TEXTURE\n"
+   "#endif //DIFFUSE_TEXTURE_BLEND\n"
+   "        gl_FragColor = uLightDiffuse * color * factor;\n"
+   "#else\n"
+   "        gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n"
+   "#endif //DIFFUSE\n"
+   "#ifdef SPECULAR\n"
+   "        factor = dot(normalize(vLightHalfVector), normal);\n"
+   "        if (factor > 0.0)\n"
+   "          {\n"
+   "             factor = pow(factor, uMaterialShininess);\n"
+   "#ifdef SPECULAR_TEXTURE_BLEND\n"
+   "             color = texture2D(uTextureSpecular0, vTexCoord) * uTextureSpecularWeight +\n"
+   "             texture2D(uTextureSpecular1, vTexCoord) * (1.0 - uTextureSpecularWeight);\n"
+   "#else\n"
+   "#ifdef SPECULAR_TEXTURE\n"
+   "             color = texture2D(uTextureSpecular0, vTexCoord);\n"
+   "#else\n"
+   "             color = uMaterialSpecular;\n"
+   "#endif //SPECULAR_TEXTURE\n"
+   "#endif //SPECULAR_TEXTURE_BLEND\n"
+   "             gl_FragColor += uLightSpecular * color * factor;\n"
+   "          }\n"
+   "#endif //SPECULAR\n"
+   "#ifdef SHADOWED\n"
+   "        gl_FragColor *= shadow;\n"
+   "#endif //SHADOWED\n"
+   "     }\n"
+   "   else\n"
+   "     gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n"
+   "#ifdef AMBIENT\n"
+   "#ifdef AMBIENT_TEXTURE_BLEND\n"
+   "   color = texture2D(uTextureAmbient0, vTexCoord) * uTextureAmbientWeight +\n"
+   "   texture2D(uTextureAmbient1, vTexCoord) * (1.0 - uTextureAmbientWeight);\n"
+   "#else\n"
+   "#ifdef AMBIENT_TEXTURE\n"
+   "   color = texture2D(uTextureAmbient0, vTexCoord);\n"
+   "#else\n"
+   "   color = uMaterialAmbient;\n"
+   "#endif //AMBIENT_TEXTURE\n"
+   "#endif //AMBIENT_TEXTURE_BLEND\n"
+   "     gl_FragColor += uLightAmbient * color;\n"
+   "#endif //AMBIENT\n"
+   "#ifdef LIGHT_ATTENUATION\n"
+   "   gl_FragColor /= dot(uLightAtten, vec3(1.0, vLightDist, vLightDist * vLightDist));\n"
+   "#endif //LIGHT_ATTENUATION\n"
+   "#ifdef EMISSION\n"
+   "#ifdef EMISSION_TEXTURE_BLEND\n"
+   "   color = texture2D(uTextureEmission0, vTexCoord) * uTextureEmissionWeight +\n"
+   "   texture2D(uTextureEmission1, vTexCoord) * (1.0 - uTextureEmissionWeight);\n"
+   "#else\n"
+   "#ifdef EMISSION_TEXTURE\n"
+   "   color = texture2D(uTextureEmission0, vTexCoord);\n"
+   "#else\n"
+   "   color = uMaterialEmission;\n"
+   "#endif //EMISSION_TEXTURE\n"
+   "#endif //EMISSION_TEXTURE_BLEND\n"
+   "   gl_FragColor += color;\n"
+   "#endif //EMISSION\n"
+   "}\n"
+   "#ifdef SHADOWED\n"
+   "float pcf(vec4 lpos, float size)\n"
+   "{\n"
+   "   vec3 smcoord = lpos.xyz / lpos.w * 0.5 + 0.5;\n"
+   "   float i, j, randx, randy, shadow;\n"
+   "   shadow = 0.0;\n"
+   "   for (i = -4.0; i < 4.0; i++)\n"
+   "     for (j = -4.0; j < 4.0; j++)\n"
+   "        shadow += float(smcoord.z <= texture2D(uShadowMap, smcoord.xy +vec2(i / 8.0, j / 8.0)*size).x);\n"
+   "   return shadow / 64.0;\n"
+   "}\n"
+   "#endif //SHADOWED\n"
+   "void main() {\n"
+   "#ifdef SHADOWED\n"
+   "   shadow = pcf(vLightPosition, 1.0 / 200.0);\n"
+   "#endif //SHADOWED\n"
+   "   fragmentNormalMap();\n"
+   "#ifdef FOG_ENABLED\n"
+   "   float z = gl_FragCoord.z / gl_FragCoord.w;\n"
+   "   float fogFactor = exp2( -uFogFactor * uFogFactor * z * z * 1.44);\n"
+   "   fogFactor = clamp(fogFactor, 0.0, 1.0);\n"
+   "   gl_FragColor = mix(uFogColor, gl_FragColor, fogFactor);\n"
+   "#endif //FOG_ENABLED\n"
+   "}\n";
+
+static const char const shadow_map_vert_glsl[] =
+   "uniform mat4  uMatrixMvp;\n"
+   "#ifdef VERTEX_POSITION\n"
+   "attribute   vec4  aPosition0;\n"
+   "#endif //VERTEX_POSITION\n"
+   "#ifdef VERTEX_POSITION_BLEND\n"
+   "attribute   vec4  aPosition1;\n"
+   "uniform     float uPositionWeight;\n"
+   "#endif //VERTEX_POSITION_BLEND\n"
+   "void main()\n"
+   "{\n"
+   "#ifdef VERTEX_POSITION_BLEND\n"
+   "   vec4 position = aPosition0 * uPositionWeight +\n"
+   "   aPosition1 * (1.0 - uPositionWeight);\n"
+   "   position = vec4(position.xyz, 1.0);\n"
+   "#else\n"
+   "#ifdef VERTEX_POSITION\n"
+   "   vec4 position = vec4(aPosition0.xyz, 1.0);\n"
+   "#endif // VERTEX_POSITION\n"
+   "#endif //VERTEX_POSITION_BLEND\n"
+   "   gl_Position = uMatrixMvp * position;\n"
+   "}\n";
+
+static const char const shadow_map_frag_glsl[] =
+   "void main()\n"
+   "{\n"
+   "   gl_FragColor.r = gl_FragCoord.z;\n"
+   "}\n";
+
+static const char const color_pick_vert_glsl[] =
+   "uniform mat4  uMatrixMvp;\n"
+   "#ifdef VERTEX_POSITION\n"
+   "attribute   vec4  aPosition0;\n"
+   "#endif //VERTEX_POSITION\n"
+   "#ifdef VERTEX_POSITION_BLEND\n"
+   "attribute   vec4  aPosition1;\n"
+   "uniform     float uPositionWeight;\n"
+   "#endif //VERTEX_POSITION_BLEND\n"
+   "void main()\n"
+   "{\n"
+   "#ifdef VERTEX_POSITION_BLEND\n"
+   "   vec4 position = aPosition0 * uPositionWeight +\n"
+   "   aPosition1 * (1.0 - uPositionWeight);\n"
+   "   position = vec4(position.xyz, 1.0);\n"
+   "#else\n"
+   "#ifdef VERTEX_POSITION\n"
+   "   vec4 position = vec4(aPosition0.xyz, 1.0);\n"
+   "#endif // VERTEX_POSITION\n"
+   "#endif //VERTEX_POSITION_BLEND\n"
+   "   gl_Position = uMatrixMvp * position;\n"
+   "}\n";
+
+static const char const color_pick_frag_glsl[] =
+   "uniform float uColorPick;\n"
+   "void main()\n"
+   "{\n"
+   "   gl_FragColor = vec4(uColorPick);\n"
+   "}\n";
+
+static const char *vertex_shaders[] =
+{
+    vertex_color_vert_glsl,
+    diffuse_vert_glsl,
+    flat_vert_glsl,
+    phong_vert_glsl,
+    normal_map_vert_glsl,
+    shadow_map_vert_glsl,
+    color_pick_vert_glsl,
+};
+
+static const char *fragment_shaders[] =
+{
+    vertex_color_frag_glsl,
+    diffuse_frag_glsl,
+    flat_frag_glsl,
+    phong_frag_glsl,
+    normal_map_frag_glsl,
+    shadow_map_frag_glsl,
+    color_pick_frag_glsl,
+};