File tree Expand file tree Collapse file tree
src/main/java/meteordevelopment/meteorclient/renderer Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -181,8 +181,7 @@ public void ensureCapacity(int vertexCount, int indexCount) {
181181
182182 if ((vertexI + vertexCount ) * primitiveVerticesSize >= vertices .capacity ()) {
183183 int offset = getVerticesOffset ();
184- int newSize = vertices .capacity () * 2 ;
185-
184+ int newSize = Math .max (vertices .capacity () * 2 , vertices .capacity () + vertexCount * primitiveVerticesSize );
186185 ByteBuffer newVertices = BufferUtils .createByteBuffer (newSize );
187186 memCopy (memAddress0 (vertices ), memAddress0 (newVertices ), offset );
188187
@@ -192,7 +191,7 @@ public void ensureCapacity(int vertexCount, int indexCount) {
192191 }
193192
194193 if ((indicesCount + indexCount ) * Integer .BYTES >= indices .capacity ()) {
195- int newSize = indices .capacity () * 2 ;
194+ int newSize = Math . max ( indices .capacity () * 2 , indices . capacity () + indexCount * Integer . BYTES ) ;
196195
197196 ByteBuffer newIndices = BufferUtils .createByteBuffer (newSize );
198197 memCopy (memAddress0 (indices ), memAddress0 (newIndices ), indicesCount * 4L );
You can’t perform that action at this time.
0 commit comments