1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-26 14:38:34 +01:00

don't draw empty vertex buffers

This commit is contained in:
Ell 2021-10-19 17:20:00 +02:00
parent 6f04b30591
commit 08bd443c36

View file

@ -149,6 +149,8 @@ namespace MLEM.Misc {
var totalIndex = 0; var totalIndex = 0;
foreach (var buffer in this.vertexBuffers) { foreach (var buffer in this.vertexBuffers) {
var tris = Math.Min(this.vertices.Count - totalIndex, buffer.VertexCount) / 4 * 2; var tris = Math.Min(this.vertices.Count - totalIndex, buffer.VertexCount) / 4 * 2;
if (tris <= 0)
break;
this.graphicsDevice.SetVertexBuffer(buffer); this.graphicsDevice.SetVertexBuffer(buffer);
if (effect != null) { if (effect != null) {
foreach (var pass in effect.CurrentTechnique.Passes) { foreach (var pass in effect.CurrentTechnique.Passes) {