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 eim
intermediary net/minecraft/class_291
named net/minecraft/client/gl/VertexBuffer
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprivate VertexFormat.DrawMode
private int
private int
private VertexFormat.IndexType
private RenderSystem.ShapeIndexBuffer
private final VertexBuffer.Usage
private int
private int
private @Nullable VertexFormat
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
bind()
Sets this vertex buffer as the current one.void
close()
void
draw()
Draws the contents in this vertex buffer.void
draw
(Matrix4f viewMatrix, Matrix4f projectionMatrix, ShaderProgram program) Draws the contents in this vertex buffer withprogram
.private void
drawInternal
(Matrix4f viewMatrix, Matrix4f projectionMatrix, ShaderProgram program) private VertexFormat.IndexType
boolean
isClosed()
static void
unbind()
void
upload
(BufferBuilder.BuiltBuffer buffer) Uploads the contents ofbuffer
to GPU, discarding previously uploaded data.private RenderSystem.ShapeIndexBuffer
uploadIndexBuffer
(BufferBuilder.DrawParameters parameters, ByteBuffer indexBuffer) private VertexFormat
uploadVertexBuffer
(BufferBuilder.DrawParameters parameters, ByteBuffer vertexBuffer)
-
Field Details
-
usage
- Mappings:
Namespace Name Mixin selector official a
Leim;a:Leim$a;
intermediary field_44792
Lnet/minecraft/class_291;field_44792:Lnet/minecraft/class_291$class_8555;
named usage
Lnet/minecraft/client/gl/VertexBuffer;usage:Lnet/minecraft/client/gl/VertexBuffer$Usage;
-
vertexBufferId
private int vertexBufferId- Mappings:
Namespace Name Mixin selector official b
Leim;b:I
intermediary field_1594
Lnet/minecraft/class_291;field_1594:I
named vertexBufferId
Lnet/minecraft/client/gl/VertexBuffer;vertexBufferId:I
-
indexBufferId
private int indexBufferId- Mappings:
Namespace Name Mixin selector official c
Leim;c:I
intermediary field_27366
Lnet/minecraft/class_291;field_27366:I
named indexBufferId
Lnet/minecraft/client/gl/VertexBuffer;indexBufferId:I
-
vertexArrayId
private int vertexArrayId- Mappings:
Namespace Name Mixin selector official d
Leim;d:I
intermediary field_29338
Lnet/minecraft/class_291;field_29338:I
named vertexArrayId
Lnet/minecraft/client/gl/VertexBuffer;vertexArrayId:I
-
vertexFormat
- Mappings:
Namespace Name Mixin selector official e
Leim;e:Leio;
intermediary field_29339
Lnet/minecraft/class_291;field_29339:Lnet/minecraft/class_293;
named vertexFormat
Lnet/minecraft/client/gl/VertexBuffer;vertexFormat:Lnet/minecraft/client/render/VertexFormat;
-
indexType
- Mappings:
Namespace Name Mixin selector official g
Leim;g:Leio$a;
intermediary field_27367
Lnet/minecraft/class_291;field_27367:Lnet/minecraft/class_293$class_5595;
named indexType
Lnet/minecraft/client/gl/VertexBuffer;indexType:Lnet/minecraft/client/render/VertexFormat$IndexType;
-
indexCount
private int indexCount- Mappings:
Namespace Name Mixin selector official h
Leim;h:I
intermediary field_1593
Lnet/minecraft/class_291;field_1593:I
named indexCount
Lnet/minecraft/client/gl/VertexBuffer;indexCount:I
-
drawMode
- Mappings:
Namespace Name Mixin selector official i
Leim;i:Leio$b;
intermediary field_27368
Lnet/minecraft/class_291;field_27368:Lnet/minecraft/class_293$class_5596;
named drawMode
Lnet/minecraft/client/gl/VertexBuffer;drawMode:Lnet/minecraft/client/render/VertexFormat$DrawMode;
-
-
Constructor Details
-
VertexBuffer
- Mappings:
Namespace Name Mixin selector official <init>
Leim;<init>(Leim$a;)V
intermediary <init>
Lnet/minecraft/class_291;<init>(Lnet/minecraft/class_291$class_8555;)V
named <init>
Lnet/minecraft/client/gl/VertexBuffer;<init>(Lnet/minecraft/client/gl/VertexBuffer$Usage;)V
-
-
Method Details
-
upload
Uploads the contents ofbuffer
to 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 a
Leim;a(Leie$b;)V
intermediary method_1352
Lnet/minecraft/class_291;method_1352(Lnet/minecraft/class_287$class_7433;)V
named upload
Lnet/minecraft/client/gl/VertexBuffer;upload(Lnet/minecraft/client/render/BufferBuilder$BuiltBuffer;)V
-
uploadVertexBuffer
private VertexFormat uploadVertexBuffer(BufferBuilder.DrawParameters parameters, ByteBuffer vertexBuffer) - Mappings:
Namespace Name Mixin selector official a
Leim;a(Leie$a;Ljava/nio/ByteBuffer;)Leio;
intermediary method_43442
Lnet/minecraft/class_291;method_43442(Lnet/minecraft/class_287$class_4574;Ljava/nio/ByteBuffer;)Lnet/minecraft/class_293;
named uploadVertexBuffer
Lnet/minecraft/client/gl/VertexBuffer;uploadVertexBuffer(Lnet/minecraft/client/render/BufferBuilder$DrawParameters;Ljava/nio/ByteBuffer;)Lnet/minecraft/client/render/VertexFormat;
-
uploadIndexBuffer
@Nullable private RenderSystem.ShapeIndexBuffer uploadIndexBuffer(BufferBuilder.DrawParameters parameters, ByteBuffer indexBuffer) - Mappings:
Namespace Name Mixin selector official b
Leim;b(Leie$a;Ljava/nio/ByteBuffer;)Lcom/mojang/blaze3d/systems/RenderSystem$a;
intermediary method_43443
Lnet/minecraft/class_291;method_43443(Lnet/minecraft/class_287$class_4574;Ljava/nio/ByteBuffer;)Lcom/mojang/blaze3d/systems/RenderSystem$class_5590;
named uploadIndexBuffer
Lnet/minecraft/client/gl/VertexBuffer;uploadIndexBuffer(Lnet/minecraft/client/render/BufferBuilder$DrawParameters;Ljava/nio/ByteBuffer;)Lcom/mojang/blaze3d/systems/RenderSystem$ShapeIndexBuffer;
-
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 a
Leim;a()V
intermediary method_1353
Lnet/minecraft/class_291;method_1353()V
named bind
Lnet/minecraft/client/gl/VertexBuffer;bind()V
-
unbind
public static void unbind()- Mappings:
Namespace Name Mixin selector official b
Leim;b()V
intermediary method_1354
Lnet/minecraft/class_291;method_1354()V
named unbind
Lnet/minecraft/client/gl/VertexBuffer;unbind()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
draw(Matrix4f, Matrix4f, ShaderProgram)
, the caller of this method must manually bind a shader program before calling this method.- Mappings:
Namespace Name Mixin selector official c
Leim;c()V
intermediary method_35665
Lnet/minecraft/class_291;method_35665()V
named draw
Lnet/minecraft/client/gl/VertexBuffer;draw()V
-
getIndexType
- Mappings:
Namespace Name Mixin selector official f
Leim;f()Leio$a;
intermediary method_43445
Lnet/minecraft/class_291;method_43445()Lnet/minecraft/class_293$class_5595;
named getIndexType
Lnet/minecraft/client/gl/VertexBuffer;getIndexType()Lnet/minecraft/client/render/VertexFormat$IndexType;
-
draw
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 official a
Leim;a(Lorg/joml/Matrix4f;Lorg/joml/Matrix4f;Lfki;)V
intermediary method_34427
Lnet/minecraft/class_291;method_34427(Lorg/joml/Matrix4f;Lorg/joml/Matrix4f;Lnet/minecraft/class_5944;)V
named draw
Lnet/minecraft/client/gl/VertexBuffer;draw(Lorg/joml/Matrix4f;Lorg/joml/Matrix4f;Lnet/minecraft/client/gl/ShaderProgram;)V
-
drawInternal
- Mappings:
Namespace Name Mixin selector official b
Leim;b(Lorg/joml/Matrix4f;Lorg/joml/Matrix4f;Lfki;)V
intermediary method_34431
Lnet/minecraft/class_291;method_34431(Lorg/joml/Matrix4f;Lorg/joml/Matrix4f;Lnet/minecraft/class_5944;)V
named drawInternal
Lnet/minecraft/client/gl/VertexBuffer;drawInternal(Lorg/joml/Matrix4f;Lorg/joml/Matrix4f;Lnet/minecraft/client/gl/ShaderProgram;)V
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-
getVertexFormat
- Mappings:
Namespace Name Mixin selector official d
Leim;d()Leio;
intermediary method_34435
Lnet/minecraft/class_291;method_34435()Lnet/minecraft/class_293;
named getVertexFormat
Lnet/minecraft/client/gl/VertexBuffer;getVertexFormat()Lnet/minecraft/client/render/VertexFormat;
-
isClosed
public boolean isClosed()- Mappings:
Namespace Name Mixin selector official e
Leim;e()Z
intermediary method_43444
Lnet/minecraft/class_291;method_43444()Z
named isClosed
Lnet/minecraft/client/gl/VertexBuffer;isClosed()Z
-