Interface QuadView

All Known Subinterfaces:
MutableQuadView, QuadEmitter

public interface QuadView
Interface for reading quad data encoded by MeshBuilder. Enables models to do analysis, re-texturing or translation without knowing the renderer's vertex formats and without retaining redundant information.

Only the renderer should implement or extend this interface.

  • Field Summary Link icon

    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 Link icon

    Modifier and Type
    Method
    Description
    int
    color(int vertexIndex)
    Retrieve vertex color in ARGB format (0xAARRGGBB).
    int
    Retrieves the quad color index serialized with the quad.
    @Nullable org.joml.Vector3f
    copyNormal(int vertexIndex, @Nullable org.joml.Vector3f target)
    Pass a non-null target to avoid allocation - will be returned with values.
    org.joml.Vector3f
    copyPos(int vertexIndex, @Nullable org.joml.Vector3f target)
    Pass a non-null target to avoid allocation - will be returned with values.
    default void
    Deprecated.
    org.joml.Vector2f
    copyUv(int vertexIndex, @Nullable org.joml.Vector2f target)
    Pass a non-null target to avoid allocation - will be returned with values.
    @Nullable Direction
    If non-null, quad should not be rendered in-world if the opposite face of a neighbor block occludes it.
    org.joml.Vector3f
    Normal of the quad as implied by geometry.
    boolean
    hasNormal(int vertexIndex)
    If false, no vertex normal was provided.
    @NotNull Direction
    Equivalent to BakedQuad.getFace().
    int
    lightmap(int vertexIndex)
    Minimum block brightness.
    Retrieves the material serialized with the quad.
    @Nullable Direction
    float
    normalX(int vertexIndex)
    Will return Float.NaN if normal not present.
    float
    normalY(int vertexIndex)
    Will return Float.NaN if normal not present.
    float
    normalZ(int vertexIndex)
    Will return Float.NaN if normal not present.
    float
    posByIndex(int vertexIndex, int coordinateIndex)
    Convenience: access x, y, z by index 0-2.
    default int
    spriteColor(int vertexIndex, int spriteIndex)
    Deprecated.
    Use color(int) instead.
    default float
    spriteU(int vertexIndex, int spriteIndex)
    Deprecated.
    Use u(int) instead.
    default float
    spriteV(int vertexIndex, int spriteIndex)
    Deprecated.
    Use v(int) instead.
    int
    tag()
    Retrieves the integer tag encoded with this quad via MutableQuadView.tag(int).
    default BakedQuad
    toBakedQuad(int spriteIndex, Sprite sprite, boolean isItem)
    Deprecated.
    Use toBakedQuad(Sprite) instead.
    default BakedQuad
    Generates a new BakedQuad instance with texture coordinates and colors from the given sprite.
    void
    toVanilla(int[] target, int targetIndex)
    Reads baked vertex data and outputs standard baked quad vertex data in the given array and location.
    default void
    toVanilla(int spriteIndex, int[] target, int targetIndex, boolean isItem)
    Deprecated.
    float
    u(int vertexIndex)
    Retrieve horizontal texture coordinates.
    float
    v(int vertexIndex)
    Retrieve vertical texture coordinates.
    float
    x(int vertexIndex)
    Retrieve geometric position, x coordinate.
    float
    y(int vertexIndex)
    Retrieve geometric position, y coordinate.
    float
    z(int vertexIndex)
    Retrieve geometric position, z coordinate.
  • Field Details Link icon

    • VANILLA_VERTEX_STRIDE Link icon

      static final int VANILLA_VERTEX_STRIDE
      Count of integers in a conventional (un-modded) block or item vertex.
    • VANILLA_QUAD_STRIDE Link icon

      static final int VANILLA_QUAD_STRIDE
      Count of integers in a conventional (un-modded) block or item quad.
  • Method Details Link icon

    • x Link icon

      float x(int vertexIndex)
      Retrieve geometric position, x coordinate.
    • y Link icon

      float y(int vertexIndex)
      Retrieve geometric position, y coordinate.
    • z Link icon

      float z(int vertexIndex)
      Retrieve geometric position, z coordinate.
    • posByIndex Link icon

      float posByIndex(int vertexIndex, int coordinateIndex)
      Convenience: access x, y, z by index 0-2.
    • copyPos Link icon

      org.joml.Vector3f copyPos(int vertexIndex, @Nullable @Nullable org.joml.Vector3f target)
      Pass a non-null target to avoid allocation - will be returned with values. Otherwise returns a new instance.
    • color Link icon

      int color(int vertexIndex)
      Retrieve vertex color in ARGB format (0xAARRGGBB).
    • u Link icon

      float u(int vertexIndex)
      Retrieve horizontal texture coordinates.
    • v Link icon

      float v(int vertexIndex)
      Retrieve vertical texture coordinates.
    • copyUv Link icon

      org.joml.Vector2f copyUv(int vertexIndex, @Nullable @Nullable org.joml.Vector2f target)
      Pass a non-null target to avoid allocation - will be returned with values. Otherwise returns a new instance.
    • lightmap Link icon

      int lightmap(int vertexIndex)
      Minimum block brightness. Zero if not set.
    • hasNormal Link icon

      boolean hasNormal(int vertexIndex)
      If false, no vertex normal was provided. Lighting should use face normal in that case.
    • normalX Link icon

      float normalX(int vertexIndex)
      Will return Float.NaN if normal not present.
    • normalY Link icon

      float normalY(int vertexIndex)
      Will return Float.NaN if normal not present.
    • normalZ Link icon

      float normalZ(int vertexIndex)
      Will return Float.NaN if normal not present.
    • copyNormal Link icon

      @Nullable @Nullable org.joml.Vector3f copyNormal(int vertexIndex, @Nullable @Nullable org.joml.Vector3f target)
      Pass a non-null target to avoid allocation - will be returned with values. Otherwise returns a new instance. Returns null if normal not present.
    • cullFace Link icon

      @Nullable @Nullable Direction cullFace()
      If non-null, quad should not be rendered in-world if the opposite face of a neighbor block occludes it.
      See Also:
    • lightFace Link icon

      @NotNull @NotNull Direction lightFace()
      Equivalent to BakedQuad.getFace(). This is the face used for vanilla lighting calculations and will be the block face to which the quad is most closely aligned. Always the same as cull face for quads that are on a block face, but never null.
    • nominalFace Link icon

      @Nullable @Nullable Direction nominalFace()
    • faceNormal Link icon

      org.joml.Vector3f faceNormal()
      Normal of the quad as implied by geometry. Will be invalid if quad vertices are not co-planar. Typically computed lazily on demand.

      Not typically needed by models. Exposed to enable standard lighting utility functions for use by renderers.

    • material Link icon

      RenderMaterial material()
      Retrieves the material serialized with the quad.
    • colorIndex Link icon

      int colorIndex()
      Retrieves the quad color index serialized with the quad.
    • tag Link icon

      int tag()
      Retrieves the integer tag encoded with this quad via MutableQuadView.tag(int). Will return zero if no tag was set. For use by models.
    • toVanilla Link icon

      void toVanilla(int[] target, int targetIndex)
      Reads baked vertex data and outputs standard baked quad vertex data in the given array and location.
      Parameters:
      target - Target array for the baked quad data.
      targetIndex - Starting position in target array - array must have at least VANILLA_QUAD_STRIDE elements available at this index.
    • toBakedQuad Link icon

      default BakedQuad toBakedQuad(Sprite sprite)
      Generates a new BakedQuad instance with texture coordinates and colors from the given sprite.
      Parameters:
      sprite - MutableQuadView does not serialize sprites so the sprite must be provided by the caller.
      Returns:
      A new baked quad instance with the closest-available appearance supported by vanilla features. Will retain emissive light maps, for example, but the standard Minecraft renderer will not use them.
    • spriteColor Link icon

      @Deprecated default int spriteColor(int vertexIndex, int spriteIndex)
      Deprecated.
      Use color(int) instead.
    • spriteU Link icon

      @Deprecated default float spriteU(int vertexIndex, int spriteIndex)
      Deprecated.
      Use u(int) instead.
    • spriteV Link icon

      @Deprecated default float spriteV(int vertexIndex, int spriteIndex)
      Deprecated.
      Use v(int) instead.
    • copyTo Link icon

      @Deprecated default void copyTo(MutableQuadView target)
      Deprecated.
      Use MutableQuadView.copyFrom(QuadView) instead. Unlike copyFrom, this method will not copy the material.
    • toVanilla Link icon

      @Deprecated default void toVanilla(int spriteIndex, int[] target, int targetIndex, boolean isItem)
      Deprecated.
    • toBakedQuad Link icon

      @Deprecated default BakedQuad toBakedQuad(int spriteIndex, Sprite sprite, boolean isItem)
      Deprecated.
      Use toBakedQuad(Sprite) instead.