Package net.minecraft.client.gl
Class VertexBuffer
java.lang.Object
net.minecraft.client.gl.VertexBuffer
- All Implemented Interfaces:
AutoCloseable
Stores vertex data on GPU.
If you don't need to change the geometry, you can upload data once and reuse it every frame. For example, star rendering uses this technique to save bandwidth.
- Implementation Note:
- This is mostly a wrapper around vertex buffer object (VBO), element buffer object (EBO), and vertex array object (VAO).
- Mappings:
Namespace Name official eatintermediary net/minecraft/class_291named net/minecraft/client/gl/VertexBuffer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate VertexFormat.DrawModeprivate RenderSystem.IndexBufferprivate intprivate VertexFormat.IndexTypeprivate intprivate intprivate intprivate @Nullable VertexFormat -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbind()Sets this vertex buffer as the current one.voidclose()private RenderSystem.IndexBufferconfigureIndexBuffer(BufferBuilder.DrawArrayParameters parameters, ByteBuffer data) private VertexFormatconfigureVertexFormat(BufferBuilder.DrawArrayParameters parameters, ByteBuffer data) voidDraws the contents in this vertex buffer withshader.voidDraws the contents in this vertex buffer.private voiddrawInternal(Matrix4f viewMatrix, Matrix4f projectionMatrix, Shader shader) private VertexFormat.IndexTypebooleanisClosed()static voidunbind()voidupload(BufferBuilder.BuiltBuffer buffer) Uploads the contents ofbufferto GPU, discarding previously uploaded data.
-
Field Details
-
vertexBufferId
private int vertexBufferId- Mappings:
Namespace Name Mixin selector official aLeat;a:Iintermediary field_1594Lnet/minecraft/class_291;field_1594:Inamed vertexBufferIdLnet/minecraft/client/gl/VertexBuffer;vertexBufferId:I
-
indexBufferId
private int indexBufferId- Mappings:
Namespace Name Mixin selector official bLeat;b:Iintermediary field_27366Lnet/minecraft/class_291;field_27366:Inamed indexBufferIdLnet/minecraft/client/gl/VertexBuffer;indexBufferId:I
-
vertexArrayId
private int vertexArrayId- Mappings:
Namespace Name Mixin selector official cLeat;c:Iintermediary field_29338Lnet/minecraft/class_291;field_29338:Inamed vertexArrayIdLnet/minecraft/client/gl/VertexBuffer;vertexArrayId:I
-
vertexFormat
- Mappings:
Namespace Name Mixin selector official dLeat;d:Leav;intermediary field_29339Lnet/minecraft/class_291;field_29339:Lnet/minecraft/class_293;named vertexFormatLnet/minecraft/client/gl/VertexBuffer;vertexFormat:Lnet/minecraft/client/render/VertexFormat;
-
indexBuffer
- Mappings:
Namespace Name Mixin selector official eLeat;e:Lcom/mojang/blaze3d/systems/RenderSystem$a;intermediary field_38983Lnet/minecraft/class_291;field_38983:Lcom/mojang/blaze3d/systems/RenderSystem$class_5590;named indexBufferLnet/minecraft/client/gl/VertexBuffer;indexBuffer:Lcom/mojang/blaze3d/systems/RenderSystem$IndexBuffer;
-
indexType
- Mappings:
Namespace Name Mixin selector official fLeat;f:Leav$a;intermediary field_27367Lnet/minecraft/class_291;field_27367:Lnet/minecraft/class_293$class_5595;named indexTypeLnet/minecraft/client/gl/VertexBuffer;indexType:Lnet/minecraft/client/render/VertexFormat$IndexType;
-
vertexCount
private int vertexCount- Mappings:
Namespace Name Mixin selector official gLeat;g:Iintermediary field_1593Lnet/minecraft/class_291;field_1593:Inamed vertexCountLnet/minecraft/client/gl/VertexBuffer;vertexCount:I
-
drawMode
- Mappings:
Namespace Name Mixin selector official hLeat;h:Leav$b;intermediary field_27368Lnet/minecraft/class_291;field_27368:Lnet/minecraft/class_293$class_5596;named drawModeLnet/minecraft/client/gl/VertexBuffer;drawMode:Lnet/minecraft/client/render/VertexFormat$DrawMode;
-
-
Constructor Details
-
VertexBuffer
public VertexBuffer()
-
-
Method Details
-
upload
Uploads the contents ofbufferto GPU, discarding previously uploaded data.The caller of this method must bind this vertex buffer before calling this method.
- Mappings:
Namespace Name Mixin selector official aLeat;a(Leal$b;)Vintermediary method_1352Lnet/minecraft/class_291;method_1352(Lnet/minecraft/class_287$class_7433;)Vnamed uploadLnet/minecraft/client/gl/VertexBuffer;upload(Lnet/minecraft/client/render/BufferBuilder$BuiltBuffer;)V
-
configureVertexFormat
private VertexFormat configureVertexFormat(BufferBuilder.DrawArrayParameters parameters, ByteBuffer data) - Mappings:
Namespace Name Mixin selector official aLeat;a(Leal$a;Ljava/nio/ByteBuffer;)Leav;intermediary method_43442Lnet/minecraft/class_291;method_43442(Lnet/minecraft/class_287$class_4574;Ljava/nio/ByteBuffer;)Lnet/minecraft/class_293;named configureVertexFormatLnet/minecraft/client/gl/VertexBuffer;configureVertexFormat(Lnet/minecraft/client/render/BufferBuilder$DrawArrayParameters;Ljava/nio/ByteBuffer;)Lnet/minecraft/client/render/VertexFormat;
-
configureIndexBuffer
@Nullable private RenderSystem.IndexBuffer configureIndexBuffer(BufferBuilder.DrawArrayParameters parameters, ByteBuffer data) - Mappings:
Namespace Name Mixin selector official bLeat;b(Leal$a;Ljava/nio/ByteBuffer;)Lcom/mojang/blaze3d/systems/RenderSystem$a;intermediary method_43443Lnet/minecraft/class_291;method_43443(Lnet/minecraft/class_287$class_4574;Ljava/nio/ByteBuffer;)Lcom/mojang/blaze3d/systems/RenderSystem$class_5590;named configureIndexBufferLnet/minecraft/client/gl/VertexBuffer;configureIndexBuffer(Lnet/minecraft/client/render/BufferBuilder$DrawArrayParameters;Ljava/nio/ByteBuffer;)Lcom/mojang/blaze3d/systems/RenderSystem$IndexBuffer;
-
bind
public void bind()Sets this vertex buffer as the current one.This method must be called before uploading or drawing data.
- Mappings:
Namespace Name Mixin selector official aLeat;a()Vintermediary method_1353Lnet/minecraft/class_291;method_1353()Vnamed bindLnet/minecraft/client/gl/VertexBuffer;bind()V
-
unbind
public static void unbind()- Mappings:
Namespace Name Mixin selector official bLeat;b()Vintermediary method_1354Lnet/minecraft/class_291;method_1354()Vnamed unbindLnet/minecraft/client/gl/VertexBuffer;unbind()V
-
drawElements
public void drawElements()Draws the contents in this vertex buffer.The caller of this method must bind this vertex buffer before calling this method.
Unlike
draw(Matrix4f, Matrix4f, Shader), the caller of this method must manually bind a shader before calling this method.- Mappings:
Namespace Name Mixin selector official cLeat;c()Vintermediary method_35665Lnet/minecraft/class_291;method_35665()Vnamed drawElementsLnet/minecraft/client/gl/VertexBuffer;drawElements()V
-
getIndexType
- Mappings:
Namespace Name Mixin selector official fLeat;f()Leav$a;intermediary method_43445Lnet/minecraft/class_291;method_43445()Lnet/minecraft/class_293$class_5595;named getIndexTypeLnet/minecraft/client/gl/VertexBuffer;getIndexType()Lnet/minecraft/client/render/VertexFormat$IndexType;
-
draw
Draws the contents in this vertex buffer withshader.The caller of this method must bind this vertex buffer before calling this method.
- Mappings:
Namespace Name Mixin selector official aLeat;a(Ld;Ld;Lfad;)Vintermediary method_34427Lnet/minecraft/class_291;method_34427(Lnet/minecraft/class_1159;Lnet/minecraft/class_1159;Lnet/minecraft/class_5944;)Vnamed drawLnet/minecraft/client/gl/VertexBuffer;draw(Lnet/minecraft/util/math/Matrix4f;Lnet/minecraft/util/math/Matrix4f;Lnet/minecraft/client/render/Shader;)V
-
drawInternal
- Mappings:
Namespace Name Mixin selector official bLeat;b(Ld;Ld;Lfad;)Vintermediary method_34431Lnet/minecraft/class_291;method_34431(Lnet/minecraft/class_1159;Lnet/minecraft/class_1159;Lnet/minecraft/class_5944;)Vnamed drawInternalLnet/minecraft/client/gl/VertexBuffer;drawInternal(Lnet/minecraft/util/math/Matrix4f;Lnet/minecraft/util/math/Matrix4f;Lnet/minecraft/client/render/Shader;)V
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
getVertexFormat
- Mappings:
Namespace Name Mixin selector official dLeat;d()Leav;intermediary method_34435Lnet/minecraft/class_291;method_34435()Lnet/minecraft/class_293;named getVertexFormatLnet/minecraft/client/gl/VertexBuffer;getVertexFormat()Lnet/minecraft/client/render/VertexFormat;
-
isClosed
public boolean isClosed()- Mappings:
Namespace Name Mixin selector official eLeat;e()Zintermediary method_43444Lnet/minecraft/class_291;method_43444()Znamed isClosedLnet/minecraft/client/gl/VertexBuffer;isClosed()Z
-