Revert "Move new mesh API to devel-api"
[platform/core/uifw/dali-core.git] / dali / internal / render / renderers / render-geometry.cpp
index 4240094..4713775 100644 (file)
@@ -87,15 +87,24 @@ void RenderGeometry::UploadVertexData(
   BufferIndex bufferIndex,
   const RenderDataProvider* dataProviders )
 {
-  if( mDataNeedsUploading ) // @todo Or if any of the property buffers are dirty
+  if( mDataNeedsUploading )
   {
-    DoUpload( context, bufferIndex, dataProviders );
+    SetUpPropertyBuffers( context, bufferIndex, dataProviders );
+
+    for( unsigned int i = 0; i < mVertexBuffers.Count(); ++i )
+    {
+      mVertexBuffers[i]->Upload( context, bufferIndex );
+    }
+    if( mIndexBuffer )
+    {
+      mIndexBuffer->Upload( context, bufferIndex );
+    }
 
     mDataNeedsUploading = false;
   }
 }
 
-void RenderGeometry::DoUpload(
+void RenderGeometry::SetUpPropertyBuffers(
   Context& context,
   BufferIndex bufferIndex,
   const RenderDataProvider* dataProvider )
@@ -114,8 +123,6 @@ void RenderGeometry::DoUpload(
       GpuBuffer::ARRAY_BUFFER,
       GpuBuffer::STATIC_DRAW ); // TODO: MESH_REWORK: change this for animated meshes
 
-    propertyBuffer->Upload( context, bufferIndex );
-
     mVertexBuffers.PushBack( propertyBuffer );
   }
 
@@ -127,8 +134,6 @@ void RenderGeometry::DoUpload(
       *indexBuffer,
       GpuBuffer::ELEMENT_ARRAY_BUFFER,
       GpuBuffer::STATIC_DRAW ); // TODO: MESH_REWORK: change this for animated meshes
-
-    mIndexBuffer->Upload( context, bufferIndex );
   }
 }
 
@@ -175,7 +180,7 @@ void RenderGeometry::Draw( Context& context, BufferIndex bufferIndex, const Rend
   unsigned int numIndices = 0;
   if( indexBuffer )
   {
-    numIndices = /* TODO: MESH_REWORK remove this 2, should implement unsigned short properties  */ 2 * indexBuffer->GetDataSize(bufferIndex) / indexBuffer->GetElementSize(bufferIndex);
+    numIndices = indexBuffer->GetDataSize(bufferIndex) / indexBuffer->GetElementSize(bufferIndex);
   }
 
   switch(type)