* @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 );
vertices.PushBack( Vector2( x, y ) );
}
-void RegisterStretchProperties( TextureSet& textureSet, const char * uniformName, const NinePatchImage::StretchRanges& stretchPixels, uint16_t imageExtent)
+void RegisterStretchProperties( Renderer& renderer, const char * uniformName, const NinePatchImage::StretchRanges& stretchPixels, uint16_t imageExtent)
{
uint16_t prevEnd = 0;
uint16_t prevFix = 0;
std::stringstream uniform;
uniform << uniformName << "[" << i << "]";
- textureSet.RegisterProperty( uniform.str(), Vector2( fix, stretch ) );
+ renderer.RegisterProperty( uniform.str(), Vector2( fix, stretch ) );
prevEnd = end;
prevFix = fix;
prevFix += imageExtent - prevEnd;
std::stringstream uniform;
uniform << uniformName << "[" << i << "]";
- textureSet.RegisterProperty( uniform.str(), Vector2( prevFix, prevStretch ) );
+ renderer.RegisterProperty( uniform.str(), Vector2( prevFix, prevStretch ) );
}
}
uint16_t stretchWidth = stretchX.GetY() - stretchX.GetX();
uint16_t stretchHeight = stretchY.GetY() - stretchY.GetX();
- textureSet.RegisterProperty( "uFixed[0]", Vector2::ZERO );
- textureSet.RegisterProperty( "uFixed[1]", Vector2( stretchX.GetX(), stretchY.GetX()) );
- textureSet.RegisterProperty( "uFixed[2]", Vector2( mImageSize.GetWidth() - stretchWidth, mImageSize.GetHeight() - stretchHeight ) );
- textureSet.RegisterProperty( "uStretchTotal", Vector2( stretchWidth, stretchHeight ) );
+ mImpl->mRenderer.RegisterProperty( "uFixed[0]", Vector2::ZERO );
+ mImpl->mRenderer.RegisterProperty( "uFixed[1]", Vector2( stretchX.GetX(), stretchY.GetX()) );
+ mImpl->mRenderer.RegisterProperty( "uFixed[2]", Vector2( mImageSize.GetWidth() - stretchWidth, mImageSize.GetHeight() - stretchHeight ) );
+ mImpl->mRenderer.RegisterProperty( "uStretchTotal", Vector2( stretchWidth, stretchHeight ) );
}
else
{
- textureSet.RegisterProperty( "uNinePatchFactorsX[0]", Vector2::ZERO );
- textureSet.RegisterProperty( "uNinePatchFactorsY[0]", Vector2::ZERO );
+ mImpl->mRenderer.RegisterProperty( "uNinePatchFactorsX[0]", Vector2::ZERO );
+ mImpl->mRenderer.RegisterProperty( "uNinePatchFactorsY[0]", Vector2::ZERO );
- RegisterStretchProperties( textureSet, "uNinePatchFactorsX", mStretchPixelsX, mImageSize.GetWidth() );
- RegisterStretchProperties( textureSet, "uNinePatchFactorsY", mStretchPixelsY, mImageSize.GetHeight() );
+ RegisterStretchProperties( mImpl->mRenderer, "uNinePatchFactorsX", mStretchPixelsX, mImageSize.GetWidth() );
+ RegisterStretchProperties( mImpl->mRenderer, "uNinePatchFactorsY", mStretchPixelsY, mImageSize.GetHeight() );
}
}
}
// 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