Merge "DGEUF-110: Limit ScrollView to scroll maximum 1 page on flick" into devel...
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / renderers / npatch / npatch-renderer.cpp
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19 #include "npatch-renderer.h"
20
21 // EXTERNAL INCLUDES
22 #include <dali/integration-api/platform-abstraction.h>
23 #include <dali/public-api/images/buffer-image.h>
24 #include <dali/public-api/images/resource-image.h>
25
26 // INTERNAL IINCLUDES
27 #include <dali-toolkit/internal/controls/renderers/renderer-factory-impl.h>
28 #include <dali-toolkit/internal/controls/renderers/renderer-factory-cache.h>
29 #include <dali-toolkit/internal/controls/renderers/control-renderer-impl.h>
30 #include <dali-toolkit/internal/controls/renderers/control-renderer-data-impl.h>
31
32
33 namespace Dali
34 {
35
36 namespace Toolkit
37 {
38
39 namespace Internal
40 {
41
42 namespace
43 {
44 const char * const RENDERER_TYPE("renderer-type");
45 const char * const RENDERER_TYPE_VALUE("n-patch-renderer");
46
47 const char * const IMAGE_URL_NAME("image-url");
48 const char * const BORDER_ONLY("border-only");
49
50 std::string TEXTURE_UNIFORM_NAME = "sTexture";
51
52 const char* VERTEX_SHADER = DALI_COMPOSE_SHADER(
53   attribute mediump vec2 aPosition;\n
54   varying mediump vec2 vTexCoord;\n
55   uniform mediump mat4 uMvpMatrix;\n
56   uniform mediump vec3 uSize;\n
57   uniform mediump vec2 uNinePatchFactorsX[ FACTOR_SIZE_X ];\n
58   uniform mediump vec2 uNinePatchFactorsY[ FACTOR_SIZE_Y ];\n
59   \n
60   void main()\n
61   {\n
62     mediump vec2 fixedFactor  = vec2( uNinePatchFactorsX[ int( ( aPosition.x + 1.0 ) * 0.5 ) ].x, uNinePatchFactorsY[ int( ( aPosition.y + 1.0 ) * 0.5 ) ].x );\n
63     mediump vec2 stretch      = vec2( uNinePatchFactorsX[ int( ( aPosition.x       ) * 0.5 ) ].y, uNinePatchFactorsY[ int( ( aPosition.y       ) * 0.5 ) ].y );\n
64     \n
65     mediump vec2 fixedTotal   = vec2( uNinePatchFactorsX[ FACTOR_SIZE_X - 1 ].x, uNinePatchFactorsY[ FACTOR_SIZE_Y - 1 ].x );\n
66     mediump vec2 stretchTotal = vec2( uNinePatchFactorsX[ FACTOR_SIZE_X - 1 ].y, uNinePatchFactorsY[ FACTOR_SIZE_Y - 1 ].y );\n
67     \n
68     mediump vec4 vertexPosition = vec4( ( fixedFactor + ( uSize.xy - fixedTotal ) * stretch / stretchTotal ), 0.0, 1.0 );\n
69     vertexPosition.xy -= uSize.xy * vec2( 0.5, 0.5 );\n
70     vertexPosition = uMvpMatrix * vertexPosition;\n
71     \n
72     vTexCoord = ( fixedFactor + stretch ) / ( fixedTotal + stretchTotal );\n
73     \n
74     gl_Position = vertexPosition;\n
75   }\n
76 );
77
78 const char* VERTEX_SHADER_3X3 = DALI_COMPOSE_SHADER(
79     attribute mediump vec2 aPosition;\n
80     varying mediump vec2 vTexCoord;\n
81     uniform mediump mat4 uModelMatrix;\n
82     uniform mediump mat4 uMvpMatrix;\n
83     uniform mediump vec3 uSize;\n
84     uniform mediump vec2 uFixed[ 3 ];\n
85     uniform mediump vec2 uStretchTotal;\n
86     \n
87     void main()\n
88     {\n
89       mediump vec2 scale        = vec2( length( uModelMatrix[ 0 ].xyz ), length( uModelMatrix[ 1 ].xyz ) );\n
90       mediump vec2 size         = uSize.xy * scale;\n
91       \n
92       mediump vec2 fixedFactor  = vec2( uFixed[ int( ( aPosition.x + 1.0 ) * 0.5 ) ].x, uFixed[ int( ( aPosition.y  + 1.0 ) * 0.5 ) ].y );\n
93       mediump vec2 stretch      = floor( aPosition * 0.5 );\n
94       mediump vec2 fixedTotal   = uFixed[ 2 ];\n
95       \n
96       mediump vec4 vertexPosition = vec4( fixedFactor + ( size - fixedTotal ) * stretch, 0.0, 1.0 );\n
97       vertexPosition.xy -= size * vec2( 0.5, 0.5 );\n
98       vertexPosition.xy =  vertexPosition.xy / scale;\n
99       \n
100       vertexPosition = uMvpMatrix * vertexPosition;\n
101       \n
102       vTexCoord = ( fixedFactor + stretch * uStretchTotal ) / ( fixedTotal + uStretchTotal );\n
103       \n
104       gl_Position = vertexPosition;\n
105     }\n
106 );
107
108 const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
109   varying mediump vec2 vTexCoord;\n
110   uniform sampler2D sTexture;\n
111   uniform lowp vec4 uColor;\n
112   \n
113   void main()\n
114   {\n
115     gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor;\n
116   }\n
117 );
118
119 /**
120  * @brief Creates the geometry formed from the vertices and indices
121  *
122  * @param[in]  vertices             The vertices to generate the geometry from
123  * @param[in]  indices              The indices to generate the geometry from
124  * @return The geometry formed from the vertices and indices
125  */
126 Geometry GenerateGeometry( const Vector< Vector2 >& vertices, const Vector< unsigned int >& indices )
127 {
128   Property::Map vertexFormat;
129   vertexFormat[ "aPosition" ] = Property::VECTOR2;
130   PropertyBuffer vertexPropertyBuffer = PropertyBuffer::New( vertexFormat, vertices.Size() );
131   if( vertices.Size() > 0 )
132   {
133     vertexPropertyBuffer.SetData( &vertices[ 0 ] );
134   }
135
136   Property::Map indexFormat;
137   indexFormat[ "indices" ] = Property::INTEGER;
138   PropertyBuffer indexPropertyBuffer = PropertyBuffer::New( indexFormat, indices.Size() );
139   if( indices.Size() > 0 )
140   {
141     indexPropertyBuffer.SetData( &indices[ 0 ] );
142   }
143
144   // Create the geometry object
145   Geometry geometry = Geometry::New();
146   geometry.AddVertexBuffer( vertexPropertyBuffer );
147   geometry.SetIndexBuffer( indexPropertyBuffer );
148
149   return geometry;
150 }
151
152 /**
153  * @brief Adds the indices to form a quad composed off two triangles where the indices are organised in a grid
154  *
155  * @param[out] indices     The indices to add to
156  * @param[in]  rowIdx      The row index to start the quad
157  * @param[in]  nextRowIdx  The index to the next row
158  */
159 void AddQuadIndices( Vector< unsigned int >& indices, unsigned int rowIdx, unsigned int nextRowIdx )
160 {
161   indices.PushBack( rowIdx );
162   indices.PushBack( nextRowIdx + 1 );
163   indices.PushBack( rowIdx + 1 );
164
165   indices.PushBack( rowIdx );
166   indices.PushBack( nextRowIdx );
167   indices.PushBack( nextRowIdx + 1 );
168 }
169
170 void AddVertex( Vector< Vector2 >& vertices, unsigned int x, unsigned int y )
171 {
172   vertices.PushBack( Vector2( x, y ) );
173 }
174
175 void RegisterStretchProperties( Material& material, const char * uniformName, const NinePatchImage::StretchRanges& stretchPixels, uint16_t imageExtent)
176 {
177   uint16_t prevEnd = 0;
178   uint16_t prevFix = 0;
179   uint16_t prevStretch = 0;
180   unsigned int i = 1;
181   for( NinePatchImage::StretchRanges::ConstIterator it = stretchPixels.Begin(); it != stretchPixels.End(); ++it, ++i )
182   {
183     uint16_t start = it->GetX();
184     uint16_t end = it->GetY();
185
186     uint16_t fix = prevFix + start - prevEnd;
187     uint16_t stretch = prevStretch + end - start;
188
189     std::stringstream uniform;
190     uniform << uniformName << "[" << i << "]";
191     material.RegisterProperty( uniform.str(), Vector2( fix, stretch ) );
192
193     prevEnd = end;
194     prevFix = fix;
195     prevStretch = stretch;
196   }
197
198   {
199     prevFix += imageExtent - prevEnd;
200     std::stringstream uniform;
201     uniform << uniformName << "[" << i << "]";
202     material.RegisterProperty( uniform.str(), Vector2( prevFix, prevStretch ) );
203   }
204 }
205
206 } //unnamed namespace
207
208 /////////////////NPatchRenderer////////////////
209
210 NPatchRenderer::NPatchRenderer( RendererFactoryCache& factoryCache )
211 : ControlRenderer( factoryCache ),
212   mBorderOnly( false )
213 {
214 }
215
216 NPatchRenderer::~NPatchRenderer()
217 {
218 }
219
220 void NPatchRenderer::DoInitialize( const Property::Map& propertyMap )
221 {
222   Property::Value* imageURLValue = propertyMap.Find( IMAGE_URL_NAME );
223   if( imageURLValue )
224   {
225     //Read the border-only property first since InitialiseFromImage relies on mBorderOnly to be properly set
226     Property::Value* borderOnlyValue = propertyMap.Find( BORDER_ONLY );
227     if( borderOnlyValue )
228     {
229       borderOnlyValue->Get( mBorderOnly );
230     }
231
232     if( imageURLValue->Get( mImageUrl ) )
233     {
234       NinePatchImage nPatch = NinePatchImage::New( mImageUrl );
235       InitialiseFromImage( nPatch );
236     }
237     else
238     {
239       CreateErrorImage();
240       DALI_LOG_ERROR( "The property '%s' is not a string\n", IMAGE_URL_NAME );
241     }
242   }
243 }
244
245 void NPatchRenderer::GetNaturalSize( Vector2& naturalSize ) const
246 {
247   if( mImage )
248   {
249     naturalSize.x = mImage.GetWidth();
250     naturalSize.y = mImage.GetHeight();
251     return;
252   }
253   else if( !mImageUrl.empty() )
254   {
255     ImageDimensions dimentions = ResourceImage::GetImageSize( mImageUrl );
256     naturalSize.x = dimentions.GetWidth();
257     naturalSize.y = dimentions.GetHeight();
258     return;
259   }
260
261   naturalSize = Vector2::ZERO;
262 }
263
264 void NPatchRenderer::SetClipRect( const Rect<int>& clipRect )
265 {
266   ControlRenderer::SetClipRect( clipRect );
267   //ToDo: renderer responds to the clipRect change
268 }
269
270 void NPatchRenderer::SetOffset( const Vector2& offset )
271 {
272   //ToDo: renderer applies the offset
273 }
274
275 void NPatchRenderer::InitializeRenderer( Renderer& renderer )
276 {
277   Geometry geometry;
278   Shader shader;
279   if( mStretchPixelsX.Size() == 1 && mStretchPixelsY.Size() == 1 )
280   {
281     if( !mBorderOnly )
282     {
283       geometry = mFactoryCache.GetGeometry( RendererFactoryCache::NINE_PATCH_GEOMETRY );
284       if( !geometry )
285       {
286         geometry = CreateGeometry( Uint16Pair( 3, 3 ) );
287         mFactoryCache.SaveGeometry( RendererFactoryCache::NINE_PATCH_GEOMETRY, geometry );
288       }
289     }
290     else
291     {
292       geometry = mFactoryCache.GetGeometry( RendererFactoryCache::NINE_PATCH_BORDER_GEOMETRY );
293       if( !geometry )
294       {
295         geometry = CreateGeometryBorder( Uint16Pair( 3, 3 ) );
296         mFactoryCache.SaveGeometry( RendererFactoryCache::NINE_PATCH_BORDER_GEOMETRY, geometry );
297       }
298     }
299
300     shader = mFactoryCache.GetShader( RendererFactoryCache::NINE_PATCH_SHADER );
301     if( !shader )
302     {
303       shader = Shader::New( VERTEX_SHADER_3X3, FRAGMENT_SHADER );
304       mFactoryCache.SaveShader( RendererFactoryCache::NINE_PATCH_SHADER, shader );
305     }
306   }
307   else if( mStretchPixelsX.Size() > 0 || mStretchPixelsY.Size() > 0)
308   {
309     Uint16Pair gridSize( 2 * mStretchPixelsX.Size() + 1,  2 * mStretchPixelsY.Size() + 1 );
310     geometry = !mBorderOnly ? CreateGeometry( gridSize ) : CreateGeometryBorder( gridSize );
311
312     std::stringstream vertexShader;
313     vertexShader << "#define FACTOR_SIZE_X " << mStretchPixelsX.Size() + 2 << "\n"
314                  << "#define FACTOR_SIZE_Y " << mStretchPixelsY.Size() + 2 << "\n"
315                  << VERTEX_SHADER;
316
317     shader = Shader::New( vertexShader.str(), FRAGMENT_SHADER );
318   }
319   else
320   {
321     DALI_LOG_ERROR("The 9 patch image '%s' doesn't have any valid stretch borders and so is not a valid 9 patch image\n", mImageUrl.c_str() );
322     CreateErrorImage();
323   }
324
325   if( !renderer )
326   {
327     Material material = Material::New( shader );
328     renderer = Renderer::New( geometry, material );
329   }
330   else
331   {
332     mImpl->mRenderer.SetGeometry( geometry );
333     Material material = mImpl->mRenderer.GetMaterial();
334     if( material )
335     {
336       material.SetShader( shader );
337     }
338   }
339 }
340
341 void NPatchRenderer::DoSetOnStage( Actor& actor )
342 {
343   if( !mCroppedImage )
344   {
345     if( !mImageUrl.empty() )
346     {
347       NinePatchImage nPatch = NinePatchImage::New( mImageUrl );
348       InitialiseFromImage( nPatch );
349     }
350     else if( mImage )
351     {
352       InitialiseFromImage( mImage );
353     }
354
355     InitializeRenderer( mImpl->mRenderer );
356   }
357
358   if( mCroppedImage )
359   {
360     ApplyImageToSampler();
361   }
362 }
363
364 void NPatchRenderer::DoSetOffStage( Actor& actor )
365 {
366   mCroppedImage.Reset();
367 }
368
369 void NPatchRenderer::DoCreatePropertyMap( Property::Map& map ) const
370 {
371   map.Clear();
372   map.Insert( RENDERER_TYPE, RENDERER_TYPE_VALUE );
373   if( !mImageUrl.empty() )
374   {
375     map.Insert( IMAGE_URL_NAME, mImageUrl );
376   }
377   else if( mImage )
378   {
379     map.Insert( IMAGE_URL_NAME, mImage.GetUrl() );
380   }
381   map.Insert( BORDER_ONLY, mBorderOnly );
382 }
383
384 void NPatchRenderer::SetImage( const std::string& imageUrl, bool borderOnly )
385 {
386   mBorderOnly = borderOnly;
387   mImage.Reset();
388   if( mImageUrl == imageUrl )
389   {
390     return;
391   }
392
393   mImageUrl = imageUrl;
394   NinePatchImage nPatch = NinePatchImage::New( mImageUrl );
395   InitialiseFromImage( nPatch );
396
397   if( mCroppedImage && mImpl->mIsOnStage )
398   {
399     ApplyImageToSampler();
400   }
401 }
402
403 void NPatchRenderer::SetImage( NinePatchImage image, bool borderOnly )
404 {
405   mBorderOnly = borderOnly;
406   mImageUrl.empty();
407   if( mImage == image )
408   {
409     return;
410   }
411
412   mImage = image;
413   InitialiseFromImage( mImage );
414
415   if( mCroppedImage && mImpl->mIsOnStage )
416   {
417     ApplyImageToSampler();
418   }
419 }
420
421 void NPatchRenderer::InitialiseFromImage( NinePatchImage nPatch )
422 {
423   mCroppedImage = nPatch.CreateCroppedBufferImage();
424   if( !mCroppedImage )
425   {
426     DALI_LOG_ERROR("'%s' specify a valid 9 patch image\n", mImageUrl.c_str() );
427     CreateErrorImage();
428     return;
429   }
430
431   mImageSize = ImageDimensions( mCroppedImage.GetWidth(), mCroppedImage.GetHeight() );
432
433   mStretchPixelsX = nPatch.GetStretchPixelsX();
434   mStretchPixelsY = nPatch.GetStretchPixelsY();
435 }
436
437 void NPatchRenderer::CreateErrorImage()
438 {
439   mImageSize = ImageDimensions( 1, 1 );
440
441   BufferImage bufferImage = BufferImage::New( mImageSize.GetWidth(), mImageSize.GetHeight(), Pixel::RGBA8888 );
442   mCroppedImage = bufferImage;
443   PixelBuffer* pixbuf = bufferImage.GetBuffer();
444
445   for( size_t i = 0; i < mImageSize.GetWidth() * mImageSize.GetHeight() * 4u; )
446   {
447     pixbuf[ i++ ] = 0;
448     pixbuf[ i++ ] = 0;
449     pixbuf[ i++ ] = 0;
450     pixbuf[ i++ ] = 255;
451   }
452
453   mStretchPixelsX.Clear();
454   mStretchPixelsX.PushBack( Uint16Pair( 0, mImageSize.GetWidth() ) );
455   mStretchPixelsY.Clear();
456   mStretchPixelsY.PushBack( Uint16Pair( 0, mImageSize.GetHeight() ) );
457
458 }
459
460 void NPatchRenderer::ApplyImageToSampler()
461 {
462   Material material = mImpl->mRenderer.GetMaterial();
463   if( material )
464   {
465     int index = material.GetTextureIndex( TEXTURE_UNIFORM_NAME );
466     if( index > -1 )
467     {
468       material.SetTextureImage( index, mCroppedImage );
469     }
470     else
471     {
472       material.AddTexture(  mCroppedImage, TEXTURE_UNIFORM_NAME );
473     }
474
475     if( mStretchPixelsX.Size() == 1 && mStretchPixelsY.Size() == 1 )
476     {
477       //special case for 9 patch
478       Uint16Pair stretchX = mStretchPixelsX[ 0 ];
479       Uint16Pair stretchY = mStretchPixelsY[ 0 ];
480
481       uint16_t stretchWidth = stretchX.GetY() - stretchX.GetX();
482       uint16_t stretchHeight = stretchY.GetY() - stretchY.GetX();
483
484       material.RegisterProperty( "uFixed[0]", Vector2::ZERO );
485       material.RegisterProperty( "uFixed[1]", Vector2( stretchX.GetX(), stretchY.GetX()) );
486       material.RegisterProperty( "uFixed[2]", Vector2( mImageSize.GetWidth() - stretchWidth, mImageSize.GetHeight() - stretchHeight ) );
487       material.RegisterProperty( "uStretchTotal", Vector2( stretchWidth, stretchHeight ) );
488     }
489     else
490     {
491       material.RegisterProperty( "uNinePatchFactorsX[0]", Vector2::ZERO );
492       material.RegisterProperty( "uNinePatchFactorsY[0]", Vector2::ZERO );
493
494       RegisterStretchProperties( material, "uNinePatchFactorsX", mStretchPixelsX, mImageSize.GetWidth() );
495       RegisterStretchProperties( material, "uNinePatchFactorsY", mStretchPixelsY, mImageSize.GetHeight() );
496     }
497   }
498 }
499
500 Geometry NPatchRenderer::CreateGeometry( Uint16Pair gridSize )
501 {
502   uint16_t gridWidth = gridSize.GetWidth();
503   uint16_t gridHeight = gridSize.GetHeight();
504
505   // Create vertices
506   Vector< Vector2 > vertices;
507   vertices.Reserve( ( gridWidth + 1 ) * ( gridHeight + 1 ) );
508
509   for( int y = 0; y < gridHeight + 1; ++y )
510   {
511     for( int x = 0; x < gridWidth + 1; ++x )
512     {
513       AddVertex( vertices, x, y );
514     }
515   }
516
517   // Create indices
518   //TODO: compare performance with triangle strip when Geometry supports it
519   Vector< unsigned int > indices;
520   indices.Reserve( gridWidth * gridHeight * 6 );
521
522   unsigned int rowIdx     = 0;
523   unsigned int nextRowIdx = gridWidth + 1;
524   for( int y = 0; y < gridHeight; ++y, ++nextRowIdx, ++rowIdx )
525   {
526     for( int x = 0; x < gridWidth; ++x, ++nextRowIdx, ++rowIdx )
527     {
528       AddQuadIndices( indices, rowIdx, nextRowIdx );
529     }
530   }
531
532   return GenerateGeometry( vertices, indices );
533 }
534
535 Geometry NPatchRenderer::CreateGeometryBorder( Uint16Pair gridSize )
536 {
537   uint16_t gridWidth = gridSize.GetWidth();
538   uint16_t gridHeight = gridSize.GetHeight();
539
540   // Create vertices
541   Vector< Vector2 > vertices;
542   vertices.Reserve( ( gridWidth + 1 ) * ( gridHeight + 1 ) );
543
544   //top
545   int y = 0;
546   for(; y < 2; ++y)
547   {
548     for( int x = 0; x < gridWidth + 1; ++x )
549     {
550       AddVertex( vertices, x, y );
551     }
552   }
553
554   for(; y < gridHeight - 1; ++y)
555   {
556     //left
557     AddVertex( vertices, 0, y );
558     AddVertex( vertices, 1, y );
559
560     //right
561     AddVertex( vertices, gridWidth - 1, y );
562     AddVertex( vertices, gridWidth, y );
563   }
564
565   //bottom
566   for(; y < gridHeight + 1; ++y)
567   {
568     for( int x = 0; x < gridWidth + 1; ++x )
569     {
570       AddVertex( vertices, x, y );
571     }
572   }
573
574   // Create indices
575   //TODO: compare performance with triangle strip when Geometry supports it
576   Vector< unsigned int > indices;
577   indices.Reserve( gridWidth * gridHeight * 6 );
578
579   //top
580   unsigned int rowIdx     = 0 ;
581   unsigned int nextRowIdx = gridWidth + 1;
582   for( int x = 0; x < gridWidth; ++x, ++nextRowIdx, ++rowIdx )
583   {
584     AddQuadIndices( indices, rowIdx, nextRowIdx );
585   }
586
587   if(gridHeight > 2)
588   {
589     rowIdx     = gridWidth + 1;
590     nextRowIdx = ( gridWidth + 1 ) * 2;
591
592     unsigned increment = gridWidth - 1;
593     if(gridHeight > 3)
594     {
595       increment = 2;
596       //second row left
597       AddQuadIndices( indices, rowIdx, nextRowIdx );
598
599       rowIdx     = gridWidth * 2;
600       nextRowIdx = ( gridWidth + 1 ) * 2 + 2;
601       //second row right
602       AddQuadIndices( indices, rowIdx, nextRowIdx );
603
604       //left and right
605       rowIdx     = nextRowIdx - 2;
606       nextRowIdx = rowIdx + 4;
607       for(int y = 2; y < 2*(gridHeight - 3); ++y, rowIdx += 2, nextRowIdx += 2)
608       {
609         AddQuadIndices( indices, rowIdx, nextRowIdx );
610       }
611     }
612
613     //second row left
614     AddQuadIndices( indices, rowIdx, nextRowIdx );
615
616     rowIdx     += increment;
617     nextRowIdx += gridWidth - 1;
618     //second row right
619     AddQuadIndices( indices, rowIdx, nextRowIdx );
620   }
621
622   //bottom
623   rowIdx     = nextRowIdx - gridWidth + 1;
624   nextRowIdx = rowIdx + gridWidth + 1;
625   for( int x = 0; x < gridWidth; ++x, ++nextRowIdx, ++rowIdx )
626   {
627     AddQuadIndices( indices, rowIdx, nextRowIdx );
628   }
629
630   return GenerateGeometry( vertices, indices );
631 }
632
633 } // namespace Internal
634
635 } // namespace Toolkit
636
637 } // namespace Dali