MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / ensureSize

Method ensureSize

src/main/java/field/graphics/MeshBuilder.java:984–998  ·  view source on GitHub ↗
(int attribute, int dimension, int num)

Source from the content-addressed store, hash-verified

982 ArrayBuffer a = target.buffer(attribute, dimension);
983 if (a == null) {
984 a = target.arrayBufferFactory.newArrayBuffer((int) (num * GROWTH + 1), GL15.GL_ARRAY_BUFFER, attribute,
985 dimension, 0);
986 }
987 if (a.getSize() < (num + 1)) {
988 a = a.replaceWithSize((int) ((num + 1) * GROWTH + 1));
989 target.setBuffer(attribute, a);
990 }
991 FloatBuffer f = a.floats();
992 f.clear();
993 f.position(dimension * vertexCursor);
994 return f;
995 }
996
997 public ArrayBuffer ensureExists(int attribute, int dimension, int num) {
998 ArrayBuffer a = target.buffer(attribute, dimension);
999 if (a == null) {
1000 a = target.arrayBufferFactory.newArrayBuffer((int) (num * GROWTH + 1), GL15.GL_ARRAY_BUFFER, attribute,
1001 dimension, 0);

Callers 4

vMethod · 0.95
raw_vMethod · 0.95
mergeMethod · 0.95
writeAuxMethod · 0.95

Calls 8

getSizeMethod · 0.95
replaceWithSizeMethod · 0.95
floatsMethod · 0.95
newArrayBufferMethod · 0.65
positionMethod · 0.65
bufferMethod · 0.45
setBufferMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected