Changes following "Remove geometry scvene object" 47/66747/6
authorFerran Sole <ferran.sole@samsung.com>
Wed, 20 Apr 2016 15:11:56 +0000 (16:11 +0100)
committerFerran Sole <ferran.sole@samsung.com>
Mon, 25 Apr 2016 13:38:37 +0000 (14:38 +0100)
Change-Id: I8138d652252f76ef24becc0fcfce3cef15321cad

examples/line-mesh/line-mesh-example.cpp
examples/mesh-sorting/mesh-sorting-example.cpp
examples/metaball-explosion/metaball-explosion-example.cpp
examples/metaball-refrac/metaball-refrac-example.cpp
examples/new-window/new-window-example.cpp
examples/radial-menu/radial-sweep-view-impl.cpp
examples/textured-mesh/textured-mesh-example.cpp

index 5c8779b..f2caf45 100644 (file)
@@ -62,43 +62,11 @@ void main()
 }
 );
 
-PropertyBuffer CreateIndexBuffer( Geometry::GeometryType geometryType )
-{
-  // Create indices
-  const unsigned int indexDataLines[]    =    { 0, 1, 1, 2, 2, 3, 3, 4, 4, 0 };
-  const unsigned int indexDataLoops[]    =    { 0, 1, 2, 3, 4 };
-  const unsigned int indexDataStrips[]   =    { 0, 1, 2, 3, 4, 0 };
-
-  // Create index buffer if doesn't exist
-  Property::Map indexFormat;
-  indexFormat["indices"] = Property::INTEGER;
-  PropertyBuffer indices = PropertyBuffer::New( indexFormat );
-
-  // Update buffer
-  switch( geometryType )
-  {
-    case Geometry::LINES:
-    {
-      indices.SetData( indexDataLines, sizeof(indexDataLines)/sizeof(indexDataLines[0]) );
-      break;
-    }
-    case Geometry::LINE_LOOP:
-    {
-      indices.SetData( indexDataLoops, sizeof(indexDataLoops)/sizeof(indexDataLoops[0]) );
-      break;
-    }
-    case Geometry::LINE_STRIP:
-    {
-      indices.SetData( indexDataStrips, sizeof(indexDataStrips)/sizeof(indexDataStrips[0]) );
-      break;
-    }
-    default: // this will never happen, but compilers yells
-    {
-    }
-  }
-
-  return indices;
-}
+const unsigned short indexLines[] = { 0, 1, 1, 2, 2, 3, 3, 4, 4, 0 };
+const unsigned short indexLoop[] =  { 0, 1, 2, 3, 4 };
+const unsigned short indexStrip[] = { 0, 1, 2, 3, 4, 0 };
+const unsigned short* indices[3] = { &indexLines[0], &indexLoop[0], &indexStrip[0] };
+const unsigned int indicesSize[3] = { sizeof(indexLines)/sizeof(indexLines[0]), sizeof(indexLoop)/sizeof(indexLoop[0]), sizeof(indexStrip)/sizeof(indexStrip[0])};
 
 Geometry CreateGeometry()
 {
@@ -127,13 +95,11 @@ Geometry CreateGeometry()
   PropertyBuffer pentagonVertices = PropertyBuffer::New( pentagonVertexFormat );
   pentagonVertices.SetData(pentagonVertexData, 5);
 
-  // Create indices
-  PropertyBuffer indices = CreateIndexBuffer( Geometry::LINES );
 
   // Create the geometry object
   Geometry pentagonGeometry = Geometry::New();
   pentagonGeometry.AddVertexBuffer( pentagonVertices );
-  pentagonGeometry.SetIndexBuffer( indices );
+  pentagonGeometry.SetIndexBuffer( indices[0], indicesSize[0] );
   pentagonGeometry.SetGeometryType( Geometry::LINES );
   return pentagonGeometry;
 }
@@ -316,8 +282,7 @@ public:
       index = 2;
     }
 
-    PropertyBuffer indices = CreateIndexBuffer( geomTypes[ index ] );
-    mGeometry.SetIndexBuffer( indices );
+    mGeometry.SetIndexBuffer( indices[index], indicesSize[index] );
     mGeometry.SetGeometryType( geomTypes[ index ] );
 
     return true;
index 95c091d..28d7f9f 100644 (file)
@@ -102,16 +102,12 @@ Geometry CreateGeometry()
   texturedQuadVertices.SetData( texturedQuadVertexData, 4 );
 
   // Create indices
-  unsigned int indexData[6] = { 0, 3, 1, 0, 2, 3 };
-  Property::Map indexFormat;
-  indexFormat["indices"] = Property::INTEGER;
-  PropertyBuffer indices = PropertyBuffer::New( indexFormat );
-  indices.SetData( indexData, 6 );
+  unsigned short indexData[6] = { 0, 3, 1, 0, 2, 3 };
 
   // Create the geometry object
   Geometry texturedQuadGeometry = Geometry::New();
   texturedQuadGeometry.AddVertexBuffer( texturedQuadVertices );
-  texturedQuadGeometry.SetIndexBuffer( indices );
+  texturedQuadGeometry.SetIndexBuffer( &indexData[0], sizeof(indexData)/sizeof(unsigned short) );
 
   return texturedQuadGeometry;
 }
index 07f57c3..39519b8 100644 (file)
@@ -373,8 +373,6 @@ Geometry MetaballExplosionController::CreateGeometry()
     { Vector2(1.0f, 1.0f * aspect) }
   };
 
-  int indices[] = { 0, 3, 1, 0, 2, 3 };
-
   unsigned int numberOfVertices = sizeof(vertices)/sizeof(VertexPosition);
 
   //Vertices
@@ -390,17 +388,14 @@ Geometry MetaballExplosionController::CreateGeometry()
   textureVertices.SetData( textures, numberOfVertices );
 
   //Indices
-  Property::Map indicesVertexFormat;
-  indicesVertexFormat["aIndices"] = Property::INTEGER;
-  PropertyBuffer indicesToVertices = PropertyBuffer::New( indicesVertexFormat );
-  indicesToVertices.SetData( indices, 6 );
+  unsigned short indices[] = { 0, 3, 1, 0, 2, 3 };
 
   // Create the geometry object
   Geometry texturedQuadGeometry = Geometry::New();
   texturedQuadGeometry.AddVertexBuffer( positionVertices );
   texturedQuadGeometry.AddVertexBuffer( textureVertices );
 
-  texturedQuadGeometry.SetIndexBuffer ( indicesToVertices );
+  texturedQuadGeometry.SetIndexBuffer ( &indices[0], sizeof( indices )/ sizeof( indices[0] ) );
 
   return texturedQuadGeometry;
 }
@@ -431,8 +426,6 @@ Geometry MetaballExplosionController::CreateGeometryComposition()
     { Vector2(1.0f, 1.0f) }
   };
 
-  int indices[] = { 0, 3, 1, 0, 2, 3 };
-
   unsigned int numberOfVertices = sizeof(vertices)/sizeof(VertexPosition);
 
   //Vertices
@@ -448,17 +441,14 @@ Geometry MetaballExplosionController::CreateGeometryComposition()
   textureVertices.SetData( textures, numberOfVertices );
 
   //Indices
-  Property::Map indicesVertexFormat;
-  indicesVertexFormat["aIndices"] = Property::INTEGER;
-  PropertyBuffer indicesToVertices = PropertyBuffer::New( indicesVertexFormat );
-  indicesToVertices.SetData( indices, 6 );
+  unsigned short indices[] = { 0, 3, 1, 0, 2, 3 };
 
   // Create the geometry object
   Geometry texturedQuadGeometry = Geometry::New();
   texturedQuadGeometry.AddVertexBuffer( positionVertices );
   texturedQuadGeometry.AddVertexBuffer( textureVertices );
 
-  texturedQuadGeometry.SetIndexBuffer ( indicesToVertices );
+  texturedQuadGeometry.SetIndexBuffer ( &indices[0], sizeof( indices )/ sizeof( indices[0] ) );
 
   return texturedQuadGeometry;
 }
index 46bf2b0..995977c 100644 (file)
@@ -322,8 +322,6 @@ Geometry MetaballRefracController::CreateGeometry()
     { Vector3(0.0f, 0.0f, 1.0f) }
   };
 
-  int indices[] = { 0, 3, 1, 0, 2, 3 };
-
   unsigned int numberOfVertices = sizeof(vertices)/sizeof(VertexPosition);
 
   //Vertices
@@ -345,11 +343,7 @@ Geometry MetaballRefracController::CreateGeometry()
   normalVertices.SetData( normals, numberOfVertices );
 
   //Indices
-  Property::Map indicesVertexFormat;
-  indicesVertexFormat["aIndices"] = Property::INTEGER;
-  PropertyBuffer indicesToVertices = PropertyBuffer::New( indicesVertexFormat );
-  indicesToVertices.SetData( indices, 6 );
-
+  unsigned short indices[] = { 0, 3, 1, 0, 2, 3 };
 
   // Create the geometry object
   Geometry texturedQuadGeometry = Geometry::New();
@@ -357,7 +351,7 @@ Geometry MetaballRefracController::CreateGeometry()
   texturedQuadGeometry.AddVertexBuffer( textureVertices );
   texturedQuadGeometry.AddVertexBuffer( normalVertices );
 
-  texturedQuadGeometry.SetIndexBuffer ( indicesToVertices );
+  texturedQuadGeometry.SetIndexBuffer ( &indices[0], 6 );
 
   return texturedQuadGeometry;
 }
@@ -398,8 +392,6 @@ Geometry MetaballRefracController::CreateGeometryComposition()
     { Vector3(0.0f, 0.0f, 1.0f) }
   };
 
-  int indices[] = { 0, 3, 1, 0, 2, 3 };
-
   unsigned int numberOfVertices = sizeof(vertices)/sizeof(VertexPosition);
 
   //Vertices
@@ -421,10 +413,7 @@ Geometry MetaballRefracController::CreateGeometryComposition()
   normalVertices.SetData( normals, numberOfVertices );
 
   //Indices
-  Property::Map indicesVertexFormat;
-  indicesVertexFormat["aIndices"] = Property::INTEGER;
-  PropertyBuffer indicesToVertices = PropertyBuffer::New( indicesVertexFormat );
-  indicesToVertices.SetData( indices, 6 );
+  unsigned short indices[] = { 0, 3, 1, 0, 2, 3 };
 
   // Create the geometry object
   Geometry texturedQuadGeometry = Geometry::New();
@@ -432,7 +421,7 @@ Geometry MetaballRefracController::CreateGeometryComposition()
   texturedQuadGeometry.AddVertexBuffer( textureVertices );
   texturedQuadGeometry.AddVertexBuffer( normalVertices );
 
-  texturedQuadGeometry.SetIndexBuffer ( indicesToVertices );
+  texturedQuadGeometry.SetIndexBuffer ( &indices[0], sizeof( indices )/ sizeof( indices[0] ) );
 
   return texturedQuadGeometry;
 }
index d1ea946..022c15a 100644 (file)
@@ -450,16 +450,12 @@ Geometry NewWindowController::CreateMeshGeometry()
   vertices.SetData( vertexData, 5 );
 
   // Specify all the faces
-  unsigned int indexData[12] = { 0,1,3,0,2,4,0,3,4,0,2,1 };
-  Property::Map indexFormat;
-  indexFormat["indices"] = Property::INTEGER;
-  PropertyBuffer indices = PropertyBuffer::New( indexFormat );
-  indices.SetData( indexData, 12 );
+  unsigned short indexData[12] = { 0,1,3,0,2,4,0,3,4,0,2,1 };
 
   // Create the geometry object
   Geometry geometry = Geometry::New();
   geometry.AddVertexBuffer( vertices );
-  geometry.SetIndexBuffer( indices );
+  geometry.SetIndexBuffer( &indexData[0], 12 );
 
   return geometry;
 }
index c072f58..495e2ec 100644 (file)
@@ -330,15 +330,11 @@ void RadialSweepViewImpl::CreateStencil( Radian initialSector )
   PropertyBuffer vertices = PropertyBuffer::New( vertexFormat );
   vertices.SetData( vertexData, 7u );
 
-  unsigned int indexData[15] = { 0,1,2,0,2,3,0,3,4,0,4,5,0,5,6 };
-  Property::Map indexFormat;
-  indexFormat["indices"] = Property::INTEGER;
-  PropertyBuffer indices = PropertyBuffer::New( indexFormat );
-  indices.SetData( indexData, 15u );
+  unsigned short indexData[15] = { 0,1,2,0,2,3,0,3,4,0,4,5,0,5,6 };
 
   Geometry meshGeometry = Geometry::New();
   meshGeometry.AddVertexBuffer( vertices );
-  meshGeometry.SetIndexBuffer( indices );
+  meshGeometry.SetIndexBuffer( &indexData[0], sizeof( indexData )/sizeof(indexData[0]) );
 
   // Create shader
   std::ostringstream vertexShaderStringStream;
index b445fcc..1de4316 100644 (file)
@@ -79,16 +79,12 @@ Geometry CreateGeometry()
   texturedQuadVertices.SetData( texturedQuadVertexData, 4 );
 
   // Create indices
-  unsigned int indexData[6] = { 0, 3, 1, 0, 2, 3 };
-  Property::Map indexFormat;
-  indexFormat["indices"] = Property::INTEGER;
-  PropertyBuffer indices = PropertyBuffer::New( indexFormat );
-  indices.SetData( indexData, sizeof(indexData)/sizeof(indexData[0]) );
+  unsigned short indexData[6] = { 0, 3, 1, 0, 2, 3 };
 
   // Create the geometry object
   Geometry texturedQuadGeometry = Geometry::New();
   texturedQuadGeometry.AddVertexBuffer( texturedQuadVertices );
-  texturedQuadGeometry.SetIndexBuffer( indices );
+  texturedQuadGeometry.SetIndexBuffer( &indexData[0], sizeof(indexData)/sizeof(indexData[0]) );
 
   return texturedQuadGeometry;
 }