Interface QuadView
- All Known Subinterfaces:
MutableQuadView
,QuadEmitter
public interface QuadView
Interface for reading quad data encoded in
Mesh
es.
Enables models to do analysis, re-texturing or translation without knowing the
renderer's vertex formats and without retaining redundant information.
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
Count of integers in a conventional (un-modded) block or item quad.static final int
Count of integers in a conventional (un-modded) block or item vertex. -
Method Summary
Modifier and TypeMethodDescriptionint
color
(int vertexIndex) Gets the vertex color in ARGB format (0xAARRGGBB) of the given vertex.@Nullable org.joml.Vector3f
copyNormal
(int vertexIndex, @Nullable org.joml.Vector3f target) Copies the normal vector of the given vertex to the given target, if the vertex has a normal.org.joml.Vector3f
copyPos
(int vertexIndex, @Nullable org.joml.Vector3f target) Copies the geometric position of the given vertex to the given target.org.joml.Vector2f
copyUv
(int vertexIndex, @Nullable org.joml.Vector2f target) Copies the texture coordinates of the given vertex to the given target.@Nullable Direction
cullFace()
boolean
This method is equivalent toBakedQuad.shade()
.boolean
emissive()
org.joml.Vector3fc
Gets the normal vector of this quad as implied by its vertex positions.glint()
boolean
hasNormal
(int vertexIndex) Returns whether a normal vector is present for the given vertex.@NotNull Direction
Gets the light face of this quad as implied by its face normal.int
lightmap
(int vertexIndex) Gets the minimum lightmap value of the given vertex.@Nullable Direction
float
normalX
(int vertexIndex) Gets the X coordinate of the normal vector of the given vertex.float
normalY
(int vertexIndex) Gets the Y coordinate of the normal vector of the given vertex.float
normalZ
(int vertexIndex) Gets the Z coordinate of the normal vector of the given vertex.float
posByIndex
(int vertexIndex, int coordinateIndex) Gets the specified coordinate of the geometric position of the given vertex.@Nullable BlockRenderLayer
int
tag()
int
This method is equivalent toBakedQuad.tintIndex()
.default BakedQuad
toBakedQuad
(Sprite sprite) Creates a newBakedQuad
with an appearance as close as possible to this quad, as permitted by vanilla.void
toVanilla
(int[] target, int startIndex) Outputs this quad's vertex data into the given array, starting at the given index.float
u
(int vertexIndex) Gets the horizontal texture coordinates of the given vertex.float
v
(int vertexIndex) Gets the vertical texture coordinates of the given vertex.float
x
(int vertexIndex) Gets the X coordinate of the geometric position of the given vertex.float
y
(int vertexIndex) Gets the Y coordinate of the geometric position of the given vertex.float
z
(int vertexIndex) Gets the Z coordinate of the geometric position of the given vertex.
-
Field Details
-
VANILLA_VERTEX_STRIDE
static final int VANILLA_VERTEX_STRIDECount of integers in a conventional (un-modded) block or item vertex. -
VANILLA_QUAD_STRIDE
static final int VANILLA_QUAD_STRIDECount of integers in a conventional (un-modded) block or item quad.
-
-
Method Details
-
x
float x(int vertexIndex) Gets the X coordinate of the geometric position of the given vertex. -
y
float y(int vertexIndex) Gets the Y coordinate of the geometric position of the given vertex. -
z
float z(int vertexIndex) Gets the Z coordinate of the geometric position of the given vertex. -
posByIndex
float posByIndex(int vertexIndex, int coordinateIndex) Gets the specified coordinate of the geometric position of the given vertex. Index 0 is X, 1 is Y, and 2 is Z. -
copyPos
org.joml.Vector3f copyPos(int vertexIndex, @Nullable @Nullable org.joml.Vector3f target) Copies the geometric position of the given vertex to the given target. If the target isnull
, a newVector3f
will be allocated and returned. -
color
int color(int vertexIndex) Gets the vertex color in ARGB format (0xAARRGGBB) of the given vertex. -
u
float u(int vertexIndex) Gets the horizontal texture coordinates of the given vertex. -
v
float v(int vertexIndex) Gets the vertical texture coordinates of the given vertex. -
copyUv
org.joml.Vector2f copyUv(int vertexIndex, @Nullable @Nullable org.joml.Vector2f target) Copies the texture coordinates of the given vertex to the given target. If the target isnull
, a newVector2f
will be allocated and returned. -
lightmap
int lightmap(int vertexIndex) Gets the minimum lightmap value of the given vertex. -
hasNormal
boolean hasNormal(int vertexIndex) Returns whether a normal vector is present for the given vertex. If not, the vertex implicitly uses the face normal. -
normalX
float normalX(int vertexIndex) Gets the X coordinate of the normal vector of the given vertex. ReturnsFloat.NaN
if the normal is not present. -
normalY
float normalY(int vertexIndex) Gets the Y coordinate of the normal vector of the given vertex. ReturnsFloat.NaN
if the normal is not present. -
normalZ
float normalZ(int vertexIndex) Gets the Z coordinate of the normal vector of the given vertex. ReturnsFloat.NaN
if the normal is not present. -
copyNormal
@Nullable @Nullable org.joml.Vector3f copyNormal(int vertexIndex, @Nullable @Nullable org.joml.Vector3f target) Copies the normal vector of the given vertex to the given target, if the vertex has a normal. Otherwise, returnsnull
. If the target isnull
and a normal exists, a newVector3f
will be allocated and returned. -
faceNormal
org.joml.Vector3fc faceNormal()Gets the normal vector of this quad as implied by its vertex positions. It will be invalid if the vertices are not co-planar. -
lightFace
Gets the light face of this quad as implied by its face normal. It is equal to the axis-aligned direction closest to the face normal, and is nevernull
.This method is equivalent to
BakedQuad.face()
. -
nominalFace
- See Also:
-
cullFace
- See Also:
-
renderLayer
- See Also:
-
emissive
boolean emissive()- See Also:
-
diffuseShade
boolean diffuseShade()This method is equivalent toBakedQuad.shade()
.- See Also:
-
ambientOcclusion
TriState ambientOcclusion()- See Also:
-
glint
- See Also:
-
shadeMode
ShadeMode shadeMode()- See Also:
-
tintIndex
int tintIndex()This method is equivalent toBakedQuad.tintIndex()
.- See Also:
-
tag
int tag()- See Also:
-
toVanilla
void toVanilla(int[] target, int startIndex) Outputs this quad's vertex data into the given array, starting at the given index. The array must have at leastVANILLA_QUAD_STRIDE
elements available starting at the given index. The format of the data is the same asBakedQuad.vertexData()
. Lightmap values and normals will be populated even though vanilla does not use them. -
toBakedQuad
Creates a newBakedQuad
with an appearance as close as possible to this quad, as permitted by vanilla. Vertex lightmap values and vertex normals will be populated even though vanilla does not use them.- Parameters:
sprite
- The sprite is not serialized so it must be provided by the caller. Retrieve it usingSpriteFinder.find(QuadView)
if it is not already known.
-