private void CmdDraw(IMgCommandBuffer cmdBuf, MeshPrimitive meshPrimitive, RenderInstanceChunk drawCall, int sliceIndex) { cmdBuf.CmdDraw( meshPrimitive.VertexCount, drawCall.InstanceCount, drawCall.FirstVertex, drawCall.FirstInstance); }
private void CmdDrawIndexed(IMgCommandBuffer cmdBuf, MeshPrimitive meshPrimitive, RenderInstanceChunk drawCall, int sliceIndex) { var allocation = mStaticStorage.Map.Allocations[meshPrimitive.Indices[sliceIndex]]; var indexBlock = mStaticStorage.Storage.Blocks[allocation.BlockIndex]; var vertexDef = PerVertexDefinitionEncoder.Decode(meshPrimitive.PerVertexDefinition); var indexType = vertexDef.IndexType == PerVertexIndexType.Uint16 ? MgIndexType.UINT16 : MgIndexType.UINT32; cmdBuf.CmdBindIndexBuffer(indexBlock.Buffer, allocation.Offset, indexType); cmdBuf.CmdDrawIndexed(meshPrimitive.IndexCount, drawCall.InstanceCount, drawCall.FirstIndex, drawCall.VertexOffset, drawCall.FirstInstance); }