* @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 int >& indices )
+Geometry GenerateGeometry( const Vector< Vector2 >& vertices, const Vector< unsigned short >& indices )
{
Property::Map vertexFormat;
vertexFormat[ "aPosition" ] = Property::VECTOR2;
vertexPropertyBuffer.SetData( &vertices[ 0 ], vertices.Size() );
}
- Property::Map indexFormat;
- indexFormat[ "indices" ] = Property::INTEGER;
- PropertyBuffer indexPropertyBuffer = PropertyBuffer::New( indexFormat );
+ // Create the geometry object
+ Geometry geometry = Geometry::New();
+ geometry.AddVertexBuffer( vertexPropertyBuffer );
if( indices.Size() > 0 )
{
- indexPropertyBuffer.SetData( &indices[ 0 ], indices.Size() );
+ geometry.SetIndexBuffer( &indices[ 0 ], indices.Size() );
}
- // Create the geometry object
- Geometry geometry = Geometry::New();
- geometry.AddVertexBuffer( vertexPropertyBuffer );
- geometry.SetIndexBuffer( indexPropertyBuffer );
return geometry;
}
* @param[in] rowIdx The row index to start the quad
* @param[in] nextRowIdx The index to the next row
*/
-void AddQuadIndices( Vector< unsigned int >& indices, unsigned int rowIdx, unsigned int nextRowIdx )
+void AddQuadIndices( Vector< unsigned short >& indices, unsigned int rowIdx, unsigned int nextRowIdx )
{
indices.PushBack( rowIdx );
indices.PushBack( nextRowIdx + 1 );
// Create indices
//TODO: compare performance with triangle strip when Geometry supports it
- Vector< unsigned int > indices;
+ Vector< unsigned short > indices;
indices.Reserve( gridWidth * gridHeight * 6 );
unsigned int rowIdx = 0;
// Create indices
//TODO: compare performance with triangle strip when Geometry supports it
- Vector< unsigned int > indices;
+ Vector< unsigned short > indices;
indices.Reserve( gridWidth * gridHeight * 6 );
//top