VertexBuffer
final class VertexBuffer
Package: dev.joid.lib.bridge.render.vertex · Module: core · Source: VertexBuffer.java
The vertices of one draw, in the fixed 32-byte layout that every backend reads.
Description
Section titled “Description”The Tessellator fills a VertexBuffer and hands it to draw(...) of the render bridge.
Every vertex takes STRIDE bytes, laid out as VertexAttribute describes: position, texture coordinate, color, normal.
The flags tell which optional attributes the draw wrote: the backend gives the others the texture coordinate (0, 0) and the normal (0, 0, 1), or completes them with VertexFill, and the translated shader takes the current color of the render state for a buffer without colors.
Learn more
Section titled “Learn more”Creation
Section titled “Creation”| Returns | Signature | Summary |
|---|---|---|
VertexBuffer | of(ByteBuffer buffer, int count, boolean texture, boolean color, boolean normal) factory | Wraps count vertices that start at the position of buffer; texture, color and normal tell whether the draw wrote each optional attribute. |
Methods
Section titled “Methods”| Returns | Signature | Summary |
|---|---|---|
ByteBuffer | getBuffer() | Returns the bytes of the vertices, from the current position, in native byte order. |
int | getCount() | Returns the number of vertices; the render bridge skips a buffer without vertices. |
boolean | isTexture() | If true, every vertex carries a texture coordinate. |
boolean | isColor() | If true, every vertex carries its own color; if false, the whole draw takes the current color of the render state. |
boolean | isNormal() | If true, every vertex carries a normal, which the lighting of a 3D model reads. |
Constants and fields
Section titled “Constants and fields”| Type | Name | Value | Summary |
|---|---|---|---|
int | STRIDE | 32 | The size of one vertex, in bytes. |
Creation details
Section titled “Creation details”VertexBuffer of(ByteBuffer buffer, int count, boolean texture, boolean color, boolean normal) factory
Wraps count vertices that start at the position of buffer; texture, color and normal tell whether the draw wrote each optional attribute.
Method details
Section titled “Method details”getBuffer
Section titled “getBuffer”ByteBuffer getBuffer()
Returns the bytes of the vertices, from the current position, in native byte order.
getCount
Section titled “getCount”int getCount()
Returns the number of vertices; the render bridge skips a buffer without vertices.
isTexture
Section titled “isTexture”boolean isTexture()
If true, every vertex carries a texture coordinate.
isColor
Section titled “isColor”boolean isColor()
If true, every vertex carries its own color; if false, the whole draw takes the current color of the render state.
isNormal
Section titled “isNormal”boolean isNormal()
If true, every vertex carries a normal, which the lighting of a 3D model reads.
Constant and field details
Section titled “Constant and field details”STRIDE
Section titled “STRIDE”int STRIDE
The size of one vertex, in bytes.
fluent returns the instance, typed for chaining · factory creates an instance · signal also accepts a value that follows signals, as a signal, an expression or a lambda (When does JOID compute this value again?) · hook called by JOID, override it · abstract you implement it · default interface method with a body · static called on the class · protected visible to subclasses
