public interface MutableQuadView extends QuadView
QuadView
instance. The base interface for
QuadEmitter
and for dynamic renders/mesh transforms.
Instances of MutableQuadView
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 int |
BAKE_FLIP_U
When set, U texture coordinates for the given sprite are
flipped as part of baking.
|
static int |
BAKE_FLIP_V
Same as
BAKE_FLIP_U but for V coordinate. |
static int |
BAKE_LOCK_UV
When enabled, texture coordinate are assigned based on vertex position.
|
static int |
BAKE_NORMALIZED
UV coordinates by default are assumed to be 0-16 scale for consistency
with conventional Minecraft model format.
|
static int |
BAKE_ROTATE_180
Causes texture to appear rotated 180 deg.
|
static int |
BAKE_ROTATE_270
Causes texture to appear rotated 270 deg.
|
static int |
BAKE_ROTATE_90
Causes texture to appear rotated 90 deg.
|
static int |
BAKE_ROTATE_NONE
Causes texture to appear with no rotation.
|
VANILLA_QUAD_STRIDE, VANILLA_VERTEX_STRIDE
Modifier and Type | Method and Description |
---|---|
MutableQuadView |
colorIndex(int colorIndex)
Value functions identically to
BakedQuad.getColorIndex() and is
used by renderer / model builder in same way. |
MutableQuadView |
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.
|
MutableQuadView |
fromVanilla(int[] quadData,
int startIndex,
boolean isItem)
Enables bulk vertex data transfer using the standard Minecraft vertex formats.
|
MutableQuadView |
lightmap(int vertexIndex,
int lightmap)
Accept vanilla lightmap values.
|
default MutableQuadView |
lightmap(int b0,
int b1,
int b2,
int b3)
Convenience: set lightmap for all vertices at once.
|
MutableQuadView |
material(RenderMaterial material)
Assigns a different material to this quad.
|
MutableQuadView |
nominalFace(net.minecraft.util.math.Direction face)
Provides a hint to renderer about the facing of this quad.
|
MutableQuadView |
normal(int vertexIndex,
float x,
float y,
float z)
Adds a vertex normal.
|
default MutableQuadView |
normal(int vertexIndex,
net.minecraft.client.util.math.Vector3f vec)
Same as
normal(int, float, float, float) but accepts vector type. |
MutableQuadView |
pos(int vertexIndex,
float x,
float y,
float z)
Sets the geometric vertex position for the given vertex,
relative to block origin.
|
default MutableQuadView |
pos(int vertexIndex,
net.minecraft.client.util.math.Vector3f vec)
Same as
pos(int, float, float, float) but accepts vector type. |
MutableQuadView |
sprite(int vertexIndex,
int spriteIndex,
float u,
float v)
Set sprite atlas coordinates.
|
MutableQuadView |
spriteBake(int spriteIndex,
net.minecraft.client.texture.Sprite sprite,
int bakeFlags)
Assigns sprite atlas u,v coordinates to this quad for the given sprite.
|
MutableQuadView |
spriteColor(int vertexIndex,
int spriteIndex,
int color)
Set sprite color.
|
default MutableQuadView |
spriteColor(int spriteIndex,
int c0,
int c1,
int c2,
int c3)
Convenience: set sprite color for all vertices at once.
|
MutableQuadView |
tag(int tag)
Encodes an integer tag with this quad that can later be retrieved via
QuadView.tag() . |
colorIndex, copyNormal, copyPos, copyTo, cullFace, faceNormal, hasNormal, lightFace, lightmap, material, nominalFace, normalX, normalY, normalZ, posByIndex, spriteColor, spriteU, spriteV, tag, toBakedQuad, toVanilla, x, y, z
static final int BAKE_ROTATE_NONE
spriteBake(int, Sprite, int)
.static final int BAKE_ROTATE_90
spriteBake(int, Sprite, int)
.static final int BAKE_ROTATE_180
spriteBake(int, Sprite, int)
.static final int BAKE_ROTATE_270
spriteBake(int, Sprite, int)
.static final int BAKE_LOCK_UV
spriteBake(int, Sprite, int)
.
UV lock always derives texture coordinates based on nominal face, even when the quad is not co-planar with that face, and the result is the same as if the quad were projected onto the nominal face, which is usually the desired result.
static final int BAKE_FLIP_U
spriteBake(int, Sprite, int)
.static final int BAKE_FLIP_V
BAKE_FLIP_U
but for V coordinate.static final int BAKE_NORMALIZED
spriteBake(int, Sprite, int)
.MutableQuadView material(RenderMaterial material)
MutableQuadView cullFace(net.minecraft.util.math.Direction face)
Null by default.
When called with a non-null value, also sets 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()
.
MutableQuadView nominalFace(net.minecraft.util.math.Direction face)
QuadView.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()
.
MutableQuadView colorIndex(int colorIndex)
BakedQuad.getColorIndex()
and is
used by renderer / model builder in same way. Default value is -1.MutableQuadView fromVanilla(int[] quadData, int startIndex, boolean isItem)
Calling this method does not emit the quad.
MutableQuadView tag(int tag)
QuadView.tag()
. Useful for models that want to perform conditional
transformation or filtering on static meshes.MutableQuadView pos(int vertexIndex, float x, float y, float z)
default MutableQuadView pos(int vertexIndex, net.minecraft.client.util.math.Vector3f vec)
pos(int, float, float, float)
but accepts vector type.MutableQuadView normal(int vertexIndex, float x, float y, float z)
Renderer
implementations should honor vertex normals for
diffuse lighting - modifying vertex color(s) or packing normals in the vertex
buffer as appropriate for the rendering method/vertex format in effect.
default MutableQuadView normal(int vertexIndex, net.minecraft.client.util.math.Vector3f vec)
normal(int, float, float, float)
but accepts vector type.MutableQuadView lightmap(int vertexIndex, int lightmap)
For emissive rendering, it is better to use MaterialFinder.emissive(int, boolean)
.
default MutableQuadView lightmap(int b0, int b1, int b2, int b3)
For emissive rendering, it is better to use MaterialFinder.emissive(int, boolean)
.
See lightmap(int, int)
.
MutableQuadView spriteColor(int vertexIndex, int spriteIndex, int color)
spriteIndex > 0
is currently undefined.default MutableQuadView spriteColor(int spriteIndex, int c0, int c1, int c2, int c3)
spriteIndex > 0
is currently undefined.MutableQuadView sprite(int vertexIndex, int spriteIndex, float u, float v)
spriteIndex > 0
is currently undefined.MutableQuadView spriteBake(int spriteIndex, net.minecraft.client.texture.Sprite sprite, int bakeFlags)
spriteIndex > 0
is currently undefined.