Update the custom shader effects to resize the geometry 43/53843/3
authorXiangyin Ma <x1.ma@samsung.com>
Wed, 9 Dec 2015 17:49:13 +0000 (17:49 +0000)
committerXiangyin Ma <x1.ma@samsung.com>
Fri, 11 Dec 2015 11:05:57 +0000 (03:05 -0800)
Change-Id: Ice71ffe5b084286625772743201cc72810c9591e

15 files changed:
automated-tests/src/dali-toolkit/utc-Dali-Builder.cpp
dali-toolkit/devel-api/shader-effects/bendy-effect.h
dali-toolkit/devel-api/shader-effects/carousel-effect.h
dali-toolkit/devel-api/shader-effects/dissolve-local-effect.h
dali-toolkit/devel-api/shader-effects/image-region-effect.h
dali-toolkit/devel-api/shader-effects/iris-effect.h
dali-toolkit/devel-api/shader-effects/mirror-effect.h
dali-toolkit/devel-api/shader-effects/ripple-effect.h
dali-toolkit/devel-api/shader-effects/ripple2d-effect.h
dali-toolkit/devel-api/shader-effects/shear-effect.h
dali-toolkit/devel-api/shader-effects/soft-button-effect.h
dali-toolkit/devel-api/shader-effects/spot-effect.h
dali-toolkit/devel-api/shader-effects/swirl-effect.h
dali-toolkit/internal/controls/page-turn-view/page-turn-book-spine-effect.h
dali-toolkit/internal/controls/page-turn-view/page-turn-effect.cpp

index 653325c..deb3727 100644 (file)
@@ -948,7 +948,7 @@ int UtcDaliBuilderShaderEffectP(void)
     "        \"vertexPrefix\": \"\",\n"
     "        \"vertex\": \"void main(void)\\n{\\n  gl_Position = uProjection * uModelView * vec4(aPosition, 1.0);\\n  vTexCoord = aTexCoord;\\n}\\n\\n\",\n"
     "        \"fragmentPrefix\": \"\",\n"
     "        \"vertexPrefix\": \"\",\n"
     "        \"vertex\": \"void main(void)\\n{\\n  gl_Position = uProjection * uModelView * vec4(aPosition, 1.0);\\n  vTexCoord = aTexCoord;\\n}\\n\\n\",\n"
     "        \"fragmentPrefix\": \"\",\n"
-    "        \"fragment\": \"precision mediump float;\\nuniform float uAmplitude; // 0.02; (< 1)\\nuniform float uTime;\\nvoid main()\\n{\\n  highp vec2 textureSize = sTextureRect.zw - sTextureRect.xy;\\n  highp vec2 pos = -1.0 + 2.0 * vTexCoord.st/textureSize;\\n  highp float len = length(pos);\\n  highp vec2 texCoord = vTexCoord.st/textureSize + pos/len * sin( len * 12.0 - uTime * 4.0 ) * uAmplitude; \\n  gl_FragColor = texture2D(sTexture, texCoord) * uColor;\\n}\\n\\n\\n\",\n"
+    "        \"fragment\": \"precision mediump float;\\nuniform float uAmplitude; // 0.02; (< 1)\\nuniform float uTime;\\nvoid main()\\n{\\n  highp vec2 textureSize = uTextureRect.zw - uTextureRect.xy;\\n  highp vec2 pos = -1.0 + 2.0 * vTexCoord.st/textureSize;\\n  highp float len = length(pos);\\n  highp vec2 texCoord = vTexCoord.st/textureSize + pos/len * sin( len * 12.0 - uTime * 4.0 ) * uAmplitude; \\n  gl_FragColor = texture2D(sTexture, texCoord) * uColor;\\n}\\n\\n\\n\",\n"
     "        \"geometryType\": \"GEOMETRY_TYPE_IMAGE\"\n"
     "      },\n"
     "      \"geometryHints\": \"HINT_NONE\",\n"
     "        \"geometryType\": \"GEOMETRY_TYPE_IMAGE\"\n"
     "      },\n"
     "      \"geometryHints\": \"HINT_NONE\",\n"
@@ -1058,7 +1058,7 @@ int UtcDaliBuilderShaderEffect2P(void)
     "        \"vertexPrefix\": \"\",\n"
     "        \"vertex\": \"void main(void)\\n{\\n  gl_Position = uProjection * uModelView * vec4(aPosition, 1.0);\\n  vTexCoord = aTexCoord;\\n}\\n\\n\",\n"
     "        \"fragmentPrefix\": \"\",\n"
     "        \"vertexPrefix\": \"\",\n"
     "        \"vertex\": \"void main(void)\\n{\\n  gl_Position = uProjection * uModelView * vec4(aPosition, 1.0);\\n  vTexCoord = aTexCoord;\\n}\\n\\n\",\n"
     "        \"fragmentPrefix\": \"\",\n"
-    "        \"fragment\": \"precision mediump float;\\nuniform float uAmplitude; // 0.02; (< 1)\\nuniform float uTime;\\nvoid main()\\n{\\n  highp vec2 textureSize = sTextureRect.zw - sTextureRect.xy;\\n  highp vec2 pos = -1.0 + 2.0 * vTexCoord.st/textureSize;\\n  highp float len = length(pos);\\n  highp vec2 texCoord = vTexCoord.st/textureSize + pos/len * sin( len * 12.0 - uTime * 4.0 ) * uAmplitude; \\n  gl_FragColor = texture2D(sTexture, texCoord) * uColor;\\n}\\n\\n\\n\",\n"
+    "        \"fragment\": \"precision mediump float;\\nuniform float uAmplitude; // 0.02; (< 1)\\nuniform float uTime;\\nvoid main()\\n{\\n  highp vec2 textureSize = uTextureRect.zw - uTextureRect.xy;\\n  highp vec2 pos = -1.0 + 2.0 * vTexCoord.st/textureSize;\\n  highp float len = length(pos);\\n  highp vec2 texCoord = vTexCoord.st/textureSize + pos/len * sin( len * 12.0 - uTime * 4.0 ) * uAmplitude; \\n  gl_FragColor = texture2D(sTexture, texCoord) * uColor;\\n}\\n\\n\\n\",\n"
     "        \"geometryType\": \"GEOMETRY_TYPE_IMAGE\"\n"
     "      },\n"
     "      \"geometryHints\": \"HINT_NONE\",\n"
     "        \"geometryType\": \"GEOMETRY_TYPE_IMAGE\"\n"
     "      },\n"
     "      \"geometryHints\": \"HINT_NONE\",\n"
@@ -1241,7 +1241,7 @@ int UtcDaliBuilderFrameBufferP(void)
     "        \"vertexPrefix\": \"\",\n"
     "        \"vertex\": \"void main(void)\\n{\\n  gl_Position = uProjection * uModelView * vec4(aPosition, 1.0);\\n  vTexCoord = aTexCoord;\\n}\\n\\n\",\n"
     "        \"fragmentPrefix\": \"\",\n"
     "        \"vertexPrefix\": \"\",\n"
     "        \"vertex\": \"void main(void)\\n{\\n  gl_Position = uProjection * uModelView * vec4(aPosition, 1.0);\\n  vTexCoord = aTexCoord;\\n}\\n\\n\",\n"
     "        \"fragmentPrefix\": \"\",\n"
-    "        \"fragment\": \"precision mediump float;\\nuniform float uAmplitude; // 0.02; (< 1)\\nuniform float uTime;\\nvoid main()\\n{\\n  highp vec2 textureSize = sTextureRect.zw - sTextureRect.xy;\\n  highp vec2 pos = -1.0 + 2.0 * vTexCoord.st/textureSize;\\n  highp float len = length(pos);\\n  highp vec2 texCoord = vTexCoord.st/textureSize + pos/len * sin( len * 12.0 - uTime * 4.0 ) * uAmplitude; \\n  gl_FragColor = texture2D(sTexture, texCoord) * uColor;\\n}\\n\\n\\n\",\n"
+    "        \"fragment\": \"precision mediump float;\\nuniform float uAmplitude; // 0.02; (< 1)\\nuniform float uTime;\\nvoid main()\\n{\\n  highp vec2 textureSize = uTextureRect.zw - uTextureRect.xy;\\n  highp vec2 pos = -1.0 + 2.0 * vTexCoord.st/textureSize;\\n  highp float len = length(pos);\\n  highp vec2 texCoord = vTexCoord.st/textureSize + pos/len * sin( len * 12.0 - uTime * 4.0 ) * uAmplitude; \\n  gl_FragColor = texture2D(sTexture, texCoord) * uColor;\\n}\\n\\n\\n\",\n"
     "        \"geometryType\": \"GEOMETRY_TYPE_IMAGE\"\n"
     "      },\n"
     "      \"geometryHints\": \"HINT_NONE\",\n"
     "        \"geometryType\": \"GEOMETRY_TYPE_IMAGE\"\n"
     "      },\n"
     "      \"geometryHints\": \"HINT_NONE\",\n"
@@ -1412,7 +1412,7 @@ int UtcDaliBuilderPathConstraintsP(void)
     "        \"vertexPrefix\": \"\",\n"
     "        \"vertex\": \"void main(void)\\n{\\n  gl_Position = uProjection * uModelView * vec4(aPosition, 1.0);\\n  vTexCoord = aTexCoord;\\n}\\n\\n\",\n"
     "        \"fragmentPrefix\": \"\",\n"
     "        \"vertexPrefix\": \"\",\n"
     "        \"vertex\": \"void main(void)\\n{\\n  gl_Position = uProjection * uModelView * vec4(aPosition, 1.0);\\n  vTexCoord = aTexCoord;\\n}\\n\\n\",\n"
     "        \"fragmentPrefix\": \"\",\n"
-    "        \"fragment\": \"precision mediump float;\\nuniform float uAmplitude; // 0.02; (< 1)\\nuniform float uTime;\\nvoid main()\\n{\\n  highp vec2 textureSize = sTextureRect.zw - sTextureRect.xy;\\n  highp vec2 pos = -1.0 + 2.0 * vTexCoord.st/textureSize;\\n  highp float len = length(pos);\\n  highp vec2 texCoord = vTexCoord.st/textureSize + pos/len * sin( len * 12.0 - uTime * 4.0 ) * uAmplitude; \\n  gl_FragColor = texture2D(sTexture, texCoord) * uColor;\\n}\\n\\n\\n\",\n"
+    "        \"fragment\": \"precision mediump float;\\nuniform float uAmplitude; // 0.02; (< 1)\\nuniform float uTime;\\nvoid main()\\n{\\n  highp vec2 textureSize = uTextureRect.zw - uTextureRect.xy;\\n  highp vec2 pos = -1.0 + 2.0 * vTexCoord.st/textureSize;\\n  highp float len = length(pos);\\n  highp vec2 texCoord = vTexCoord.st/textureSize + pos/len * sin( len * 12.0 - uTime * 4.0 ) * uAmplitude; \\n  gl_FragColor = texture2D(sTexture, texCoord) * uColor;\\n}\\n\\n\\n\",\n"
     "        \"geometryType\": \"GEOMETRY_TYPE_IMAGE\"\n"
     "      },\n"
     "      \"geometryHints\": \"HINT_NONE\",\n"
     "        \"geometryType\": \"GEOMETRY_TYPE_IMAGE\"\n"
     "      },\n"
     "      \"geometryHints\": \"HINT_NONE\",\n"
index 71ed07c..9f9deb5 100644 (file)
@@ -52,7 +52,7 @@ inline ShaderEffect CreateBendyEffect()
       "void main()\n"
       "{\n"
       " mediump float lighting = 0.25;\n"
       "void main()\n"
       "{\n"
       " mediump float lighting = 0.25;\n"
-      " mediump vec4 position = uModelView * vec4(aPosition,1.0);\n"
+      " mediump vec4 position = uModelView * vec4(aPosition*uSize.xy, 0.0, 1.0);\n"
       "\n"
       " mediump vec2 d = position.xy - uCenter;\n"
       " mediump float dist = max( 0.0, dot(d,uDirection) );\n"
       "\n"
       " mediump vec2 d = position.xy - uCenter;\n"
       " mediump float dist = max( 0.0, dot(d,uDirection) );\n"
@@ -70,7 +70,7 @@ inline ShaderEffect CreateBendyEffect()
       "\n"
       "vShade = 1.0 - abs(sn) * lighting;\n"
       "\n"
       "\n"
       "vShade = 1.0 - abs(sn) * lighting;\n"
       "\n"
-      "vTexCoord = aTexCoord;\n"
+      "vTexCoord = mix( uTextureRect.xy, uTextureRect.zw, aPosition + vec2(0.5) );\n;\n"
       "}" );
 
   std::string fragmentShader(
       "}" );
 
   std::string fragmentShader(
index dfe7018..67180bd 100644 (file)
@@ -63,14 +63,14 @@ inline ShaderEffect CreateCarouselEffect()
                 "\n"
                 "void main()\n"
                 "{\n"
                 "\n"
                 "void main()\n"
                 "{\n"
-                "    mediump vec4 world = uModelView * vec4(aPosition,1.0);\n"
+                "    mediump vec4 world = uModelView * vec4(aPosition*uSize.xy, 0.0, 1.0);\n"
                 "    mediump vec2 d = (world.xy - uCenter) * uAnglePerUnit;\n"
                 "    mediump float a = length(d);\n"
                 "    mediump float cs = cos(radians(a));\n"
                 "    world.z -= cs * uRadius;\n"
                 "    gl_Position = uProjection * world;\n"
                 "    \n"
                 "    mediump vec2 d = (world.xy - uCenter) * uAnglePerUnit;\n"
                 "    mediump float a = length(d);\n"
                 "    mediump float cs = cos(radians(a));\n"
                 "    world.z -= cs * uRadius;\n"
                 "    gl_Position = uProjection * world;\n"
                 "    \n"
-                "    vTexCoord = aTexCoord;\n"
+                "    vTexCoord = mix( uTextureRect.xy, uTextureRect.zw, aPosition + vec2(0.5) );\n;\n"
                 "}\n");
 
     ShaderEffect shaderEffect = ShaderEffect::New(
                 "}\n");
 
     ShaderEffect shaderEffect = ShaderEffect::New(
index 3a244fc..c91abdc 100644 (file)
@@ -54,7 +54,7 @@ inline ShaderEffect CreateDissolveLocalEffect( unsigned int numberOfDimples )
       "varying float vPercentage;\n"
       "void main()\n"
       "{\n"
       "varying float vPercentage;\n"
       "void main()\n"
       "{\n"
-      "  vec4 position = uModelView * vec4( aPosition, 1.0 );\n"
+      "  vec4 position = uModelView * vec4( aPosition*uSize.xy, 0.0,  1.0 );\n"
       "  float percentage = 0.0;\n"
       "  for( int i=0; i<NUMBER_OF_DIMPLE; ++i )\n"
       "  {\n"
       "  float percentage = 0.0;\n"
       "  for( int i=0; i<NUMBER_OF_DIMPLE; ++i )\n"
       "  {\n"
@@ -63,7 +63,7 @@ inline ShaderEffect CreateDissolveLocalEffect( unsigned int numberOfDimples )
       "  }\n"
       "  vPercentage = clamp( percentage, 0.0, 1.0 );\n"
       "  gl_Position = uProjection * position;\n"
       "  }\n"
       "  vPercentage = clamp( percentage, 0.0, 1.0 );\n"
       "  gl_Position = uProjection * position;\n"
-      "  vTexCoord = aTexCoord;\n"
+      "  vTexCoord = mix( uTextureRect.xy, uTextureRect.zw, aPosition + vec2(0.5) );\n;\n"
       "}\n");
   vertexShaderStringStream << vertexShader;
 
       "}\n");
   vertexShaderStringStream << vertexShader;
 
index 7d263d9..4f3f3f1 100644 (file)
@@ -59,10 +59,10 @@ inline Property::Map CreateImageRegionEffect()
       "  position.xyz *= uSize;\n"
       "  gl_Position = uMvpMatrix * position;\n"
       // The line below is doing the same as the following commented lines:
       "  position.xyz *= uSize;\n"
       "  gl_Position = uMvpMatrix * position;\n"
       // The line below is doing the same as the following commented lines:
-      //"  vec2 imageSize = sTextureRect.zw - sTextureRect.xy;\n"
-      //"  vec2 topLeft = sTextureRect.xy + uTopLeft * imageSize;\n"
-      //"  vec2 bottomRight = sTextureRect.xy + uBottomRight * imageSize;\n"
-      //"  vec2 texCoord = (aTexCoord - sTextureRect.xy) / imageSize;\n"
+      //"  vec2 imageSize = uTextureRect.zw - uTextureRect.xy;\n"
+      //"  vec2 topLeft = uTextureRect.xy + uTopLeft * imageSize;\n"
+      //"  vec2 bottomRight = uTextureRect.xy + uBottomRight * imageSize;\n"
+      //"  vec2 texCoord = (aTexCoord - uTextureRect.xy) / imageSize;\n"
       //"  vTexCoord = topLeft + texCoord * ( bottomRight - topLeft );\n"
 
       "  vec2 texCoord = aPosition + vec2(0.5);\n"
       //"  vTexCoord = topLeft + texCoord * ( bottomRight - topLeft );\n"
 
       "  vec2 texCoord = aPosition + vec2(0.5);\n"
index 2304748..48e6f11 100644 (file)
@@ -55,11 +55,11 @@ inline ShaderEffect CreateIrisEffect()
       "\n"
       "void main()\n"
       "{\n"
       "\n"
       "void main()\n"
       "{\n"
-      "    mediump vec4 world = uModelView * vec4(aPosition,1.0);\n"
+      "    mediump vec4 world = uModelView * vec4(aPosition*uSize.xy, 0.0, 1.0);\n"
       "    gl_Position = uProjection * world;\n"
       "    \n"
       "    gl_Position = uProjection * world;\n"
       "    \n"
-      "    vTexCoord = aTexCoord;\n"
-      "    vRelativePosition = aTexCoord - uCenter;\n"
+      "    vTexCoord = mix( uTextureRect.xy, uTextureRect.zw, aPosition + vec2(0.5) );;\n"
+      "    vRelativePosition = vTexCoord - uCenter;\n"
       "}\n");
 
   std::string fragmentShader(
       "}\n");
 
   std::string fragmentShader(
index 06eb019..edf7ffd 100644 (file)
@@ -43,11 +43,11 @@ inline ShaderEffect CreateMirrorEffect()
   std::string vertexShader(
       "void main()                                  \n"
       "{                                            \n"
   std::string vertexShader(
       "void main()                                  \n"
       "{                                            \n"
-      "  mediump vec3 pos = aPosition;              \n"
+      "  mediump vec3 pos = vec3(aPosition, 0.0)*uSize;              \n"
       "  pos.y = pos.y * 3.0;                       \n"
       "  mediump vec4 world = uModelView * vec4(pos,1.0); \n"
       "  gl_Position = uProjection * world;         \n"
       "  pos.y = pos.y * 3.0;                       \n"
       "  mediump vec4 world = uModelView * vec4(pos,1.0); \n"
       "  gl_Position = uProjection * world;         \n"
-      "  vTexCoord = aTexCoord;                     \n"
+      "  vTexCoord = mix( uTextureRect.xy, uTextureRect.zw, aPosition + vec2(0.5) ); \n"
       "}                                            \n" );
 
   std::string fragmentShader(
       "}                                            \n" );
 
   std::string fragmentShader(
index 39d0a13..dd71982 100644 (file)
@@ -52,7 +52,7 @@ inline ShaderEffect CreateRippleEffect()
       "{\n"
       "float lighting = uAmplitude * 0.02;\n"
       "float waveLength = uAmplitude * 0.0016;\n"
       "{\n"
       "float lighting = uAmplitude * 0.02;\n"
       "float waveLength = uAmplitude * 0.0016;\n"
-      "vec4 world = uModelView * vec4(aPosition,1.0);\n"
+      "vec4 world = uModelView * vec4(aPosition*uSize.xy, 0.0, 1.0);\n"
       "vec2 d = vec2(world.x - uCenter.x, world.y - uCenter.y);\n"
       "float dist = length(d);\n"
       "float amplitude = cos(uTime - dist*waveLength);\n"
       "vec2 d = vec2(world.x - uCenter.x, world.y - uCenter.y);\n"
       "float dist = length(d);\n"
       "float amplitude = cos(uTime - dist*waveLength);\n"
@@ -67,7 +67,7 @@ inline ShaderEffect CreateRippleEffect()
       "}\n"
       "vShade = 1.0 - (dot * slope);\n"
       "vLight = max(0.0, dot * -slope);\n"
       "}\n"
       "vShade = 1.0 - (dot * slope);\n"
       "vLight = max(0.0, dot * -slope);\n"
-      "vTexCoord = aTexCoord;\n"
+      "vTexCoord = mix( uTextureRect.xy, uTextureRect.zw, aPosition + vec2(0.5) );\n;\n"
       "}" );
 
   // append the default version
       "}" );
 
   // append the default version
index cbef85b..782c440 100644 (file)
@@ -47,7 +47,7 @@ inline ShaderEffect CreateRipple2DEffect()
       "uniform float uTime;\n"
       "void main()\n"
       "{\n"
       "uniform float uTime;\n"
       "void main()\n"
       "{\n"
-      "  highp vec2 textureSize = sTextureRect.zw - sTextureRect.xy;\n"
+      "  highp vec2 textureSize = uTextureRect.zw - uTextureRect.xy;\n"
       "  highp vec2 pos = -1.0 + 2.0 * vTexCoord.st/textureSize;\n"
       "  highp float len = length(pos);\n"
       "  highp vec2 texCoord = vTexCoord.st/textureSize + pos/len * sin( len * 12.0 - uTime * 4.0 ) * uAmplitude;\n"
       "  highp vec2 pos = -1.0 + 2.0 * vTexCoord.st/textureSize;\n"
       "  highp float len = length(pos);\n"
       "  highp vec2 texCoord = vTexCoord.st/textureSize + pos/len * sin( len * 12.0 - uTime * 4.0 ) * uAmplitude;\n"
index edea72e..5b8faf9 100644 (file)
@@ -49,14 +49,14 @@ inline ShaderEffect CreateShearEffect()
       "\n"
       "void main()\n"
       "{\n"
       "\n"
       "void main()\n"
       "{\n"
-      "mediump vec4 world = uModelView * vec4(aPosition,1.0);\n"
+      "mediump vec4 world = uModelView * vec4(aPosition*uSize.xy, 0.0, 1.0);\n"
       "\n"
       "world.x = world.x + tan(radians(uAngleXAxis)) * (world.y - uCenter.y * world.w);\n"
       "world.y = world.y + tan(radians(uAngleYAxis)) * (world.x - uCenter.x * world.w);\n"
       "\n"
       "gl_Position = uProjection * world;\n"
       "\n"
       "\n"
       "world.x = world.x + tan(radians(uAngleXAxis)) * (world.y - uCenter.y * world.w);\n"
       "world.y = world.y + tan(radians(uAngleYAxis)) * (world.x - uCenter.x * world.w);\n"
       "\n"
       "gl_Position = uProjection * world;\n"
       "\n"
-      "vTexCoord = aTexCoord;\n"
+      "vTexCoord = mix( uTextureRect.xy, uTextureRect.zw, aPosition + vec2(0.5) );\n;\n"
       "}" );
 
   // Create the implementation, temporarily owned on stack,
       "}" );
 
   // Create the implementation, temporarily owned on stack,
index 710537e..55adafb 100644 (file)
@@ -117,11 +117,11 @@ inline ShaderEffect CreateSoftButtonEffect(SoftButtonEffectType type)
 
       "void main()\n"
       "{\n"
 
       "void main()\n"
       "{\n"
-      "  vTexCoord = aTexCoord;\n"
+      "  vTexCoord = mix( uTextureRect.xy, uTextureRect.zw, aPosition + vec2(0.5) );\n;\n"
       // Get the rect coords of the effect region in -1..1 range, i.e. circle centred around the center of the rect
       // Done in the vertex shader itself to make use of gl interpolation for varying.
       "  vCentredCoord = vec2( ( (vTexCoord.x - uEffectRegion.x)/(uEffectRegion.z - uEffectRegion.x) * 2.0 - 1.0 ), ( (vTexCoord.y - uEffectRegion.y)/(uEffectRegion.w - uEffectRegion.y) * 2.0 - 1.0  ) );\n"
       // Get the rect coords of the effect region in -1..1 range, i.e. circle centred around the center of the rect
       // Done in the vertex shader itself to make use of gl interpolation for varying.
       "  vCentredCoord = vec2( ( (vTexCoord.x - uEffectRegion.x)/(uEffectRegion.z - uEffectRegion.x) * 2.0 - 1.0 ), ( (vTexCoord.y - uEffectRegion.y)/(uEffectRegion.w - uEffectRegion.y) * 2.0 - 1.0  ) );\n"
-      "  gl_Position = uMvpMatrix * vec4(aPosition, 1.0);\n"
+      "  gl_Position = uMvpMatrix * vec4(aPosition*uSize.xy, 0.0, 1.0);\n"
       "}\n";
 
   std::string fragmentSourceFixed;
       "}\n";
 
   std::string fragmentSourceFixed;
index 7880421..2cff9ee 100644 (file)
@@ -48,7 +48,7 @@ inline ShaderEffect CreateSpotEffect()
       "\n"
       "void main()\n"
       "{\n"
       "\n"
       "void main()\n"
       "{\n"
-      "  mediump vec4 world = vec4(aPosition, 1.0);\n"
+      "  mediump vec4 world = vec4(aPosition*uSize.xy, 0.0, 1.0);\n"
       "  \n"
       "  mediump vec2 d = vec2(world.xy - uCenter);\n"
       "  mediump float dist = length(d);\n"
       "  \n"
       "  mediump vec2 d = vec2(world.xy - uCenter);\n"
       "  mediump float dist = length(d);\n"
@@ -57,7 +57,7 @@ inline ShaderEffect CreateSpotEffect()
       "  vRange = max(0.1, range);\n"
       "  \n"
       "  gl_Position = uMvpMatrix * world;\n"
       "  vRange = max(0.1, range);\n"
       "  \n"
       "  gl_Position = uMvpMatrix * world;\n"
-      "  vTexCoord = aTexCoord;\n"
+      "  vTexCoord = mix( uTextureRect.xy, uTextureRect.zw, aPosition + vec2(0.5) );\n;\n"
       "}");
 
   std::string fragmentShader(
       "}");
 
   std::string fragmentShader(
index 020b320..3c8b36f 100644 (file)
@@ -50,7 +50,7 @@ inline ShaderEffect CreateSwirlEffect( bool warp )
       "uniform mediump vec2  uCenter;\n"
       "void main()\n"
       "{\n"
       "uniform mediump vec2  uCenter;\n"
       "void main()\n"
       "{\n"
-      "  highp vec2 textureCenter = (sTextureRect.xy + sTextureRect.zw) * 0.5;\n"
+      "  highp vec2 textureCenter = (uTextureRect.xy + uTextureRect.zw) * 0.5;\n"
       "  textureCenter = vTexCoord.st - textureCenter;\n"
       "  highp float distance = length(textureCenter);\n"
       "  if (distance >= uRadius)\n"
       "  textureCenter = vTexCoord.st - textureCenter;\n"
       "  highp float distance = length(textureCenter);\n"
       "  if (distance >= uRadius)\n"
index 3f6727f..532f553 100644 (file)
@@ -51,14 +51,6 @@ namespace Internal
  **/
 inline ShaderEffect CreatePageTurnBookSpineEffect()
 {
  **/
 inline ShaderEffect CreatePageTurnBookSpineEffect()
 {
-  std::string vertexSource = DALI_COMPOSE_SHADER(
-      precision mediump float;\n
-      void main()\n
-      {\n
-          gl_Position = uProjection * uModelView * vec4(aPosition, 1.0);\n
-          vTexCoord = aTexCoord;\n
-      }\n);
-
   // the simplified version of the fragment shader of page turn effect
   std::string fragmentSource = DALI_COMPOSE_SHADER(
       precision mediump float;\n
   // the simplified version of the fragment shader of page turn effect
   std::string fragmentSource = DALI_COMPOSE_SHADER(
       precision mediump float;\n
@@ -69,11 +61,11 @@ inline ShaderEffect CreatePageTurnBookSpineEffect()
       {\n
       // flip the image horizontally by changing the x component of the texture coordinate
         if( uIsBackImageVisible == 1.0 )\n
       {\n
       // flip the image horizontally by changing the x component of the texture coordinate
         if( uIsBackImageVisible == 1.0 )\n
-          gl_FragColor = texture2D( sTexture, vec2( sTextureRect.p+sTextureRect.s-vTexCoord.x, vTexCoord.y ) ) * uColor; \n
+          gl_FragColor = texture2D( sTexture, vec2( uTextureRect.p+uTextureRect.s-vTexCoord.x, vTexCoord.y ) ) * uColor; \n
         else\n
         gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor;\n
       // display book spine, a stripe of shadowed texture
         else\n
         gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor;\n
       // display book spine, a stripe of shadowed texture
-        float pixelPos = (vTexCoord.x-sTextureRect.s)*uPageWidth; \n
+        float pixelPos = (vTexCoord.x-uTextureRect.s)*uPageWidth; \n
         if(pixelPos < uSpineShadowParameter.x) \n
         {\n
           float x = pixelPos - uSpineShadowParameter.x;\n
         if(pixelPos < uSpineShadowParameter.x) \n
         {\n
           float x = pixelPos - uSpineShadowParameter.x;\n
@@ -85,7 +77,7 @@ inline ShaderEffect CreatePageTurnBookSpineEffect()
 
   const Vector2 DEFAULT_SPINE_SHADOW_PARAMETER(50.0f, 20.0f);
 
 
   const Vector2 DEFAULT_SPINE_SHADOW_PARAMETER(50.0f, 20.0f);
 
-  ShaderEffect shaderEffect = ShaderEffect::New( vertexSource, fragmentSource );
+  ShaderEffect shaderEffect = ShaderEffect::New( "", fragmentSource );
 
   shaderEffect.SetUniform( "uIsBackImageVisible", -1.f );
   shaderEffect.SetUniform( "uSpineShadowParameter", DEFAULT_SPINE_SHADOW_PARAMETER );
 
   shaderEffect.SetUniform( "uIsBackImageVisible", -1.f );
   shaderEffect.SetUniform( "uSpineShadowParameter", DEFAULT_SPINE_SHADOW_PARAMETER );
index 3684e70..233a3a1 100644 (file)
@@ -127,7 +127,7 @@ ShaderEffect Dali::Toolkit::Internal::CreatePageTurnEffect()
       \n
       void main()\n
       {\n
       \n
       void main()\n
       {\n
-        vec4 position = vec4( aPosition.xy, 0.0, 1.0);\n
+        vec4 position = vec4( aPosition*uSize.xy, 0.0, 1.0);\n
         vec2 currentCenter = vec2( uCommonParameters[1][2], uCommonParameters[1][3]);\n
         vec2 originalCenter = vec2( uCommonParameters[0][2], uCommonParameters[0][3]);\n
         vec3 normal = vec3(0.0,0.0,1.0);\n
         vec2 currentCenter = vec2( uCommonParameters[1][2], uCommonParameters[1][3]);\n
         vec2 originalCenter = vec2( uCommonParameters[0][2], uCommonParameters[0][3]);\n
         vec3 normal = vec3(0.0,0.0,1.0);\n
@@ -246,10 +246,9 @@ ShaderEffect Dali::Toolkit::Internal::CreatePageTurnEffect()
           // change the coordinate origin from the top-left of the page to its center
           position.xy -= uPageSize * 0.5; \n
         }\n
           // change the coordinate origin from the top-left of the page to its center
           position.xy -= uPageSize * 0.5; \n
         }\n
-        position.z += aPosition.z;\n
         gl_Position = uMvpMatrix * position;\n
         // varying parameters for fragment shader
         gl_Position = uMvpMatrix * position;\n
         // varying parameters for fragment shader
-        vTexCoord = aTexCoord;
+        vTexCoord = mix( uTextureRect.xy, uTextureRect.zw, aPosition + vec2(0.5) );\n;
         vNormal = uNormalMatrix*normal;\n
         vPosition = uModelView * position;\n
       }\n
         vNormal = uNormalMatrix*normal;\n
         vPosition = uModelView * position;\n
       }\n
@@ -271,11 +270,11 @@ ShaderEffect Dali::Toolkit::Internal::CreatePageTurnEffect()
         float spineShadowCoef = 1.0; \n
         // display page content
         // display back image of the page, flip the texture
         float spineShadowCoef = 1.0; \n
         // display page content
         // display back image of the page, flip the texture
-        if(  dot(vPosition.xyz, normal) > 0.0 ) texel = texture2D( sTexture, vec2( sTextureRect.p+sTextureRect.s-vTexCoord.x, vTexCoord.y ) );\n
+        if(  dot(vPosition.xyz, normal) > 0.0 ) texel = texture2D( sTexture, vec2( uTextureRect.p+uTextureRect.s-vTexCoord.x, vTexCoord.y ) );\n
         // display front image of the page
         else texel = texture2D( sTexture, vTexCoord );\n
         // display book spine, a stripe of shadowed texture
         // display front image of the page
         else texel = texture2D( sTexture, vTexCoord );\n
         // display book spine, a stripe of shadowed texture
-        float pixelPos = (vTexCoord.x-sTextureRect.s)*uPageSize.x; \n
+        float pixelPos = (vTexCoord.x-uTextureRect.s)*uPageSize.x; \n
         if(pixelPos < uSpineShadowParameter.x) \n
         {\n
           float x = pixelPos - uSpineShadowParameter.x;\n
         if(pixelPos < uSpineShadowParameter.x) \n
         {\n
           float x = pixelPos - uSpineShadowParameter.x;\n