Fix IndexedModel allocating incorrect amount of bytes

- model.size() returned the byte size relative to the model's
VertexType, but the byte size relative to the passed VertexType is
needed instead
This commit is contained in:
PepperCode1 2022-12-31 14:34:59 -08:00
parent f5acaeb1d7
commit d96ad156e1

View File

@ -40,7 +40,7 @@ public class IndexedModel implements BufferedModel {
vbo.bind();
// allocate the buffer on the gpu
vbo.ensureCapacity(model.size());
vbo.ensureCapacity(type.byteOffset(model.vertexCount()));
// mirror it in system memory, so we can write to it, and upload our model.
try (MappedBuffer buffer = vbo.getBuffer()) {