-const char * const BORDER_ONLY("borderOnly");
-
-const char* VERTEX_SHADER = DALI_COMPOSE_SHADER(
- attribute mediump vec2 aPosition;\n
- varying mediump vec2 vTexCoord;\n
- uniform mediump mat4 uMvpMatrix;\n
- uniform mediump vec3 uSize;\n
- uniform mediump vec2 uNinePatchFactorsX[ FACTOR_SIZE_X ];\n
- uniform mediump vec2 uNinePatchFactorsY[ FACTOR_SIZE_Y ];\n
- \n
-
- //Visual size and offset
- uniform mediump vec2 offset;\n
- uniform mediump vec2 size;\n
- uniform mediump vec4 offsetSizeMode;\n
- uniform mediump vec2 origin;\n
- uniform mediump vec2 anchorPoint;\n
-
- void main()\n
- {\n
- mediump vec2 fixedFactor = vec2( uNinePatchFactorsX[ int( ( aPosition.x + 1.0 ) * 0.5 ) ].x, uNinePatchFactorsY[ int( ( aPosition.y + 1.0 ) * 0.5 ) ].x );\n
- mediump vec2 stretch = vec2( uNinePatchFactorsX[ int( ( aPosition.x ) * 0.5 ) ].y, uNinePatchFactorsY[ int( ( aPosition.y ) * 0.5 ) ].y );\n
- \n
- mediump vec2 fixedTotal = vec2( uNinePatchFactorsX[ FACTOR_SIZE_X - 1 ].x, uNinePatchFactorsY[ FACTOR_SIZE_Y - 1 ].x );\n
- mediump vec2 stretchTotal = vec2( uNinePatchFactorsX[ FACTOR_SIZE_X - 1 ].y, uNinePatchFactorsY[ FACTOR_SIZE_Y - 1 ].y );\n
- \n
-
- vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw );\n
- vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy);\n
-
- mediump vec4 vertexPosition = vec4( ( fixedFactor + ( visualSize.xy - fixedTotal ) * stretch / stretchTotal ) + anchorPoint*visualSize + (visualOffset + origin)*uSize.xy, 0.0, 1.0 );\n
- vertexPosition.xy -= visualSize.xy * vec2( 0.5, 0.5 );\n
-
- vertexPosition = uMvpMatrix * vertexPosition;\n
- \n
- vTexCoord = ( fixedFactor + stretch ) / ( fixedTotal + stretchTotal );\n
- \n
- gl_Position = vertexPosition;\n
- }\n
-);
-
-const char* VERTEX_SHADER_3X3 = DALI_COMPOSE_SHADER(
- attribute mediump vec2 aPosition;\n
- varying mediump vec2 vTexCoord;\n
- uniform mediump mat4 uModelMatrix;\n
- uniform mediump mat4 uMvpMatrix;\n
- uniform mediump vec3 uSize;\n
- uniform mediump vec2 uFixed[ 3 ];\n
- uniform mediump vec2 uStretchTotal;\n
- \n
-
- //Visual size and offset
- uniform mediump vec2 offset;\n
- uniform mediump vec2 size;\n
- uniform mediump vec4 offsetSizeMode;\n
- uniform mediump vec2 origin;\n
- uniform mediump vec2 anchorPoint;\n
-
- void main()\n
- {\n
- vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw );\n
- vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy);\n
-
- mediump vec2 scale = vec2( length( uModelMatrix[ 0 ].xyz ), length( uModelMatrix[ 1 ].xyz ) );\n
- mediump vec2 size = visualSize.xy;\n
- \n
- mediump vec2 fixedFactor = vec2( uFixed[ int( ( aPosition.x + 1.0 ) * 0.5 ) ].x, uFixed[ int( ( aPosition.y + 1.0 ) * 0.5 ) ].y );\n
- mediump vec2 stretch = floor( aPosition * 0.5 );\n
- mediump vec2 fixedTotal = uFixed[ 2 ];\n
- \n
- mediump vec4 vertexPosition = vec4( fixedFactor + ( size - fixedTotal ) * stretch, 0.0, 1.0 );
- vertexPosition.xy -= size * vec2( 0.5, 0.5 );\n
- vertexPosition.xy = vertexPosition.xy + anchorPoint*size + (visualOffset + origin)*uSize.xy;\
- \n
- vertexPosition = uMvpMatrix * vertexPosition;\n
- \n
- vTexCoord = ( fixedFactor + stretch * uStretchTotal ) / ( fixedTotal + uStretchTotal );\n
- \n
- gl_Position = vertexPosition;\n
- }\n
-);
-
-const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
- varying mediump vec2 vTexCoord;\n
- uniform sampler2D sTexture;\n
- uniform lowp vec4 uColor;\n
- uniform lowp vec3 mixColor;\n
- uniform lowp float opacity;\n
- uniform lowp float preMultipliedAlpha;\n
- lowp vec4 visualMixColor()\n
- {\n
- return vec4( mixColor * mix( 1.0, opacity, preMultipliedAlpha ), opacity );\n
- }\n
- void main()\n
- {\n
- gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor * visualMixColor();\n
- }\n
-);
-
-/**
- * @brief Creates the geometry formed from the vertices and indices
- *
- * @param[in] vertices The vertices to generate the geometry from
- * @param[in] indices The indices to generate the geometry from
- * @return The geometry formed from the vertices and indices
- */
-Geometry GenerateGeometry( const Vector< Vector2 >& vertices, const Vector< unsigned short >& indices )
-{
- Property::Map vertexFormat;
- vertexFormat[ "aPosition" ] = Property::VECTOR2;
- PropertyBuffer vertexPropertyBuffer = PropertyBuffer::New( vertexFormat );
- if( vertices.Size() > 0 )
- {
- vertexPropertyBuffer.SetData( &vertices[ 0 ], vertices.Size() );
- }
-
- // Create the geometry object
- Geometry geometry = Geometry::New();
- geometry.AddVertexBuffer( vertexPropertyBuffer );
- if( indices.Size() > 0 )
- {
- geometry.SetIndexBuffer( &indices[ 0 ], indices.Size() );
- }
-
-
- return geometry;