Skip to content

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.

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.

ReturnsSignatureSummary
VertexBufferof(ByteBuffer buffer, int count, boolean texture, boolean color, boolean normal) factoryWraps count vertices that start at the position of buffer; texture, color and normal tell whether the draw wrote each optional attribute.

ReturnsSignatureSummary
ByteBuffergetBuffer()Returns the bytes of the vertices, from the current position, in native byte order.
intgetCount()Returns the number of vertices; the render bridge skips a buffer without vertices.
booleanisTexture()If true, every vertex carries a texture coordinate.
booleanisColor()If true, every vertex carries its own color; if false, the whole draw takes the current color of the render state.
booleanisNormal()If true, every vertex carries a normal, which the lighting of a 3D model reads.
TypeNameValueSummary
intSTRIDE32The size of one vertex, in bytes.

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.

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.

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

Report a problem with this page