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,
uses this technique to save bandwidth.invalid reference
star rendering
- Implementation Note:
- This is mostly a wrapper around vertex buffer object (VBO), element buffer object (EBO), and vertex array object (VAO).
- Mappings:
Namespace Name named net/minecraft/client/gl/VertexBufferintermediary net/minecraft/class_291official fkb
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate VertexFormat.DrawModeprivate intprivate VertexFormat.IndexTypeprivate RenderSystem.ShapeIndexBufferprivate final GlUsageprivate intprivate final GpuBufferprivate @Nullable VertexFormat -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbind()Sets this vertex buffer as the current one.voidclose()static VertexBuffercreateAndUpload(VertexFormat.DrawMode drawMode, VertexFormat format, Consumer<VertexConsumer> callback) voiddraw()Draws the contents in this vertex buffer.voiddraw(RenderLayer renderLayer) private voiddraw(Matrix4f viewMatrix, Matrix4f projectionMatrix, @Nullable ShaderProgram shaderProgram, @Nullable Consumer<ShaderProgram> consumer) Draws the contents in this vertex buffer withprogram.private VertexFormat.IndexTypebooleanisClosed()voidmethod_67802(ShaderProgramLayer shaderProgramLayer, @Nullable Consumer<ShaderProgram> consumer) voidmethod_67803(RenderLayer renderLayer, @Nullable Consumer<ShaderProgram> consumer) voidmethod_67804(Matrix4f matrix4f, Matrix4f matrix4f2, @Nullable ShaderProgram shaderProgram) static voidunbind()voidupload(BuiltBuffer data) Uploads the contents ofbufferto GPU, discarding previously uploaded data.private RenderSystem.ShapeIndexBufferuploadIndexBuffer(BuiltBuffer.DrawParameters parameters, @Nullable ByteBuffer buf) voidprivate VertexFormatuploadVertexBuffer(BuiltBuffer.DrawParameters parameters, @Nullable ByteBuffer vertexBuffer)
-
Field Details
-
usage
- Mappings:
Namespace Name Mixin selector named usageLnet/minecraft/client/gl/VertexBuffer;usage:Lnet/minecraft/client/gl/GlUsage;intermediary field_44792Lnet/minecraft/class_291;field_44792:Lnet/minecraft/class_8555;official aLfkb;a:Lfhm;
-
vertexBuffer
- Mappings:
Namespace Name Mixin selector named vertexBufferLnet/minecraft/client/gl/VertexBuffer;vertexBuffer:Lnet/minecraft/client/gl/GpuBuffer;intermediary field_1594Lnet/minecraft/class_291;field_1594:Lnet/minecraft/class_10227;official bLfkb;b:Lfhn;
-
indexBuffer
- Mappings:
Namespace Name Mixin selector named indexBufferLnet/minecraft/client/gl/VertexBuffer;indexBuffer:Lnet/minecraft/client/gl/GpuBuffer;intermediary field_27366Lnet/minecraft/class_291;field_27366:Lnet/minecraft/class_10227;official cLfkb;c:Lfhn;
-
vertexArrayId
private int vertexArrayId- Mappings:
Namespace Name Mixin selector named vertexArrayIdLnet/minecraft/client/gl/VertexBuffer;vertexArrayId:Iintermediary field_29338Lnet/minecraft/class_291;field_29338:Iofficial dLfkb;d:I
-
vertexFormat
- Mappings:
Namespace Name Mixin selector named vertexFormatLnet/minecraft/client/gl/VertexBuffer;vertexFormat:Lnet/minecraft/client/render/VertexFormat;intermediary field_29339Lnet/minecraft/class_291;field_29339:Lnet/minecraft/class_293;official eLfkb;e:Lfkd;
-
indexType
- Mappings:
Namespace Name Mixin selector named indexTypeLnet/minecraft/client/gl/VertexBuffer;indexType:Lnet/minecraft/client/render/VertexFormat$IndexType;intermediary field_27367Lnet/minecraft/class_291;field_27367:Lnet/minecraft/class_293$class_5595;official gLfkb;g:Lfkd$b;
-
indexCount
private int indexCount- Mappings:
Namespace Name Mixin selector named indexCountLnet/minecraft/client/gl/VertexBuffer;indexCount:Iintermediary field_1593Lnet/minecraft/class_291;field_1593:Iofficial hLfkb;h:I
-
drawMode
- Mappings:
Namespace Name Mixin selector named drawModeLnet/minecraft/client/gl/VertexBuffer;drawMode:Lnet/minecraft/client/render/VertexFormat$DrawMode;intermediary field_27368Lnet/minecraft/class_291;field_27368:Lnet/minecraft/class_293$class_5596;official iLfkb;i:Lfkd$c;
-
-
Constructor Details
-
VertexBuffer
- Mappings:
Namespace Name Mixin selector named <init>Lnet/minecraft/client/gl/VertexBuffer;<init>(Lnet/minecraft/client/gl/GlUsage;)Vintermediary <init>Lnet/minecraft/class_291;<init>(Lnet/minecraft/class_8555;)Vofficial <init>Lfkb;<init>(Lfhm;)V
-
-
Method Details
-
createAndUpload
public static VertexBuffer createAndUpload(VertexFormat.DrawMode drawMode, VertexFormat format, Consumer<VertexConsumer> callback) - Mappings:
Namespace Name Mixin selector named createAndUploadLnet/minecraft/client/gl/VertexBuffer;createAndUpload(Lnet/minecraft/client/render/VertexFormat$DrawMode;Lnet/minecraft/client/render/VertexFormat;Ljava/util/function/Consumer;)Lnet/minecraft/client/gl/VertexBuffer;intermediary method_65175Lnet/minecraft/class_291;method_65175(Lnet/minecraft/class_293$class_5596;Lnet/minecraft/class_293;Ljava/util/function/Consumer;)Lnet/minecraft/class_291;official aLfkb;a(Lfkd$c;Lfkd;Ljava/util/function/Consumer;)Lfkb;
-
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 named uploadLnet/minecraft/client/gl/VertexBuffer;upload(Lnet/minecraft/client/render/BuiltBuffer;)Vintermediary method_1352Lnet/minecraft/class_291;method_1352(Lnet/minecraft/class_9801;)Vofficial aLfkb;a(Lfjx;)V
-
uploadIndexBuffer
- Mappings:
Namespace Name Mixin selector named uploadIndexBufferLnet/minecraft/client/gl/VertexBuffer;uploadIndexBuffer(Lnet/minecraft/client/util/BufferAllocator$CloseableBuffer;)Vintermediary method_60829Lnet/minecraft/class_291;method_60829(Lnet/minecraft/class_9799$class_9800;)Vofficial aLfkb;a(Lfjv$a;)V
-
uploadVertexBuffer
private VertexFormat uploadVertexBuffer(BuiltBuffer.DrawParameters parameters, @Nullable @Nullable ByteBuffer vertexBuffer) - Mappings:
Namespace Name Mixin selector named uploadVertexBufferLnet/minecraft/client/gl/VertexBuffer;uploadVertexBuffer(Lnet/minecraft/client/render/BuiltBuffer$DrawParameters;Ljava/nio/ByteBuffer;)Lnet/minecraft/client/render/VertexFormat;intermediary method_43442Lnet/minecraft/class_291;method_43442(Lnet/minecraft/class_9801$class_4574;Ljava/nio/ByteBuffer;)Lnet/minecraft/class_293;official aLfkb;a(Lfjx$a;Ljava/nio/ByteBuffer;)Lfkd;
-
uploadIndexBuffer
@Nullable private RenderSystem.ShapeIndexBuffer uploadIndexBuffer(BuiltBuffer.DrawParameters parameters, @Nullable @Nullable ByteBuffer buf) - Mappings:
Namespace Name Mixin selector named uploadIndexBufferLnet/minecraft/client/gl/VertexBuffer;uploadIndexBuffer(Lnet/minecraft/client/render/BuiltBuffer$DrawParameters;Ljava/nio/ByteBuffer;)Lcom/mojang/blaze3d/systems/RenderSystem$ShapeIndexBuffer;intermediary method_43443Lnet/minecraft/class_291;method_43443(Lnet/minecraft/class_9801$class_4574;Ljava/nio/ByteBuffer;)Lcom/mojang/blaze3d/systems/RenderSystem$class_5590;official bLfkb;b(Lfjx$a;Ljava/nio/ByteBuffer;)Lcom/mojang/blaze3d/systems/RenderSystem$a;
-
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 named bindLnet/minecraft/client/gl/VertexBuffer;bind()Vintermediary method_1353Lnet/minecraft/class_291;method_1353()Vofficial aLfkb;a()V
-
unbind
public static void unbind()- Mappings:
Namespace Name Mixin selector named unbindLnet/minecraft/client/gl/VertexBuffer;unbind()Vintermediary method_1354Lnet/minecraft/class_291;method_1354()Vofficial bLfkb;b()V
-
draw
public void draw()Draws the contents in this vertex buffer.The caller of this method must bind this vertex buffer before calling this method.
Unlike
, the caller of this method must manually bind a shader program before calling this method.invalid reference
#draw(Matrix4f, Matrix4f, ShaderProgram)- Mappings:
Namespace Name Mixin selector named drawLnet/minecraft/client/gl/VertexBuffer;draw()Vintermediary method_35665Lnet/minecraft/class_291;method_35665()Vofficial cLfkb;c()V
-
getIndexType
- Mappings:
Namespace Name Mixin selector named getIndexTypeLnet/minecraft/client/gl/VertexBuffer;getIndexType()Lnet/minecraft/client/render/VertexFormat$IndexType;intermediary method_43445Lnet/minecraft/class_291;method_43445()Lnet/minecraft/class_293$class_5595;official fLfkb;f()Lfkd$b;
-
method_67804
public void method_67804(Matrix4f matrix4f, Matrix4f matrix4f2, @Nullable @Nullable ShaderProgram shaderProgram) - Mappings:
Namespace Name Mixin selector named method_67804Lnet/minecraft/client/gl/VertexBuffer;method_67804(Lorg/joml/Matrix4f;Lorg/joml/Matrix4f;Lnet/minecraft/client/gl/ShaderProgram;)Vintermediary method_67804Lnet/minecraft/class_291;method_67804(Lorg/joml/Matrix4f;Lorg/joml/Matrix4f;Lnet/minecraft/class_5944;)Vofficial aLfkb;a(Lorg/joml/Matrix4f;Lorg/joml/Matrix4f;Lgpv;)V
-
method_67802
public void method_67802(ShaderProgramLayer shaderProgramLayer, @Nullable @Nullable Consumer<ShaderProgram> consumer) - Mappings:
Namespace Name Mixin selector named method_67802Lnet/minecraft/client/gl/VertexBuffer;method_67802(Lnet/minecraft/client/gl/ShaderProgramLayer;Ljava/util/function/Consumer;)Vintermediary method_67802Lnet/minecraft/class_291;method_67802(Lnet/minecraft/class_10785;Ljava/util/function/Consumer;)Vofficial aLfkb;a(Lfid;Ljava/util/function/Consumer;)V
-
draw
private void draw(Matrix4f viewMatrix, Matrix4f projectionMatrix, @Nullable @Nullable ShaderProgram shaderProgram, @Nullable @Nullable Consumer<ShaderProgram> consumer) Draws the contents in this vertex buffer withprogram.The caller of this method must bind this vertex buffer before calling this method.
- Mappings:
Namespace Name Mixin selector named drawLnet/minecraft/client/gl/VertexBuffer;draw(Lorg/joml/Matrix4f;Lorg/joml/Matrix4f;Lnet/minecraft/client/gl/ShaderProgram;Ljava/util/function/Consumer;)Vintermediary method_34427Lnet/minecraft/class_291;method_34427(Lorg/joml/Matrix4f;Lorg/joml/Matrix4f;Lnet/minecraft/class_5944;Ljava/util/function/Consumer;)Vofficial aLfkb;a(Lorg/joml/Matrix4f;Lorg/joml/Matrix4f;Lgpv;Ljava/util/function/Consumer;)V
-
draw
- Mappings:
Namespace Name Mixin selector named drawLnet/minecraft/client/gl/VertexBuffer;draw(Lnet/minecraft/client/render/RenderLayer;)Vintermediary method_65176Lnet/minecraft/class_291;method_65176(Lnet/minecraft/class_1921;)Vofficial aLfkb;a(Lgqx;)V
-
method_67803
public void method_67803(RenderLayer renderLayer, @Nullable @Nullable Consumer<ShaderProgram> consumer) - Mappings:
Namespace Name Mixin selector named method_67803Lnet/minecraft/client/gl/VertexBuffer;method_67803(Lnet/minecraft/client/render/RenderLayer;Ljava/util/function/Consumer;)Vintermediary method_67803Lnet/minecraft/class_291;method_67803(Lnet/minecraft/class_1921;Ljava/util/function/Consumer;)Vofficial aLfkb;a(Lgqx;Ljava/util/function/Consumer;)V
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
getVertexFormat
- Mappings:
Namespace Name Mixin selector named getVertexFormatLnet/minecraft/client/gl/VertexBuffer;getVertexFormat()Lnet/minecraft/client/render/VertexFormat;intermediary method_34435Lnet/minecraft/class_291;method_34435()Lnet/minecraft/class_293;official dLfkb;d()Lfkd;
-
isClosed
public boolean isClosed()- Mappings:
Namespace Name Mixin selector named isClosedLnet/minecraft/client/gl/VertexBuffer;isClosed()Zintermediary method_43444Lnet/minecraft/class_291;method_43444()Zofficial eLfkb;e()Z
-