void Geometry::RemoveVertexBuffer(const Render::VertexBuffer* vertexBuffer)
{
const auto&& end = mVertexBuffers.End();
+ // @todo if this buffer is the only instance buffer, reduce instance count to 1.
for(auto&& iter = mVertexBuffers.Begin(); iter != end; ++iter)
{
if(*iter == vertexBuffer)
for(uint32_t i = 0; i < vertexBufferCount; ++i)
{
+ if(mVertexBuffers[i]->GetDivisor() > 0)
+ {
+ mInstanceCount = mVertexBuffers[i]->GetElementCount();
+ }
+
const GpuBuffer* gpuBuffer = mVertexBuffers[i]->GetGpuBuffer();
if(gpuBuffer)
{
commandBuffer.BindIndexBuffer(*ibo, 0, mIndexType);
}
- commandBuffer.DrawIndexed(numIndices, 1, firstIndexOffset, 0, 0);
+ commandBuffer.DrawIndexed(numIndices, mInstanceCount, firstIndexOffset, 0, 0);
}
else
{
numVertices = static_cast<uint32_t>(mVertexBuffers[0]->GetElementCount());
}
- commandBuffer.Draw(numVertices, 1, 0, 0);
+ commandBuffer.Draw(numVertices, mInstanceCount, 0, 0);
}
return true;
}