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 23c0ef6f33
commit 83a5723420

View file

@ -40,7 +40,7 @@ public class IndexedModel implements BufferedModel {
vbo.bind(); vbo.bind();
// allocate the buffer on the gpu // 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. // mirror it in system memory, so we can write to it, and upload our model.
try (MappedBuffer buffer = vbo.getBuffer()) { try (MappedBuffer buffer = vbo.getBuffer()) {