Class VertexArray
java.lang.Object
foundry.veil.api.client.render.vertex.VertexArray
- All Implemented Interfaces:
AutoCloseable
,org.lwjgl.system.NativeResource
- Direct Known Subclasses:
ARBVertexAttribBindingVertexArray
,DSAVertexAttribBindingVertexArray
,LegacyVertexArray
More genetic alternative to
VertexBuffer
that uses the latest available OpenGL version.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
static enum
-
Field Summary
Modifier and TypeFieldDescriptionprotected final it.unimi.dsi.fastutil.ints.Int2IntMap
static final int
protected final int
protected int
protected VertexArray.IndexType
static final int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
bind()
Binds this vertex array and applies any changes to the format automatically.static VertexArray
create()
Creates a single new vertex array.static VertexArray[]
create
(int count) Creates an array of vertex arrays.static void
create
(VertexArray[] fill) Replaces each element of the specified array with a new vertex array.protected abstract int
void
draw
(int mode) void
drawIndirect
(int mode, long indirect, int drawCount, int stride) void
drawInstanced
(int mode, int instances) abstract VertexArrayBuilder
void
free()
int
getId()
int
int
getOrCreateBuffer
(int index) Creates a new buffer object owned by this vertex array or retrieves an existing buffer.void
setIndexCount
(int indexCount, VertexArray.IndexType indexType) static void
unbind()
Unbinds the current vertex array.void
upload
(int attributeStart, com.mojang.blaze3d.vertex.MeshData meshData, VertexArray.DrawUsage usage) Uploads vanilla mc mesh data into this vertex array.static void
upload
(int buffer, ByteBuffer data, VertexArray.DrawUsage usage) Uploads mesh data into the specified buffer.void
upload
(com.mojang.blaze3d.vertex.MeshData meshData, VertexArray.DrawUsage usage) Uploads vanilla mc mesh data into this vertex array.void
uploadIndexBuffer
(com.mojang.blaze3d.vertex.MeshData.DrawState drawState) Uploads index data to the vertex array.void
uploadIndexBuffer
(ByteBuffer data) Uploads index data to the vertex array.protected abstract void
uploadVertexBuffer
(int buffer, ByteBuffer data, int usage) Uploads vertex data to the specified buffer.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.lwjgl.system.NativeResource
close
-
Field Details
-
VERTEX_BUFFER
public static final int VERTEX_BUFFER- See Also:
-
ELEMENT_ARRAY_BUFFER
public static final int ELEMENT_ARRAY_BUFFER- See Also:
-
id
protected final int id -
buffers
protected final it.unimi.dsi.fastutil.ints.Int2IntMap buffers -
indexCount
protected int indexCount -
indexType
-
-
Constructor Details
-
VertexArray
@Internal protected VertexArray(int id)
-
-
Method Details
-
create
Creates a single new vertex array.- Returns:
- A new vertex array
-
create
Creates an array of vertex arrays.- Parameters:
count
- The number of arrays to create- Returns:
- An array of new vertex arrays
-
create
Replaces each element of the specified array with a new vertex array.- Parameters:
fill
- The array to fill
-
getOrCreateBuffer
public int getOrCreateBuffer(int index) Creates a new buffer object owned by this vertex array or retrieves an existing buffer.- Parameters:
index
- The index of the buffer to get- Returns:
- A vertex array object
-
getId
public int getId()- Returns:
- The OpenGL id of this vertex array
-
getIndexCount
public int getIndexCount()- Returns:
- The number of indices in this array
-
getIndexType
- Returns:
- The data type of the index buffer
-
upload
Uploads mesh data into the specified buffer.- Parameters:
data
- The data to uploadusage
- The draw usage
-
upload
Uploads vanilla mc mesh data into this vertex array. Only a single mesh can be uploaded this way.- Parameters:
meshData
- The data to uploadusage
- The draw usage
-
upload
public void upload(int attributeStart, com.mojang.blaze3d.vertex.MeshData meshData, VertexArray.DrawUsage usage) Uploads vanilla mc mesh data into this vertex array. Only a single mesh can be uploaded this way.- Parameters:
attributeStart
- The attribute to start uploading vertex data tomeshData
- The data to uploadusage
- The draw usage
-
uploadIndexBuffer
public void uploadIndexBuffer(com.mojang.blaze3d.vertex.MeshData.DrawState drawState) Uploads index data to the vertex array.- Parameters:
drawState
- The buffer draw state
-
uploadIndexBuffer
Uploads index data to the vertex array.- Parameters:
data
- The data to upload
-
createBuffer
protected abstract int createBuffer()- Returns:
- Creates a new vertex buffer
-
uploadVertexBuffer
Uploads vertex data to the specified buffer.- Parameters:
buffer
- The buffer to upload intodata
- The data to uploadusage
- The data usage
-
editFormat
- Returns:
- A builder for applying changes to this array
-
bind
public void bind()Binds this vertex array and applies any changes to the format automatically. -
unbind
public static void unbind()Unbinds the current vertex array. -
draw
public void draw(int mode) -
drawInstanced
public void drawInstanced(int mode, int instances) -
drawIndirect
public void drawIndirect(int mode, long indirect, int drawCount, int stride) -
setIndexCount
-
free
public void free()- Specified by:
free
in interfaceorg.lwjgl.system.NativeResource
-