public interface QuadEmitter extends MutableQuadView
MutableQuadView obtained via MeshBuilder.getEmitter()
to append quads during mesh building.
Also obtained from RenderContext.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.
| Modifier and Type | Field and Description |
|---|---|
static float |
CULL_FACE_EPSILON
Tolerance for determining if the depth parameter to
square(Direction, float, float, float, float, float)
is effectively zero - meaning the face is a cull face. |
BAKE_FLIP_U, BAKE_FLIP_V, BAKE_LOCK_UV, BAKE_NORMALIZED, BAKE_ROTATE_180, BAKE_ROTATE_270, BAKE_ROTATE_90, BAKE_ROTATE_NONEVANILLA_QUAD_STRIDE, VANILLA_VERTEX_STRIDE| Modifier and Type | Method and Description |
|---|---|
QuadEmitter |
colorIndex(int colorIndex)
Value functions identically to
BakedQuad.getColorIndex() and is
used by renderer / model builder in same way. |
QuadEmitter |
cullFace(net.minecraft.util.math.Direction face)
If non-null, quad is coplanar with a block face which, if known, simplifies
or shortcuts geometric analysis that might otherwise be needed.
|
QuadEmitter |
emit()
In static mesh building, causes quad to be appended to the mesh being built.
|
QuadEmitter |
fromVanilla(int[] quadData,
int startIndex,
boolean isItem)
Enables bulk vertex data transfer using the standard Minecraft vertex formats.
|
QuadEmitter |
lightmap(int vertexIndex,
int lightmap)
Accept vanilla lightmap values.
|
default QuadEmitter |
lightmap(int b0,
int b1,
int b2,
int b3)
Convenience: set lightmap for all vertices at once.
|
QuadEmitter |
material(RenderMaterial material)
Assigns a different material to this quad.
|
QuadEmitter |
nominalFace(net.minecraft.util.math.Direction face)
Provides a hint to renderer about the facing of this quad.
|
default QuadEmitter |
normal(int vertexIndex,
net.minecraft.client.util.math.Vector3f vec)
Same as
MutableQuadView.normal(int, float, float, float) but accepts vector type. |
QuadEmitter |
pos(int vertexIndex,
float x,
float y,
float z)
Sets the geometric vertex position for the given vertex,
relative to block origin.
|
default QuadEmitter |
pos(int vertexIndex,
net.minecraft.client.util.math.Vector3f vec)
Same as
MutableQuadView.pos(int, float, float, float) but accepts vector type. |
QuadEmitter |
sprite(int vertexIndex,
int spriteIndex,
float u,
float v)
Set sprite atlas coordinates.
|
QuadEmitter |
spriteBake(int spriteIndex,
net.minecraft.client.texture.Sprite sprite,
int bakeFlags)
Assigns sprite atlas u,v coordinates to this quad for the given sprite.
|
QuadEmitter |
spriteColor(int vertexIndex,
int spriteIndex,
int color)
Set sprite color.
|
default QuadEmitter |
spriteColor(int spriteIndex,
int c0,
int c1,
int c2,
int c3)
Convenience: set sprite color for all vertices at once.
|
default QuadEmitter |
spriteUnitSquare(int spriteIndex) |
default QuadEmitter |
square(net.minecraft.util.math.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.
|
QuadEmitter |
tag(int tag)
Encodes an integer tag with this quad that can later be retrieved via
QuadView.tag(). |
fromVanilla, normalcolorIndex, copyNormal, copyPos, copyTo, cullFace, faceNormal, hasNormal, lightFace, lightmap, material, nominalFace, normalX, normalY, normalZ, posByIndex, spriteColor, spriteU, spriteV, tag, toBakedQuad, toVanilla, x, y, zstatic final float CULL_FACE_EPSILON
square(Direction, float, float, float, float, float)
is effectively zero - meaning the face is a cull face.QuadEmitter material(RenderMaterial material)
MutableQuadViewmaterial in interface MutableQuadViewQuadEmitter cullFace(net.minecraft.util.math.Direction face)
MutableQuadViewNull by default.
When called with a non-null value, also sets MutableQuadView.nominalFace(Direction)
to the same value.
This is different than the value reported by BakedQuad.getFace(). That value
is computed based on face geometry and must be non-null in vanilla quads.
That computed value is returned by QuadView.lightFace().
cullFace in interface MutableQuadViewQuadEmitter nominalFace(net.minecraft.util.math.Direction face)
MutableQuadViewQuadView.lightFace(). Value will be confirmed
and if invalid the correct light face will be calculated.
Null by default, and set automatically by QuadView.cullFace().
Models may also find this useful as the face for texture UV locking and rotation semantics.
Note: This value is not persisted independently when the quad is encoded.
When reading encoded quads, this value will always be the same as QuadView.lightFace().
nominalFace in interface MutableQuadViewQuadEmitter colorIndex(int colorIndex)
MutableQuadViewBakedQuad.getColorIndex() and is
used by renderer / model builder in same way. Default value is -1.colorIndex in interface MutableQuadViewQuadEmitter fromVanilla(int[] quadData, int startIndex, boolean isItem)
MutableQuadViewCalling this method does not emit the quad.
fromVanilla in interface MutableQuadViewQuadEmitter tag(int tag)
MutableQuadViewQuadView.tag(). Useful for models that want to perform conditional
transformation or filtering on static meshes.tag in interface MutableQuadViewQuadEmitter pos(int vertexIndex, float x, float y, float z)
MutableQuadViewpos in interface MutableQuadViewdefault QuadEmitter pos(int vertexIndex, net.minecraft.client.util.math.Vector3f vec)
MutableQuadViewMutableQuadView.pos(int, float, float, float) but accepts vector type.pos in interface MutableQuadViewdefault QuadEmitter normal(int vertexIndex, net.minecraft.client.util.math.Vector3f vec)
MutableQuadViewMutableQuadView.normal(int, float, float, float) but accepts vector type.normal in interface MutableQuadViewQuadEmitter lightmap(int vertexIndex, int lightmap)
MutableQuadViewFor emissive rendering, it is better to use MaterialFinder.emissive(int, boolean).
lightmap in interface MutableQuadViewdefault QuadEmitter lightmap(int b0, int b1, int b2, int b3)
MutableQuadViewFor emissive rendering, it is better to use MaterialFinder.emissive(int, boolean).
See MutableQuadView.lightmap(int, int).
lightmap in interface MutableQuadViewQuadEmitter spriteColor(int vertexIndex, int spriteIndex, int color)
MutableQuadViewspriteIndex > 0 is currently undefined.spriteColor in interface MutableQuadViewdefault QuadEmitter spriteColor(int spriteIndex, int c0, int c1, int c2, int c3)
MutableQuadViewspriteIndex > 0 is currently undefined.spriteColor in interface MutableQuadViewQuadEmitter sprite(int vertexIndex, int spriteIndex, float u, float v)
MutableQuadViewspriteIndex > 0 is currently undefined.sprite in interface MutableQuadViewdefault QuadEmitter spriteUnitSquare(int spriteIndex)
QuadEmitter spriteBake(int spriteIndex, net.minecraft.client.texture.Sprite sprite, int bakeFlags)
MutableQuadViewspriteIndex > 0 is currently undefined.spriteBake in interface MutableQuadViewdefault QuadEmitter square(net.minecraft.util.math.Direction nominalFace, float left, float bottom, float right, float top, float depth)
Square will be parallel to the given face and coplanar with the face (and culled if the
face is occluded) if the depth parameter is approximately zero. See CULL_FACE_EPSILON.
All coordinates should be normalized (0-1).
QuadEmitter emit()