Interface MutableQuadView
- All Superinterfaces:
QuadView
- All Known Subinterfaces:
QuadEmitter
QuadView
instance. The base interface for
QuadEmitter
and for dynamic renders/mesh transforms.
Instances of MutableQuadView
will practically always be
thread local and/or reused - do not retain references.
Unless otherwise stated, assume all properties persist through serialization into Mesh
es and have an
effect in both block and item contexts. If a property is described as transient, then its value will not persist
through serialization into a Mesh
.
Only the renderer should implement or extend this interface.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
When enabled, U texture coordinates for the given sprite are flipped as part of baking.static final int
Same asBAKE_FLIP_U
but for V coordinate.static final int
When enabled, texture coordinates are assigned based on vertex positions and the nominal face.static final int
UV coordinates by default are assumed to be 0-16 scale for consistency with conventional Minecraft model format.static final int
When enabled, causes texture to appear rotated 180 degrees.static final int
When enabled, causes texture to appear rotated 270 degrees clockwise.static final int
When enabled, causes texture to appear rotated 90 degrees clockwise.static final int
When enabled, causes texture to appear with no rotation.Fields inherited from interface net.fabricmc.fabric.api.renderer.v1.mesh.QuadView
VANILLA_QUAD_STRIDE, VANILLA_VERTEX_STRIDE
-
Method Summary
Modifier and TypeMethodDescriptionControls whether vertex colors should be modified for ambient occlusion.color
(int vertexIndex, int color) Sets the color in ARGB format (0xAARRGGBB) for the given vertex.default MutableQuadView
color
(int c0, int c1, int c2, int c3) Sets the color in ARGB format (0xAARRGGBB) for all vertices at once.Copies all quad data and properties from the givenQuadView
to this quad.Sets the cull face.diffuseShade
(boolean shade) Controls whether vertex colors should be modified for diffuse shading.emissive
(boolean emissive) When true, this quad will be rendered at full brightness.fromBakedQuad
(BakedQuad quad) Sets all applicable data and properties of this quad as specified by the givenBakedQuad
.fromVanilla
(int[] vertexData, int startIndex) Sets this quad's vertex data for all vertices using data in given array, starting at the given index.glint
(ItemRenderState.Glint glint) Controls how glint should be applied.lightmap
(int vertexIndex, int lightmap) Sets the minimum lightmap value for the given vertex.default MutableQuadView
lightmap
(int l0, int l1, int l2, int l3) Sets the lightmap value for all vertices at once.nominalFace
(@Nullable Direction face) Sets the nominal face, which provides a hint to the renderer about the facing of this quad.normal
(int vertexIndex, float x, float y, float z) Sets the normal vector for the given vertex.default MutableQuadView
normal
(int vertexIndex, org.joml.Vector3f normal) Sets the normal vector for the given vertex.default MutableQuadView
normal
(int vertexIndex, org.joml.Vector3fc normal) Sets the normal vector for the given vertex.pos
(int vertexIndex, float x, float y, float z) Sets the geometric vertex position for the given vertex, relative to block origin, (0,0,0).default MutableQuadView
pos
(int vertexIndex, org.joml.Vector3f pos) Sets the geometric position for the given vertex.default MutableQuadView
pos
(int vertexIndex, org.joml.Vector3fc pos) Sets the geometric position for the given vertex.renderLayer
(@Nullable BlockRenderLayer renderLayer) Controls how this quad's pixels should be blended with the scene.A hint to the renderer about how this quad is intended to be shaded, for example through ambient occlusion and diffuse shading.default MutableQuadView
spriteBake
(Sprite sprite, int bakeFlags) Sets the texture coordinates for all vertices using the given sprite.tag
(int tag) Sets the tag, which is an arbitrary integer that is meant to be encoded intoMesh
es to later allow performing conditional transformation or filtering on their quads.tintIndex
(int tintIndex) Sets the tint index, which is used to retrieve the tint color.uv
(int vertexIndex, float u, float v) Sets the texture coordinates for the given vertex.default MutableQuadView
uv
(int vertexIndex, org.joml.Vector2f uv) Sets the texture coordinates for the given vertex.default MutableQuadView
uv
(int vertexIndex, org.joml.Vector2fc uv) Sets the texture coordinates for the given vertex.Methods inherited from interface net.fabricmc.fabric.api.renderer.v1.mesh.QuadView
ambientOcclusion, color, copyNormal, copyPos, copyUv, cullFace, diffuseShade, emissive, faceNormal, glint, hasNormal, lightFace, lightmap, nominalFace, normalX, normalY, normalZ, posByIndex, renderLayer, shadeMode, tag, tintIndex, toBakedQuad, toVanilla, u, v, x, y, z
-
Field Details
-
BAKE_ROTATE_NONE
static final int BAKE_ROTATE_NONEWhen enabled, causes texture to appear with no rotation. This is the default and does not have to be specified explicitly. Can be overridden by other rotation flags. Pass in bakeFlags parameter tospriteBake(Sprite, int)
.- See Also:
-
BAKE_ROTATE_90
static final int BAKE_ROTATE_90When enabled, causes texture to appear rotated 90 degrees clockwise. Pass in bakeFlags parameter tospriteBake(Sprite, int)
.- See Also:
-
BAKE_ROTATE_180
static final int BAKE_ROTATE_180When enabled, causes texture to appear rotated 180 degrees. Pass in bakeFlags parameter tospriteBake(Sprite, int)
.- See Also:
-
BAKE_ROTATE_270
static final int BAKE_ROTATE_270When enabled, causes texture to appear rotated 270 degrees clockwise. Pass in bakeFlags parameter tospriteBake(Sprite, int)
.- See Also:
-
BAKE_LOCK_UV
static final int BAKE_LOCK_UVWhen enabled, texture coordinates are assigned based on vertex positions and the nominal face. Any existing UV coordinates will be replaced and theBAKE_NORMALIZED
flag will be ignored. Pass in bakeFlags parameter tospriteBake(Sprite, int)
.UV lock derives texture coordinates based on nominal face by projecting the quad onto it, even when the quad is not co-planar with it. This flag is ignored if the normal face is
null
.- See Also:
-
BAKE_FLIP_U
static final int BAKE_FLIP_UWhen enabled, U texture coordinates for the given sprite are flipped as part of baking. Can be useful for some randomization and texture mapping scenarios. Results are different from what can be obtained via rotation and both can be applied. Any rotation is applied before this flag. Pass in bakeFlags parameter tospriteBake(Sprite, int)
.- See Also:
-
BAKE_FLIP_V
static final int BAKE_FLIP_VSame asBAKE_FLIP_U
but for V coordinate.- See Also:
-
BAKE_NORMALIZED
static final int BAKE_NORMALIZEDUV coordinates by default are assumed to be 0-16 scale for consistency with conventional Minecraft model format. This is scaled to 0-1 during baking before interpolation. Model loaders that already have 0-1 coordinates can avoid wasteful multiplication/division by passing 0-1 coordinates directly. Pass in bakeFlags parameter tospriteBake(Sprite, int)
.- See Also:
-
-
Method Details
-
pos
Sets the geometric vertex position for the given vertex, relative to block origin, (0,0,0). Minecraft rendering is designed for models that fit within a single block space and is recommended that coordinates remain in the 0-1 range, with multi-block meshes split into multiple per-block models.The default value for all vertices is
0.0f
. -
pos
Sets the geometric position for the given vertex. Only use this method if you already have aVector3f
. Otherwise, usepos(int, float, float, float)
. -
pos
Sets the geometric position for the given vertex. Only use this method if you already have aVector3fc
. Otherwise, usepos(int, float, float, float)
. -
color
Sets the color in ARGB format (0xAARRGGBB) for the given vertex.The default value for all vertices is
0xFFFFFFFF
. -
color
Sets the color in ARGB format (0xAARRGGBB) for all vertices at once.- See Also:
-
uv
Sets the texture coordinates for the given vertex.The default value for all vertices is
0.0f
. -
uv
Sets the texture coordinates for the given vertex. Only use this method if you already have aVector2f
. Otherwise, useuv(int, float, float)
. -
uv
Sets the texture coordinates for the given vertex. Only use this method if you already have aVector2fc
. Otherwise, useuv(int, float, float)
. -
spriteBake
Sets the texture coordinates for all vertices using the given sprite. Can handle UV locking, rotation, interpolation, etc. Control this behavior by passing additive combinations of the BAKE_ flags defined in this interface. -
lightmap
Sets the minimum lightmap value for the given vertex. Input values will override lightmap values computed from world state if input values are higher. Exposed for completeness but some rendering implementations with non-standard lighting model may not honor it.For emissive rendering, prefer using
emissive(boolean)
.The default value for all vertices is
0
. -
lightmap
Sets the lightmap value for all vertices at once.For emissive rendering, prefer using
emissive(boolean)
.- See Also:
-
normal
Sets the normal vector for the given vertex. The face normal is used when no vertex normal is provided. Models that have per-vertex normals should include them to get correct lighting when it matters. -
normal
Sets the normal vector for the given vertex. Only use this method if you already have aVector3f
. Otherwise, usenormal(int, float, float, float)
. -
normal
Sets the normal vector for the given vertex. Only use this method if you already have aVector3fc
. Otherwise, usenormal(int, float, float, float)
. -
nominalFace
Sets the nominal face, which provides a hint to the renderer about the facing of this quad. It is not required, but if set, should be the expected value ofQuadView.lightFace()
. It may be used to shortcut geometric analysis, if the provided value was correct; otherwise, it is ignored.The nominal face is also used for
spriteBake(Sprite, int)
withBAKE_LOCK_UV
.When
cullFace(Direction)
is called, it also sets the nominal face.The default value is
null
.This property is transient. It is set to the same value as
QuadView.lightFace()
when a quad is decoded. -
cullFace
Sets the cull face. This quad will not be rendered if its cull face is non-null and the block is occluded by another block in the direction of the cull face.The cull face is different from
BakedQuad.face()
, which is equivalent toQuadView.lightFace()
. The light face is computed based on geometry and must be non-null.When called, sets
nominalFace(Direction)
to the same value.The default value is
null
.This property is respected only in block contexts. It will not have an effect in other contexts.
-
renderLayer
Controls how this quad's pixels should be blended with the scene.If set to
null
,RenderLayers.getBlockLayer(BlockState)
will be used to retrieve the render layer in block contexts and the render layer of the state layer will be used in item contexts. Set to another value to override this behavior.In block contexts, a non-null value will be used directly. In item contexts, a non-null value will be converted to a
RenderLayer
usingRenderLayerHelper.getEntityBlockLayer(BlockRenderLayer)
.The default value is
null
. -
emissive
When true, this quad will be rendered at full brightness. Lightmap values provided viaQuadView.lightmap(int)
will be ignored.This is the preferred method for emissive lighting effects as some renderers with advanced lighting pipelines may not use lightmaps.
Note that vertex colors will still be modified by diffuse shading and ambient occlusion, unless disabled via
diffuseShade(boolean)
andambientOcclusion(TriState)
.The default value is
false
. -
diffuseShade
Controls whether vertex colors should be modified for diffuse shading.The default value is
true
.This property is guaranteed to be respected in block contexts. Some renderers may also respect it in item contexts, but this is not guaranteed.
-
ambientOcclusion
Controls whether vertex colors should be modified for ambient occlusion.If set to
TriState.DEFAULT
, ambient occlusion will be used if the block state has a luminance of 0. Set toTriState.TRUE
orTriState.FALSE
to override this behavior.TriState.TRUE
will not have an effect if ambient occlusion is disabled globally.The default value is
TriState.DEFAULT
.This property is respected only in block contexts. It will not have an effect in other contexts.
-
glint
Controls how glint should be applied.If set to
null
, glint will be applied in item contexts based on the glint type of the layer. Set to another value to override this behavior.The default value is
null
.This property is guaranteed to be respected in item contexts. Some renderers may also respect it in block contexts, but this is not guaranteed.
-
shadeMode
A hint to the renderer about how this quad is intended to be shaded, for example through ambient occlusion and diffuse shading. The renderer is free to ignore this hint.The default value is
ShadeMode.ENHANCED
.This property is respected only in block contexts. It will not have an effect in other contexts.
- See Also:
-
tintIndex
Sets the tint index, which is used to retrieve the tint color.The default value is
-1
. -
tag
Sets the tag, which is an arbitrary integer that is meant to be encoded intoMesh
es to later allow performing conditional transformation or filtering on their quads.The default value is
0
. -
copyFrom
Copies all quad data and properties from the givenQuadView
to this quad.Calling this method does not emit this quad.
-
fromVanilla
Sets this quad's vertex data for all vertices using data in given array, starting at the given index. The array must have at leastQuadView.VANILLA_QUAD_STRIDE
elements starting at the given index. The format of the data must be the same asBakedQuad.vertexData()
. This quad's lightmap values and normals will be set even though vanilla does not decode them from packed vertex data.Prefer using
fromBakedQuad(BakedQuad)
instead if you have aBakedQuad
.Calling this method does not emit this quad.
-
fromBakedQuad
Sets all applicable data and properties of this quad as specified by the givenBakedQuad
. This quad's lightmap values and normals will be set even though vanilla does not decode them from packed vertex data. The baked quad's light emission will be applied to the lightmap values from the vertex data after copying.Calling this method does not emit this quad.
-