Class DrawBuffer

java.lang.Object
com.jozufozu.flywheel.backend.instancing.DrawBuffer

public class DrawBuffer extends Object
A byte buffer that can be used to draw vertices through a DirectVertexConsumer. The number of vertices needs to be known ahead of time.
  • Constructor Details

    • DrawBuffer

      @Internal public DrawBuffer(net.minecraft.client.renderer.RenderType parent)
  • Method Details

    • begin

      public DirectVertexConsumer begin(int vertexCount)
      Creates a direct vertex consumer that can be used to write vertices into this buffer.
      Parameters:
      vertexCount - The number of vertices to reserve memory for.
      Returns:
      A direct vertex consumer.
      Throws:
      IllegalStateException - If the buffer is already in use.
    • inject

      public void inject(BufferBuilderExtension bufferBuilder)
      Injects the backing buffer into the given builder and prepares it for rendering.
      Parameters:
      bufferBuilder - The buffer builder to inject into.
    • hasVertices

      public boolean hasVertices()
      Returns:
      true if the buffer has any vertices.
    • reset

      public void reset()
      Reset the draw buffer to have no vertices. Does not clear the backing buffer.