[dali_2.3.28] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-scene3d / internal / graphics / shaders / default-physically-based-shader.vert
index 25e615d..8ee1bf4 100644 (file)
 #define ADD_EXTRA_SKINNING_ATTRIBUTES
 #define ADD_EXTRA_WEIGHTS
 
 #define ADD_EXTRA_SKINNING_ATTRIBUTES
 #define ADD_EXTRA_WEIGHTS
 
-#ifdef HIGHP
-  precision highp float;
-#else
-  precision mediump float;
-#endif
+precision highp float;
 
 INPUT vec3 aPosition;
 INPUT vec2 aTexCoord;
 
 INPUT vec3 aPosition;
 INPUT vec2 aTexCoord;
@@ -30,7 +26,7 @@ INPUT vec3 aTangent;
 
 INPUT vec4 aVertexColor;
 
 
 INPUT vec4 aVertexColor;
 
-#ifdef GLSL_VERSION_1_0
+#ifdef SL_VERSION_LOW
 INPUT float aVertexID;
 #endif
 
 INPUT float aVertexID;
 #endif
 
@@ -42,27 +38,27 @@ ADD_EXTRA_SKINNING_ATTRIBUTES
 
 #ifdef MORPH
 uniform highp sampler2D sBlendShapeGeometry;
 
 #ifdef MORPH
 uniform highp sampler2D sBlendShapeGeometry;
-#ifdef GLSL_VERSION_1_0
+#ifdef SL_VERSION_LOW
 uniform int uBlendShapeGeometryWidth;
 uniform int uBlendShapeGeometryHeight;
 #endif
 #endif
 
 OUTPUT mediump vec2 vUV;
 uniform int uBlendShapeGeometryWidth;
 uniform int uBlendShapeGeometryHeight;
 #endif
 #endif
 
 OUTPUT mediump vec2 vUV;
-OUTPUT lowp mat3 vTBN;
+OUTPUT highp mat3 vTBN;
 OUTPUT lowp vec4 vColor;
 OUTPUT highp vec3 vPositionToCamera;
 
 uniform highp mat4 uViewMatrix;
 OUTPUT lowp vec4 vColor;
 OUTPUT highp vec3 vPositionToCamera;
 
 uniform highp mat4 uViewMatrix;
-uniform mat3 uNormalMatrix;
-uniform mat4 uModelMatrix;
-uniform mat4 uProjection;
+uniform highp mat3 uNormalMatrix;
+uniform highp mat4 uModelMatrix;
+uniform highp mat4 uProjection;
 
 #ifdef SKINNING
 
 
 #ifdef SKINNING
 
-#ifdef GLSL_VERSION_1_0
+#ifdef SL_VERSION_LOW
 #define MAX_BONES 80
 #define MAX_BONES 80
-uniform mat4 uBone[MAX_BONES];
+uniform highp mat4 uBone[MAX_BONES];
 #else
 #define MAX_BONES 256
 layout(std140) uniform Bones
 #else
 #define MAX_BONES 256
 layout(std140) uniform Bones
@@ -98,7 +94,7 @@ void main()
   highp vec3 tangent = aTangent.xyz;
 
 #ifdef MORPH
   highp vec3 tangent = aTangent.xyz;
 
 #ifdef MORPH
-#ifdef GLSL_VERSION_1_0
+#ifdef SL_VERSION_LOW
   int width = uBlendShapeGeometryWidth;
 #else
   int width = textureSize( sBlendShapeGeometry, 0 ).x;
   int width = uBlendShapeGeometryWidth;
 #else
   int width = textureSize( sBlendShapeGeometry, 0 ).x;
@@ -106,7 +102,7 @@ void main()
 
   highp int blendShapeBufferOffset = 0;
 
 
   highp int blendShapeBufferOffset = 0;
 
-#ifdef GLSL_VERSION_1_0
+#ifdef SL_VERSION_LOW
   highp float blendShapeWidth = float(uBlendShapeGeometryWidth);
   highp float blendShapeHeight = float(uBlendShapeGeometryHeight);
   highp float invertBlendShapeWidth = 1.0 / blendShapeWidth;
   highp float blendShapeWidth = float(uBlendShapeGeometryWidth);
   highp float blendShapeHeight = float(uBlendShapeGeometryHeight);
   highp float invertBlendShapeWidth = 1.0 / blendShapeWidth;
@@ -123,7 +119,7 @@ void main()
 
 #ifdef MORPH_POSITION
     // Calculate the index to retrieve the geometry from the texture.
 
 #ifdef MORPH_POSITION
     // Calculate the index to retrieve the geometry from the texture.
-#ifdef GLSL_VERSION_1_0
+#ifdef SL_VERSION_LOW
     vertexId = int(floor(aVertexID + 0.5)) + blendShapeBufferOffset;
     y = vertexId / width;
     x = vertexId - y * width;
     vertexId = int(floor(aVertexID + 0.5)) + blendShapeBufferOffset;
     y = vertexId / width;
     x = vertexId - y * width;
@@ -142,7 +138,7 @@ void main()
        highp float unnormalizeFactor = uBlendShapeUnnormalizeFactor[index];
 #endif
 
        highp float unnormalizeFactor = uBlendShapeUnnormalizeFactor[index];
 #endif
 
-#ifdef GLSL_VERSION_1_0
+#ifdef SL_VERSION_LOW
       highp float floatX = float(x) + 0.5;
       highp float floatY = float(y) + 0.5;
       diff = weight * unnormalizeFactor * ( texture2D( sBlendShapeGeometry, vec2(floatX * invertBlendShapeWidth, floatY * invertBlendShapeHeight) ).xyz - 0.5 );
       highp float floatX = float(x) + 0.5;
       highp float floatY = float(y) + 0.5;
       diff = weight * unnormalizeFactor * ( texture2D( sBlendShapeGeometry, vec2(floatX * invertBlendShapeWidth, floatY * invertBlendShapeHeight) ).xyz - 0.5 );
@@ -158,7 +154,7 @@ void main()
 
 #ifdef MORPH_NORMAL
     // Calculate the index to retrieve the normal from the texture.
 
 #ifdef MORPH_NORMAL
     // Calculate the index to retrieve the normal from the texture.
-#ifdef GLSL_VERSION_1_0
+#ifdef SL_VERSION_LOW
     vertexId = int(floor(aVertexID + 0.5)) + blendShapeBufferOffset;
     y = vertexId / width;
     x = vertexId - y * width;
     vertexId = int(floor(aVertexID + 0.5)) + blendShapeBufferOffset;
     y = vertexId / width;
     x = vertexId - y * width;
@@ -171,7 +167,7 @@ void main()
     // Retrieves the blend shape normal from the texture, unnormalizes it and multiply by the weight.
     if(0.0 != weight)
     {
     // Retrieves the blend shape normal from the texture, unnormalizes it and multiply by the weight.
     if(0.0 != weight)
     {
-#ifdef GLSL_VERSION_1_0
+#ifdef SL_VERSION_LOW
       highp float floatX = float(x) + 0.5;
       highp float floatY = float(y) + 0.5;
       diff = weight * 2.0 * ( texture2D( sBlendShapeGeometry, vec2(floatX * invertBlendShapeWidth, floatY * invertBlendShapeHeight) ).xyz - 0.5 );
       highp float floatX = float(x) + 0.5;
       highp float floatY = float(y) + 0.5;
       diff = weight * 2.0 * ( texture2D( sBlendShapeGeometry, vec2(floatX * invertBlendShapeWidth, floatY * invertBlendShapeHeight) ).xyz - 0.5 );
@@ -187,7 +183,7 @@ void main()
 
 #ifdef MORPH_TANGENT
     // Calculate the index to retrieve the tangent from the texture.
 
 #ifdef MORPH_TANGENT
     // Calculate the index to retrieve the tangent from the texture.
-#ifdef GLSL_VERSION_1_0
+#ifdef SL_VERSION_LOW
     vertexId = int(floor(aVertexID + 0.5)) + blendShapeBufferOffset;
     y = vertexId / width;
     x = vertexId - y * width;
     vertexId = int(floor(aVertexID + 0.5)) + blendShapeBufferOffset;
     y = vertexId / width;
     x = vertexId - y * width;
@@ -200,7 +196,7 @@ void main()
     // Retrieves the blend shape tangent from the texture, unnormalizes it and multiply by the weight.
     if(0.0 != weight)
     {
     // Retrieves the blend shape tangent from the texture, unnormalizes it and multiply by the weight.
     if(0.0 != weight)
     {
-#ifdef GLSL_VERSION_1_0
+#ifdef SL_VERSION_LOW
       highp float floatX = float(x) + 0.5;
       highp float floatY = float(y) + 0.5;
       diff = weight * 2.0 * ( texture2D( sBlendShapeGeometry, vec2(floatX * invertBlendShapeWidth, floatY * invertBlendShapeHeight) ).xyz - 0.5 );
       highp float floatX = float(x) + 0.5;
       highp float floatY = float(y) + 0.5;
       diff = weight * 2.0 * ( texture2D( sBlendShapeGeometry, vec2(floatX * invertBlendShapeWidth, floatY * invertBlendShapeHeight) ).xyz - 0.5 );
@@ -240,7 +236,7 @@ void main()
 
   highp vec4 positionV = uViewMatrix * positionW;
 
 
   highp vec4 positionV = uViewMatrix * positionW;
 
-#ifdef GLSL_VERSION_1_0
+#ifdef SL_VERSION_LOW
   highp vec3 i0 = uViewMatrix[0].xyz;
   highp vec3 i1 = uViewMatrix[1].xyz;
   highp vec3 i2 = uViewMatrix[2].xyz;
   highp vec3 i0 = uViewMatrix[0].xyz;
   highp vec3 i1 = uViewMatrix[1].xyz;
   highp vec3 i2 = uViewMatrix[2].xyz;