Interface VertexArrayBuilder

All Known Implementing Classes:
ARBVertexAttribBindingBuilder, DSAVertexAttribBindingBuilder, LegacyVertexAttribBindingBuilder

public interface VertexArrayBuilder
Builder for modifying vertex buffer state.
  • Method Details

    • validateRelativeOffset

      static void validateRelativeOffset(int offset)
    • vertexArray

      VertexArray vertexArray()
      Returns:
      The source vertex array
    • applyFrom

      default VertexArrayBuilder applyFrom(int bufferIndex, int buffer, int attributeStart, com.mojang.blaze3d.vertex.VertexFormat format)
      Applies the vanilla mc format at the specified index.
      Parameters:
      bufferIndex - The index to map the buffer to
      buffer - The buffer to get data from
      attributeStart - The first attribute index to start applying the format from
      format - The format to apply
    • defineVertexBuffer

      VertexArrayBuilder defineVertexBuffer(int index, int buffer, int offset, int stride, int divisor)
      Maps a buffer region to the specified index. Allows swapping out vertex data with a single GL call.
      Parameters:
      index - The index to assign to. It must be between 0 and VeilRenderSystem.maxVertexAttributes()
      buffer - The buffer to assign
      offset - The offset into the buffer to bind to
      stride - The size of the region to map
      divisor - The number of instances that have to pass to increment this data or 0 to increment per vertex
    • setVertexAttribute

      VertexArrayBuilder setVertexAttribute(int index, int bufferIndex, int size, VertexArrayBuilder.DataType type, boolean normalized, int relativeOffset)
      Defines a floating-point vertex attribute.
      Parameters:
      index - The index of the attribute to assign
      bufferIndex - The defined buffer index to use. Defined with defineVertexBuffer(int, int, int, int, int)
      size - The size of the attribute. Can be 1, 2, 3, or 4
      type - The type of data the shader will use
      normalized - Whether to normalize the data from -1 to 1 automatically
      relativeOffset - The offset in the buffer region the vertex data is defined at. It must be between 0 and VeilRenderSystem.maxVertexAttributeRelativeOffset()
    • setVertexIAttribute

      VertexArrayBuilder setVertexIAttribute(int index, int bufferIndex, int size, VertexArrayBuilder.DataType type, int relativeOffset)
      Defines an integer vertex attribute.
      Parameters:
      index - The index of the attribute to assign
      bufferIndex - The defined buffer index to use. Defined with defineVertexBuffer(int, int, int, int, int)
      size - The size of the attribute. Can be 1, 2, 3, or 4
      type - The type of data the shader will use
      relativeOffset - The offset in the buffer region the vertex data is defined at. It must be between 0 and VeilRenderSystem.maxVertexAttributeRelativeOffset()
    • setVertexLAttribute

      VertexArrayBuilder setVertexLAttribute(int index, int bufferIndex, int size, VertexArrayBuilder.DataType type, int relativeOffset)
      Defines a long vertex attribute.
      Parameters:
      index - The index of the attribute to assign
      bufferIndex - The defined buffer index to use. Defined with defineVertexBuffer(int, int, int, int, int)
      size - The size of the attribute. Can be 1, 2, 3, or 4
      type - The type of data the shader will use
      relativeOffset - The offset in the buffer region the vertex data is defined at. It must be between 0 and VeilRenderSystem.maxVertexAttributeRelativeOffset()
    • removeVertexBuffer

      VertexArrayBuilder removeVertexBuffer(int index)
      Removes the buffer mapping with the specified index.
      Parameters:
      index - The index of the buffer to remove
    • removeAttribute

      VertexArrayBuilder removeAttribute(int index)
      Removes the attribute with the specified index.
      Parameters:
      index - The index of the attribute to remove
    • clearVertexBuffers

      VertexArrayBuilder clearVertexBuffers()
      Clears all mapped buffer regions.
    • clearVertexAttributes

      VertexArrayBuilder clearVertexAttributes()
      Clears all defined vertex attributes.