Enum Class AoFace

java.lang.Object
java.lang.Enum<AoFace>
net.neoforged.neoforge.client.model.ao.AoFace
All Implemented Interfaces:
Serializable, Comparable<AoFace>, Constable

enum AoFace extends Enum<AoFace>
Establishes the mapping between 3D world coordinates and AO faces.
  • Enum Constant Details

    • DOWN

      public static final AoFace DOWN
    • UP

      public static final AoFace UP
    • NORTH

      public static final AoFace NORTH
    • SOUTH

      public static final AoFace SOUTH
    • WEST

      public static final AoFace WEST
    • EAST

      public static final AoFace EAST
  • Constructor Details

    • AoFace

      private AoFace()
  • Method Details

    • values

      public static AoFace[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static AoFace valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • fromDirection

      public static AoFace fromDirection(net.minecraft.core.Direction direction)
    • computeDepth

      float computeDepth(float x, float y, float z)
      Computes the depth of point x, y, z wrt. this AO face. The point coordinates should be between 0 and 1. Returns 0 if the point is on the face, increasing as the point moves towards the inside of the cube, up to 1 if it's on the opposite face.
    • computeCornerWeights

      void computeCornerWeights(float[] out, float x, float y, float z)
      Computes the contribution of each AO face corner to the AO value of a point, and writes the values to out.

      The weights are computed for bilinear interpolation from the corners of the AO faces. They sum to 1.

      The intent is to match vanilla's interpolation for partial quads, which it performs in ModelBlockRenderer.AmbientOcclusionRenderStorage.calculate(net.minecraft.world.level.BlockAndTintGetter, net.minecraft.world.level.block.state.BlockState, net.minecraft.core.BlockPos, net.minecraft.core.Direction, boolean) using the vert weights in ModelBlockRenderer.AdjacencyInfo, followed by remapping using

      invalid reference
      ModelBlockRenderer.AmbientVertexRemap
      . Using the ambient vertex remap makes the lighting dependent on correct vertex ordering, and we don't want that.