Enum Class AoFace
- All Implemented Interfaces:
Serializable
,Comparable<AoFace>
,Constable
Establishes the mapping between 3D world coordinates and AO faces.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum Constants -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) 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 toout
.(package private) float
computeDepth
(float x, float y, float z) Computes the depth of pointx
,y
,z
wrt. this AO face.static AoFace
fromDirection
(net.minecraft.core.Direction direction) static AoFace
Returns the enum constant of this class with the specified name.static AoFace[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
DOWN
-
UP
-
NORTH
-
SOUTH
-
WEST
-
EAST
-
-
Constructor Details
-
AoFace
private AoFace()
-
-
Method Details
-
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
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 nameNullPointerException
- if the argument is null
-
fromDirection
-
computeDepth
float computeDepth(float x, float y, float z) Computes the depth of pointx
,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 toout
.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 inModelBlockRenderer.AdjacencyInfo
, followed by remapping usinginvalid reference
ModelBlockRenderer.AmbientVertexRemap
-