I would suggest to add additional overloadings to drawVertextPrimitiveList() and draw2DVertextPrimitiveList(), which takes scene::VertexBuffer* and scene::IndexBuffer*. We don't really need to send primitiveCount for this overloadings because user can always call indexBuffer->setUsed(anySmallerValueThanCurrentlyAllocated) and the values will not be lost after, and after the drawing he can setUsed() back to old value, the only thing he can't draw couple of primitives from the middle of the buffer, which is easily possible with drawVertextPrimitiveList() with void*-versions -- and i really do find this as a good feature (a lot flexibility, we can store everything in the single large chunk of buffer and have index all stuff from it and draw each of them separately with any material settings and so on -- this makes drawing and managing a bit complex but make serialization and deserialization fairly simple for any scene complexity).
Anyway, back to the topic, next code i made for my .NET wrapper, it allows to draw vertex and index buffer pair, which are insanely easy to interact (comparing to void*

Code: Select all
void VideoDriver::DrawVertexPrimitiveList(Scene::VertexBuffer^ vertexBuffer, Scene::IndexBuffer^ indexBuffer, Scene::PrimitiveType pType)
{
LIME_ASSERT(vertexBuffer != nullptr);
LIME_ASSERT(indexBuffer != nullptr);
scene::IVertexBuffer* vb = vertexBuffer->m_VertexBuffer;
scene::IIndexBuffer* ib = indexBuffer->m_IndexBuffer;
if (vb->size() == 0 || ib->size() == 0)
return;
unsigned int primCount = calculatePrimitiveCount(ib->size(), pType);
m_VideoDriver->drawVertexPrimitiveList(
vb->pointer(),
vb->size(),
ib->pointer(),
primCount,
vb->getType(),
(scene::E_PRIMITIVE_TYPE)pType,
ib->getType());
}
Code: Select all
virtual void drawVertexPrimitiveList(
const scene::IVertexBuffer* vertexBuffer,
const scene::IIndexBuffer* indexBuffer,
u32 primCount, // we left this argument to be consistent with other drawVertexPrimitiveList()s, but as i described above, we do not have that flexibility which void*s gives (starting from any position of the buffer)
scene::E_PRIMITIVE_TYPE pType=scene::EPT_TRIANGLES) =0;