Interface QuadView

All Known Subinterfaces:
MutableQuadView, QuadEmitter

public interface QuadView
Interface for reading quad data encoded in Meshes. 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 Meshes 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

    Fields
    Modifier and Type
    Field
    Description
    static 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 Type
    Method
    Description
     
    int
    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
     
    boolean
    This method is equivalent to BakedQuad.shade().
    boolean
     
    org.joml.Vector3fc
    Gets the normal vector of this quad as implied by its vertex positions.
     
    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.
     
     
    int
    tag()
     
    int
    This method is equivalent to BakedQuad.tintIndex().
    default BakedQuad
    Creates a new BakedQuad 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_STRIDE
      Count of integers in a conventional (un-modded) block or item vertex.
    • VANILLA_QUAD_STRIDE

      static final int VANILLA_QUAD_STRIDE
      Count 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 is null, a new Vector3f 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 is null, a new Vector2f 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. Returns Float.NaN if the normal is not present.
    • normalY

      float normalY(int vertexIndex)
      Gets the Y coordinate of the normal vector of the given vertex. Returns Float.NaN if the normal is not present.
    • normalZ

      float normalZ(int vertexIndex)
      Gets the Z coordinate of the normal vector of the given vertex. Returns Float.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, returns null. If the target is null and a normal exists, a new Vector3f 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

      @NotNull @NotNull Direction 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 never null.

      This method is equivalent to BakedQuad.face().

    • nominalFace

      @Nullable @Nullable Direction nominalFace()
      See Also:
    • cullFace

      @Nullable @Nullable Direction cullFace()
      See Also:
    • renderLayer

      @Nullable @Nullable BlockRenderLayer renderLayer()
      See Also:
    • emissive

      boolean emissive()
      See Also:
    • diffuseShade

      boolean diffuseShade()
      This method is equivalent to BakedQuad.shade().
      See Also:
    • ambientOcclusion

      TriState ambientOcclusion()
      See Also:
    • glint

      @Nullable ItemRenderState.Glint glint()
      See Also:
    • shadeMode

      ShadeMode shadeMode()
      See Also:
    • tintIndex

      int tintIndex()
      This method is equivalent to BakedQuad.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 least VANILLA_QUAD_STRIDE elements available starting at the given index. The format of the data is the same as BakedQuad.vertexData(). Lightmap values and normals will be populated even though vanilla does not use them.
    • toBakedQuad

      default BakedQuad toBakedQuad(Sprite sprite)
      Creates a new BakedQuad 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 using SpriteFinder.find(QuadView) if it is not already known.