Revert "[Tizen] Implement partial update"
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / dali-test-suite-utils / mesh-builder.cpp
index dacecc2..48bc26b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * limitations under the License.
  *
  */
+
+// CLASS HEADER
 #include "mesh-builder.h"
 
+// EXTERNAL INCLUDES
+#include <dali/devel-api/images/texture-set-image.h>
+
 namespace Dali
 {
 
-Material CreateMaterial(float opacity)
+Shader CreateShader()
 {
-  Shader shader = Shader::New( "vertexSrc", "fragmentSrc" );
-  Material material = Material::New(shader);
-
-  Vector4 color = Color::WHITE;
-  color.a = opacity;
-  material.SetProperty(Material::Property::COLOR, color);
-  return material;
+  return Shader::New( "vertexSrc", "fragmentSrc" );
 }
 
-Material CreateMaterial(float opacity, Image image)
+TextureSet CreateTextureSet()
 {
-  Shader shader = Shader::New( "vertexSrc", "fragmentSrc" );
-  Material material = Material::New(shader);
-
-  Vector4 color = Color::WHITE;
-  color.a = opacity;
-  material.SetProperty(Material::Property::COLOR, color);
-
-  Sampler sampler = Sampler::New( image, "sTexture" );
-  material.AddSampler( sampler );
-
-  return material;
+  return TextureSet::New();
 }
 
+TextureSet CreateTextureSet( Image image )
+{
+  TextureSet textureSet = TextureSet::New();
+  TextureSetImage( textureSet, 0u, image );
+  return textureSet;
+}
 
-Geometry CreateQuadGeometry()
+PropertyBuffer CreatePropertyBuffer()
 {
   Property::Map texturedQuadVertexFormat;
   texturedQuadVertexFormat["aPosition"] = Property::VECTOR2;
   texturedQuadVertexFormat["aVertexCoord"] = Property::VECTOR2;
 
-  PropertyBuffer vertexData = PropertyBuffer::New( PropertyBuffer::STATIC,
-                                                   texturedQuadVertexFormat, 4 );
+  PropertyBuffer vertexData = PropertyBuffer::New( texturedQuadVertexFormat );
+  return vertexData;
+}
 
+Geometry CreateQuadGeometry(void)
+{
+  PropertyBuffer vertexData = CreatePropertyBuffer();
   const float halfQuadSize = .5f;
   struct TexturedQuadVertex { Vector2 position; Vector2 textureCoordinates; };
   TexturedQuadVertex texturedQuadVertexData[4] = {
@@ -62,17 +61,13 @@ Geometry CreateQuadGeometry()
     { Vector2( halfQuadSize, -halfQuadSize), Vector2(1.f, 0.f) },
     { Vector2(-halfQuadSize,  halfQuadSize), Vector2(0.f, 1.f) },
     { Vector2( halfQuadSize,  halfQuadSize), Vector2(1.f, 1.f) } };
-  vertexData.SetData(texturedQuadVertexData);
+  vertexData.SetData(texturedQuadVertexData, 4);
 
   unsigned short indexData[6] = { 0, 3, 1, 0, 2, 3 };
-  Property::Map indexFormat;
-  indexFormat["indices"] = Property::UNSIGNED_INTEGER; // Should be Unsigned Short
-  PropertyBuffer indices = PropertyBuffer::New( PropertyBuffer::STATIC, indexFormat, 3 );
-  indices.SetData(indexData);
 
   Geometry geometry = Geometry::New();
   geometry.AddVertexBuffer( vertexData );
-  geometry.SetIndexBuffer( indices );
+  geometry.SetIndexBuffer( indexData, sizeof(indexData)/sizeof(indexData[0]) );
 
   return geometry;
 }