QuadEmitter

public interface QuadEmitter implements MutableQuadView

Specialized MutableQuadView obtained via getEmitter to append quads during mesh building.

Also obtained from getEmitter to submit dynamic quads one-by-one at render time.

Instances of QuadEmitter will practically always be threadlocal and/or reused - do not retain references.

Only the renderer should implement or extend this interface.

Functions

colorIndex
Link copied to clipboard
abstract int colorIndex()
Retrieves the quad color index serialized with the quad.
abstract QuadEmitter colorIndex(int colorIndex)
abstract MutableQuadView colorIndex(int colorIndex)
Value functions identically to getColorIndex and isused by renderer / model builder in same way.
copyNormal
Link copied to clipboard
@Nullable()
abstract Vec3f copyNormal(int vertexIndex, @Nullable() Vec3f target)
Pass a non-null target to avoid allocation - will be returned with values.Otherwise returns a new instance.
copyPos
Link copied to clipboard
abstract Vec3f copyPos(int vertexIndex, @Nullable() Vec3f target)
Pass a non-null target to avoid allocation - will be returned with values.Otherwise returns a new instance.
copyTo
Link copied to clipboard
abstract void copyTo(MutableQuadView target)
Extracts all quad properties except material to the given MutableQuadView instance.Must be used before calling {link QuadEmitter#emit()} on the target instance.Meant for re-texturing, analysis and static transformation use cases.
cullFace
Link copied to clipboard
@Nullable()
abstract Direction cullFace()
If non-null, quad should not be rendered in-world if theopposite face of a neighbor block occludes it.
abstract QuadEmitter cullFace(Direction face)
@Nullable()
abstract MutableQuadView cullFace(@Nullable() Direction face)
If non-null, quad is coplanar with a block face which, if known, simplifiesor shortcuts geometric analysis that might otherwise be needed.Set to null if quad is not coplanar or if this is not known.Also controls face culling during block rendering.
emit
Link copied to clipboard
abstract QuadEmitter emit()
In static mesh building, causes quad to be appended to the mesh being built.In a dynamic render context, create a new quad to be output to rendering.In both cases, current instance is reset to default values.
faceNormal
Link copied to clipboard
abstract Vec3f faceNormal()
Normal of the quad as implied by geometry.
fromVanilla
Link copied to clipboard
abstract QuadEmitter fromVanilla(Array<int> quadData, int startIndex, boolean isItem)
abstract MutableQuadView fromVanilla(Array<int> quadData, int startIndex, boolean isItem)
Enables bulk vertex data transfer using the standard Minecraft vertex formats.This method should be performant whenever caller's vertex representation makes it feasible.
abstract MutableQuadView fromVanilla(BakedQuad quad, RenderMaterial material, Direction cullFace)
Enables bulk vertex data transfer using the standard Minecraft vertex formats.This method should be performant whenever caller's vertex representation makes it feasible.
hasNormal
Link copied to clipboard
abstract boolean hasNormal(int vertexIndex)
If false, no vertex normal was provided.Lighting should use face normal in that case.
lightFace
Link copied to clipboard
@NotNull()
abstract Direction lightFace()
Equivalent to getFace.
lightmap
Link copied to clipboard
abstract int lightmap(int vertexIndex)
Minimum block brightness.
abstract QuadEmitter lightmap(int vertexIndex, int lightmap)
abstract MutableQuadView lightmap(int vertexIndex, int lightmap)
Accept vanilla lightmap values.
QuadEmitter lightmap(int b0, int b1, int b2, int b3)
MutableQuadView lightmap(int b0, int b1, int b2, int b3)
Convenience: set lightmap for all vertices at once.
material
Link copied to clipboard
abstract RenderMaterial material()
Retrieves the material serialized with the quad.
abstract QuadEmitter material(RenderMaterial material)
abstract MutableQuadView material(RenderMaterial material)
Assigns a different material to this quad.
nominalFace
Link copied to clipboard
abstract Direction nominalFace()
abstract QuadEmitter nominalFace(Direction face)
@Nullable()
abstract MutableQuadView nominalFace(Direction face)
Provides a hint to renderer about the facing of this quad.
normal
Link copied to clipboard
QuadEmitter normal(int vertexIndex, Vec3f vec)
MutableQuadView normal(int vertexIndex, Vec3f vec)
Same as normal but accepts vector type.
abstract MutableQuadView normal(int vertexIndex, float x, float y, float z)
Adds a vertex normal.
normalX
Link copied to clipboard
abstract float normalX(int vertexIndex)
Will return NaN if normal not present.
normalY
Link copied to clipboard
abstract float normalY(int vertexIndex)
Will return NaN if normal not present.
normalZ
Link copied to clipboard
abstract float normalZ(int vertexIndex)
Will return NaN if normal not present.
pos
Link copied to clipboard
QuadEmitter pos(int vertexIndex, Vec3f vec)
MutableQuadView pos(int vertexIndex, Vec3f vec)
Same as pos but accepts vector type.
abstract QuadEmitter pos(int vertexIndex, float x, float y, float z)
abstract MutableQuadView pos(int vertexIndex, float x, float y, float z)
Sets the geometric vertex position for the given vertex,relative to block origin.
posByIndex
Link copied to clipboard
abstract float posByIndex(int vertexIndex, int coordinateIndex)
Convenience: access x, y, z by index 0-2.
sprite
Link copied to clipboard
QuadEmitter sprite(int vertexIndex, int spriteIndex, Vec2f uv)
MutableQuadView sprite(int vertexIndex, int spriteIndex, Vec2f uv)
Set sprite atlas coordinates.
abstract QuadEmitter sprite(int vertexIndex, int spriteIndex, float u, float v)
abstract MutableQuadView sprite(int vertexIndex, int spriteIndex, float u, float v)
Set sprite atlas coordinates.
spriteBake
Link copied to clipboard
abstract QuadEmitter spriteBake(int spriteIndex, Sprite sprite, int bakeFlags)
abstract MutableQuadView spriteBake(int spriteIndex, Sprite sprite, int bakeFlags)
Assigns sprite atlas u,v coordinates to this quad for the given sprite.Can handle UV locking, rotation, interpolation, etc.
spriteColor
Link copied to clipboard
abstract int spriteColor(int vertexIndex, int spriteIndex)
Retrieve vertex color.
abstract QuadEmitter spriteColor(int vertexIndex, int spriteIndex, int color)
abstract MutableQuadView spriteColor(int vertexIndex, int spriteIndex, int color)
Set sprite color.
QuadEmitter spriteColor(int spriteIndex, int c0, int c1, int c2, int c3)
MutableQuadView spriteColor(int spriteIndex, int c0, int c1, int c2, int c3)
Convenience: set sprite color for all vertices at once.
spriteU
Link copied to clipboard
abstract float spriteU(int vertexIndex, int spriteIndex)
Retrieve horizontal sprite atlas coordinates.
spriteUnitSquare
Link copied to clipboard
QuadEmitter spriteUnitSquare(int spriteIndex)
spriteV
Link copied to clipboard
abstract float spriteV(int vertexIndex, int spriteIndex)
Retrieve vertical sprite atlas coordinates.
square
Link copied to clipboard
QuadEmitter square(Direction nominalFace, float left, float bottom, float right, float top, float depth)
Helper method to assign vertex coordinates for a square aligned with the given face.Ensures that vertex order is consistent with vanilla convention.
tag
Link copied to clipboard
abstract int tag()
Retrieves the integer tag encoded with this quad via tag.Will return zero if no tag was set.
abstract QuadEmitter tag(int tag)
abstract MutableQuadView tag(int tag)
Encodes an integer tag with this quad that can later be retrieved via tag.
toBakedQuad
Link copied to clipboard
BakedQuad toBakedQuad(int spriteIndex, Sprite sprite, boolean isItem)
Generates a new BakedQuad instance with texturecoordinates and colors from the given sprite.
toVanilla
Link copied to clipboard
abstract void toVanilla(int spriteIndex, Array<int> target, int targetIndex, boolean isItem)
Reads baked vertex data and outputs standard baked quadvertex data in the given array and location.
x
Link copied to clipboard
abstract float x(int vertexIndex)
Geometric position, x coordinate.
y
Link copied to clipboard
abstract float y(int vertexIndex)
Geometric position, y coordinate.
z
Link copied to clipboard
abstract float z(int vertexIndex)
Geometric position, z coordinate.

Sources

jvm source
Link copied to clipboard