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
threadlocal and/or reused - do not retain references.
Only the renderer should implement or extend this interface.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
When set, 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 coordinate are assigned based on vertex position.static final int
UV coordinates by default are assumed to be 0-16 scale for consistency with conventional Minecraft model format.static final int
Causes texture to appear rotated 180 deg.static final int
Causes texture to appear rotated 270 deg.static final int
Causes texture to appear rotated 90 deg.static final int
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 TypeMethodDescriptioncolorIndex
(int colorIndex) Value functions identically toBakedQuad.getColorIndex()
and is used by renderer / model builder in same way.@Nullable MutableQuadView
If non-null, quad is coplanar with a block face which, if known, simplifies or shortcuts geometric analysis that might otherwise be needed.fromVanilla
(int[] quadData, int startIndex, boolean isItem) Deprecated.fromVanilla
(BakedQuad quad, RenderMaterial material, Direction cullFace) Enables bulk vertex data transfer using the standard Minecraft vertex formats.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.material
(RenderMaterial material) Assigns a different material to this quad.@Nullable MutableQuadView
nominalFace
(Direction face) Provides a hint to renderer about the facing of this quad.normal
(int vertexIndex, float x, float y, float z) Adds a vertex normal.default MutableQuadView
normal
(int vertexIndex, org.joml.Vector3f vec) Same asnormal(int, float, float, float)
but accepts vector type.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, org.joml.Vector3f vec) Same aspos(int, float, float, float)
but accepts vector type.sprite
(int vertexIndex, int spriteIndex, float u, float v) Set sprite atlas coordinates.default MutableQuadView
Set sprite atlas coordinates.spriteBake
(int spriteIndex, Sprite sprite, int bakeFlags) Assigns sprite atlas u,v coordinates to this quad for the given sprite.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.tag
(int tag) Encodes an integer tag with this quad that can later be retrieved viaQuadView.tag()
.Methods inherited from interface net.fabricmc.fabric.api.renderer.v1.mesh.QuadView
colorIndex, copyNormal, copyPos, copyTo, cullFace, faceNormal, hasNormal, lightFace, lightmap, material, nominalFace, normalX, normalY, normalZ, posByIndex, spriteColor, spriteU, spriteV, tag, toBakedQuad, toVanilla, x, y, z
-
Field Details
-
BAKE_ROTATE_NONE
static final int BAKE_ROTATE_NONECauses texture to appear with no rotation. Pass in bakeFlags parameter tospriteBake(int, Sprite, int)
.- See Also:
-
BAKE_ROTATE_90
static final int BAKE_ROTATE_90Causes texture to appear rotated 90 deg. clockwise relative to nominal face. Pass in bakeFlags parameter tospriteBake(int, Sprite, int)
.- See Also:
-
BAKE_ROTATE_180
static final int BAKE_ROTATE_180Causes texture to appear rotated 180 deg. relative to nominal face. Pass in bakeFlags parameter tospriteBake(int, Sprite, int)
.- See Also:
-
BAKE_ROTATE_270
static final int BAKE_ROTATE_270Causes texture to appear rotated 270 deg. clockwise relative to nominal face. Pass in bakeFlags parameter tospriteBake(int, Sprite, int)
.- See Also:
-
BAKE_LOCK_UV
static final int BAKE_LOCK_UVWhen enabled, texture coordinate are assigned based on vertex position. Any existing uv coordinates will be replaced. Pass in bakeFlags parameter tospriteBake(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.
- See Also:
-
BAKE_FLIP_U
static final int BAKE_FLIP_UWhen set, 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. Pass in bakeFlags parameter tospriteBake(int, 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(int, Sprite, int)
.- See Also:
-
-
Method Details
-
material
Assigns a different material to this quad. Useful for transformation of existing meshes because lighting and texture blending are controlled by material. -
cullFace
If non-null, quad is coplanar with a block face which, if known, simplifies or 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.Null by default.
When called with a non-null value, also sets
nominalFace(Direction)
to the same value.This is different from 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 byQuadView.lightFace()
. -
nominalFace
Provides a hint to renderer about the facing of this quad. Not required, but if provided can shortcut some geometric analysis if the quad is parallel to a block face. Should be the expected value ofQuadView.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()
. -
colorIndex
Value functions identically toBakedQuad.getColorIndex()
and is used by renderer / model builder in same way. Default value is -1. -
fromVanilla
Deprecated.UsefromVanilla(BakedQuad, RenderMaterial, Direction)
which has better encapsulation and removed outdated item flagEnables bulk vertex data transfer using the standard Minecraft vertex formats. This method should be performant whenever caller's vertex representation makes it feasible.Calling this method does not emit the quad.
-
fromVanilla
Enables bulk vertex data transfer using the standard Minecraft vertex formats. This method should be performant whenever caller's vertex representation makes it feasible.Calling this method does not emit the quad.
-
tag
Encodes an integer tag with this quad that can later be retrieved viaQuadView.tag()
. Useful for models that want to perform conditional transformation or filtering on static meshes. -
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. -
pos
Same aspos(int, float, float, float)
but accepts vector type. -
normal
Adds a vertex normal. Models that have per-vertex normals should include them to get correct lighting when it matters. Computed face normal is used when no vertex normal is provided.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. -
normal
Same asnormal(int, float, float, float)
but accepts vector type. -
lightmap
Accept vanilla lightmap values. 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, it is better to use
MaterialFinder.emissive(int, boolean)
. -
lightmap
Convenience: set lightmap for all vertices at once.For emissive rendering, it is better to use
MaterialFinder.emissive(int, boolean)
. Seelightmap(int, int)
. -
spriteColor
Set sprite color. Behavior forspriteIndex > 0
is currently undefined. -
spriteColor
Convenience: set sprite color for all vertices at once. Behavior forspriteIndex > 0
is currently undefined. -
sprite
Set sprite atlas coordinates. Behavior forspriteIndex > 0
is currently undefined. -
sprite
Set sprite atlas coordinates. Behavior forspriteIndex > 0
is currently undefined.Only use this function if you already have a
Vec2f
. Otherwise, seesprite(int, int, float, float)
. -
spriteBake
Assigns sprite atlas u,v coordinates to this quad for 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. Behavior forspriteIndex > 0
is currently undefined.
-
fromVanilla(BakedQuad, RenderMaterial, Direction)
which has better encapsulation and removed outdated item flag