- const char* prefixHighPrecision( "precision highp float;\n");
- const char* prefixMediumPrecision( "precision mediump float;\n" );
-
- const char* vertexShader( DALI_COMPOSE_SHADER(
- attribute mediump vec2 aPosition;\n
- \n
- uniform mediump mat4 uMvpMatrix;\n
- uniform vec3 uSize;\n
- uniform vec4 uTextureRect;
- \n
- uniform float uPercentage;\n
- uniform vec3 uSaddleParam;\n
- uniform vec2 uTranslation;\n
- uniform vec2 uRotation; \n
- uniform float uToNext;\n
- \n
- varying float vPercentage;\n
- varying vec2 vTexCoord;\n
-
- void main()\n
- {\n
- mediump vec4 vertexPosition = vec4(aPosition, 0.0, 1.0);\n
- vertexPosition.xyz *= uSize;\n
- vertexPosition = uMvpMatrix * vertexPosition;\n
- gl_Position = vertexPosition;\n
-
- vec2 texCoord = aPosition + vec2(0.5);
- vTexCoord = texCoord;\n
- //Calculate the distortion value given the dissolve central line
- vec2 value = texCoord + uTranslation; \n
- mat2 rotateMatrix = mat2( uRotation.s, uRotation.t, -uRotation.t, uRotation.s ); \n
- value = rotateMatrix * value; \n
- if(uToNext == 1.0) \n
- value.s = uSaddleParam[2] + value.s; \n
- float delay = value.t*value.t / uSaddleParam[0] - value.s*value.s/uSaddleParam[1];\n
- vPercentage = clamp( uPercentage*2.0 - 0.5*sin(delay*1.571) - 0.5, 0.0, 1.0 ); \n
- })
- );
-
- const char* fragmentShader( DALI_COMPOSE_SHADER(
- varying float vPercentage;\n
- varying mediump vec2 vTexCoord;\n
- \n
- uniform sampler2D sTexture;\n
- uniform lowp vec4 uColor;\n
- uniform vec4 uTextureRect;
- \n
- float rand(vec2 co) \n
- {\n
- return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453); \n
- }\n
- \n
- void main()\n
- {\n
-
- //Calculate the randomness
- float offsetS = rand( vTexCoord * vPercentage ) - vTexCoord.s; \n
- float offsetT = rand( vec2(vTexCoord.t*vPercentage, vTexCoord.s * vPercentage) ) - vTexCoord.t; \n
- vec2 lookupCoord = vTexCoord + vec2(offsetS, offsetT) * vPercentage; \n
- gl_FragColor = texture2D( sTexture, lookupCoord ) * uColor; \n
- gl_FragColor.a *= 1.0 - vPercentage; \n
- } )
- );
+ const char* prefixHighPrecision("precision highp float;\n");
+ const char* prefixMediumPrecision("precision mediump float;\n");
+
+ const char* vertexShader(
+ "attribute mediump vec2 aPosition;\n"
+ "\n"
+ "uniform mediump mat4 uMvpMatrix;\n"
+ "uniform vec3 uSize;\n"
+ "uniform vec4 uTextureRect;"
+ "\n"
+ "uniform float uPercentage;\n"
+ "uniform vec3 uSaddleParam;\n"
+ "uniform vec2 uTranslation;\n"
+ "uniform vec2 uRotation; \n"
+ "uniform float uToNext;\n"
+ "\n"
+ "varying float vPercentage;\n"
+ "varying vec2 vTexCoord;\n"
+ "\n"
+ "void main()\n"
+ "{\n"
+ " mediump vec4 vertexPosition = vec4(aPosition, 0.0, 1.0);\n"
+ " vertexPosition.xyz *= uSize;\n"
+ " vertexPosition = uMvpMatrix * vertexPosition;\n"
+ " gl_Position = vertexPosition;\n"
+ "\n"
+ " vec2 texCoord = aPosition + vec2(0.5);\n"
+ " vTexCoord = texCoord;\n"
+ "\n"
+ " //Calculate the distortion value given the dissolve central line\n"
+ " vec2 value = texCoord + uTranslation;\n"
+ " mat2 rotateMatrix = mat2(uRotation.s, uRotation.t, -uRotation.t, uRotation.s);\n"
+ " value = rotateMatrix * value;\n"
+ " if(uToNext == 1.0)\n"
+ " value.s = uSaddleParam[2] + value.s;\n"
+ " float delay = value.t * value.t / uSaddleParam[0] - value.s * value.s / uSaddleParam[1];\n"
+ " vPercentage = clamp(uPercentage * 2.0 - 0.5 * sin(delay * 1.571) - 0.5, 0.0, 1.0);\n"
+ "}\n");
+
+ const char* fragmentShader(
+ "varying float vPercentage;\n"
+ "varying mediump vec2 vTexCoord;\n"
+ "\n"
+ "uniform sampler2D sTexture;\n"
+ "uniform lowp vec4 uColor;\n"
+ "uniform vec4 uTextureRect;\n"
+ "float rand(vec2 co)\n"
+ "{\n"
+ " return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n"
+ "}\n"
+ "void main()\n"
+ "{\n"
+ " //Calculate the randomness\n"
+ " float offsetS = rand(vTexCoord * vPercentage) - vTexCoord.s;\n"
+ " float offsetT = rand(vec2(vTexCoord.t * vPercentage, vTexCoord.s * vPercentage)) - vTexCoord.t;\n"
+ " vec2 lookupCoord = vTexCoord + vec2(offsetS, offsetT) * vPercentage;\n"
+ " gl_FragColor = texture2D(sTexture, lookupCoord) * uColor;\n"
+ " gl_FragColor.a *= 1.0 - vPercentage;\n"
+ "}\n");