From 31490f97b91a634ff7ba4f71a8eb901fd520a345 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 4 Jan 2025 09:02:50 -0600 Subject: [PATCH] add missing "this" to QuadElementBuffer --- .../glObject/buffer/QuadElementBuffer.java | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/core/src/main/java/com/seibel/distanthorizons/core/render/glObject/buffer/QuadElementBuffer.java b/core/src/main/java/com/seibel/distanthorizons/core/render/glObject/buffer/QuadElementBuffer.java index f01ff0abd..dea3f9084 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/render/glObject/buffer/QuadElementBuffer.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/render/glObject/buffer/QuadElementBuffer.java @@ -132,8 +132,9 @@ public class QuadElementBuffer extends GLElementBuffer throw new IllegalArgumentException("quadCount must be greater than 0"); } if (quadCount == 0) return; // FIXME: This doesn't happens yet, but just add this since everything will break if it does - indicesCount = quadCount * 6; // 2 triangles per quad - if (indicesCount >= getCapacity() && indicesCount < getCapacity() * BUFFER_SHRINK_TRIGGER) + + this.indicesCount = quadCount * 6; // 2 triangles per quad + if (this.indicesCount >= this.getCapacity() && this.indicesCount < this.getCapacity() * BUFFER_SHRINK_TRIGGER) { return; } @@ -142,33 +143,32 @@ public class QuadElementBuffer extends GLElementBuffer if (vertexCount < 255) { // Reserve 1 for the reset index - type = GL32.GL_UNSIGNED_BYTE; + this.type = GL32.GL_UNSIGNED_BYTE; } else if (vertexCount < 65535) { // Reserve 1 for the reset index - type = GL32.GL_UNSIGNED_SHORT; + this.type = GL32.GL_UNSIGNED_SHORT; } else { - type = GL32.GL_UNSIGNED_INT; + this.type = GL32.GL_UNSIGNED_INT; } - LOGGER.info("Quad IBO Resizing from [" + getCapacity() + "] to [" + quadCount + "]" + " with type: " + - GLEnums.getString(type)); + //LOGGER.info("Quad IBO Resizing from [" + getCapacity() + "] to [" + quadCount + "]" + " with type: [" + GLEnums.getString(this.type) + "]."); - ByteBuffer buffer = MemoryUtil.memAlloc(indicesCount * GLEnums.getTypeSize(type)); - buildBuffer(quadCount, buffer, type); + ByteBuffer buffer = MemoryUtil.memAlloc(this.indicesCount * GLEnums.getTypeSize(this.type)); + buildBuffer(quadCount, buffer, this.type); if (!gl.bufferStorageSupported) { - bind(); + this.bind(); super.uploadBuffer(buffer, EDhApiGpuUploadMethod.DATA, - indicesCount * GLEnums.getTypeSize(type), GL32.GL_STATIC_DRAW); + this.indicesCount * GLEnums.getTypeSize(this.type), GL32.GL_STATIC_DRAW); } else { - bind(); + this.bind(); super.uploadBuffer(buffer, EDhApiGpuUploadMethod.BUFFER_STORAGE, - indicesCount * GLEnums.getTypeSize(type), 0); + this.indicesCount * GLEnums.getTypeSize(this.type), 0); } MemoryUtil.memFree(buffer);