Interface VertexArrayBuilder
- All Known Implementing Classes:
ARBVertexAttribBindingBuilder
,DSAVertexAttribBindingBuilder
,LegacyVertexAttribBindingBuilder
public interface VertexArrayBuilder
Builder for modifying vertex buffer state.
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptiondefault VertexArrayBuilder
applyFrom
(int bufferIndex, int buffer, int attributeStart, com.mojang.blaze3d.vertex.VertexFormat format) Applies the vanilla mc format at the specified index.Clears all defined vertex attributes.Clears all mapped buffer regions.defineVertexBuffer
(int index, int buffer, int offset, int stride, int divisor) Maps a buffer region to the specified index.removeAttribute
(int index) Removes the attribute with the specified index.removeVertexBuffer
(int index) Removes the buffer mapping with the specified index.setVertexAttribute
(int index, int bufferIndex, int size, VertexArrayBuilder.DataType type, boolean normalized, int relativeOffset) Defines a floating-point vertex attribute.setVertexIAttribute
(int index, int bufferIndex, int size, VertexArrayBuilder.DataType type, int relativeOffset) Defines an integer vertex attribute.setVertexLAttribute
(int index, int bufferIndex, int size, VertexArrayBuilder.DataType type, int relativeOffset) Defines a long vertex attribute.static void
validateRelativeOffset
(int offset)
-
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 tobuffer
- The buffer to get data fromattributeStart
- The first attribute index to start applying the format fromformat
- The format to apply
-
defineVertexBuffer
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 andVeilRenderSystem.maxVertexAttributes()
buffer
- The buffer to assignoffset
- The offset into the buffer to bind tostride
- The size of the region to mapdivisor
- The number of instances that have to pass to increment this data or0
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 assignbufferIndex
- The defined buffer index to use. Defined withdefineVertexBuffer(int, int, int, int, int)
size
- The size of the attribute. Can be 1, 2, 3, or 4type
- The type of data the shader will usenormalized
- Whether to normalize the data from-1
to1
automaticallyrelativeOffset
- The offset in the buffer region the vertex data is defined at. It must be between 0 andVeilRenderSystem.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 assignbufferIndex
- The defined buffer index to use. Defined withdefineVertexBuffer(int, int, int, int, int)
size
- The size of the attribute. Can be 1, 2, 3, or 4type
- The type of data the shader will userelativeOffset
- The offset in the buffer region the vertex data is defined at. It must be between 0 andVeilRenderSystem.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 assignbufferIndex
- The defined buffer index to use. Defined withdefineVertexBuffer(int, int, int, int, int)
size
- The size of the attribute. Can be 1, 2, 3, or 4type
- The type of data the shader will userelativeOffset
- The offset in the buffer region the vertex data is defined at. It must be between 0 andVeilRenderSystem.maxVertexAttributeRelativeOffset()
-
removeVertexBuffer
Removes the buffer mapping with the specified index.- Parameters:
index
- The index of the buffer to remove
-
removeAttribute
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.
-