public interface QuadView
MeshBuilder
.
Enables models to do analysis, re-texturing or translation without knowing the
renderer's vertex formats and without retaining redundant information.
Only the renderer should implement or extend this interface.
Modifier and Type | Field and Description |
---|---|
static int |
VANILLA_QUAD_STRIDE
Count of integers in a conventional (un-modded) block or item quad.
|
static int |
VANILLA_VERTEX_STRIDE
Count of integers in a conventional (un-modded) block or item vertex.
|
Modifier and Type | Method and Description |
---|---|
int |
colorIndex()
Retrieves the quad color index serialized with the quad.
|
@Nullable net.minecraft.client.util.math.Vector3f |
copyNormal(int vertexIndex,
@Nullable net.minecraft.client.util.math.Vector3f target)
Pass a non-null target to avoid allocation - will be returned with values.
|
net.minecraft.client.util.math.Vector3f |
copyPos(int vertexIndex,
@Nullable net.minecraft.client.util.math.Vector3f target)
Pass a non-null target to avoid allocation - will be returned with values.
|
void |
copyTo(MutableQuadView target)
Extracts all quad properties except material to the given
MutableQuadView instance. |
@Nullable net.minecraft.util.math.Direction |
cullFace()
If non-null, quad should not be rendered in-world if the
opposite face of a neighbor block occludes it.
|
net.minecraft.client.util.math.Vector3f |
faceNormal()
Normal of the quad as implied by geometry.
|
boolean |
hasNormal(int vertexIndex)
If false, no vertex normal was provided.
|
@NotNull net.minecraft.util.math.Direction |
lightFace()
Equivalent to
BakedQuad.getFace() . |
int |
lightmap(int vertexIndex)
Minimum block brightness.
|
RenderMaterial |
material()
Retrieves the material serialized with the quad.
|
net.minecraft.util.math.Direction |
nominalFace()
|
float |
normalX(int vertexIndex)
Will return
Float.NaN if normal not present. |
float |
normalY(int vertexIndex)
Will return
Float.NaN if normal not present. |
float |
normalZ(int vertexIndex)
Will return
Float.NaN if normal not present. |
float |
posByIndex(int vertexIndex,
int coordinateIndex)
Convenience: access x, y, z by index 0-2.
|
int |
spriteColor(int vertexIndex,
int spriteIndex)
Retrieve vertex color.
|
float |
spriteU(int vertexIndex,
int spriteIndex)
Retrieve horizontal sprite atlas coordinates.
|
float |
spriteV(int vertexIndex,
int spriteIndex)
Retrieve vertical sprite atlas coordinates.
|
int |
tag()
Retrieves the integer tag encoded with this quad via
MutableQuadView.tag(int) . |
default net.minecraft.client.render.model.BakedQuad |
toBakedQuad(int spriteIndex,
net.minecraft.client.texture.Sprite sprite,
boolean isItem)
Generates a new BakedQuad instance with texture
coordinates and colors from the given sprite.
|
void |
toVanilla(int spriteIndex,
int[] target,
int targetIndex,
boolean isItem)
Reads baked vertex data and outputs standard baked quad
vertex data in the given array and location.
|
float |
x(int vertexIndex)
Geometric position, x coordinate.
|
float |
y(int vertexIndex)
Geometric position, y coordinate.
|
float |
z(int vertexIndex)
Geometric position, z coordinate.
|
static final int VANILLA_VERTEX_STRIDE
static final int VANILLA_QUAD_STRIDE
void toVanilla(int spriteIndex, int[] target, int targetIndex, boolean isItem)
spriteIndex
- The sprite to be used for the quad.
Behavior for values > 0 is currently undefined.target
- Target array for the baked quad data.targetIndex
- Starting position in target array - array must have
at least 28 elements available at this index.isItem
- If true, will output vertex normals. Otherwise will output
lightmaps, per Minecraft vertex formats for baked models.void copyTo(MutableQuadView target)
MutableQuadView
instance.
Must be used before calling {link QuadEmitter#emit()} on the target instance.
Meant for re-texturing, analysis and static transformation use cases.RenderMaterial material()
int colorIndex()
@NotNull @NotNull net.minecraft.util.math.Direction lightFace()
BakedQuad.getFace()
. This is the face used for vanilla lighting
calculations and will be the block face to which the quad is most closely aligned. Always
the same as cull face for quads that are on a block face, but never null.@Nullable @Nullable net.minecraft.util.math.Direction cullFace()
MutableQuadView.cullFace(Direction)
net.minecraft.util.math.Direction nominalFace()
net.minecraft.client.util.math.Vector3f faceNormal()
Not typically needed by models. Exposed to enable standard lighting utility functions for use by renderers.
default net.minecraft.client.render.model.BakedQuad toBakedQuad(int spriteIndex, net.minecraft.client.texture.Sprite sprite, boolean isItem)
spriteIndex
- The sprite to be used for the quad.
Behavior for spriteIndex > 0
is currently undefined.sprite
- MutableQuadView
does not serialize sprites
so the sprite must be provided by the caller.isItem
- If true, will output vertex normals. Otherwise will output
lightmaps, per Minecraft vertex formats for baked models.int tag()
MutableQuadView.tag(int)
.
Will return zero if no tag was set. For use by models.net.minecraft.client.util.math.Vector3f copyPos(int vertexIndex, @Nullable @Nullable net.minecraft.client.util.math.Vector3f target)
float posByIndex(int vertexIndex, int coordinateIndex)
float x(int vertexIndex)
float y(int vertexIndex)
float z(int vertexIndex)
boolean hasNormal(int vertexIndex)
@Nullable @Nullable net.minecraft.client.util.math.Vector3f copyNormal(int vertexIndex, @Nullable @Nullable net.minecraft.client.util.math.Vector3f target)
float normalX(int vertexIndex)
Float.NaN
if normal not present.float normalY(int vertexIndex)
Float.NaN
if normal not present.float normalZ(int vertexIndex)
Float.NaN
if normal not present.int lightmap(int vertexIndex)
int spriteColor(int vertexIndex, int spriteIndex)
float spriteU(int vertexIndex, int spriteIndex)
float spriteV(int vertexIndex, int spriteIndex)