Class QuadLighter
java.lang.Object
net.minecraftforge.client.model.lighting.QuadLighter
- Direct Known Subclasses:
FlatQuadLighter
,SmoothQuadLighter
Base class for all quad lighting providers.
Contains all the shared elements needed for BakedQuad
processing and defers lighting logic to inheritors.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprivate final float[]
private final float[]
private int
private final BlockColors
private int
private BlockAndTintGetter
private final int[]
private final byte[][]
private final int[]
private BlockPos
private final float[][]
private BlockState
private static final float[]
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract float
calculateBrightness
(float[] position) protected abstract int
calculateLightmap
(float[] position, byte[] normal) static float
calculateShade
(float normalX, float normalY, float normalZ, boolean constantAmbientLight) protected abstract void
computeLightingAt
(BlockAndTintGetter level, BlockPos pos, BlockState state) private float[]
getColorFast
(int tintIndex) protected static int
getLightColor
(BlockAndTintGetter level, BlockPos pos, BlockState state) Note: This method is subtly different thanLevelRenderer.getLightColor(BlockAndTintGetter, BlockState, BlockPos)
as it only uses the state for querying if the state has emissive rendering but instead looks up the state at the given position for checking the light emission.final void
process
(VertexConsumer consumer, PoseStack.Pose pose, BakedQuad quad, int overlay) final void
reset()
final void
setup
(BlockAndTintGetter level, BlockPos pos, BlockState state)
-
Field Details
-
WHITE
private static final float[] WHITE -
colors
-
currentHash
private int currentHash -
level
-
pos
-
state
-
cachedTintIndex
private int cachedTintIndex -
cachedTintColor
private final float[] cachedTintColor -
brightness
private final float[] brightness -
lightmap
private final int[] lightmap -
positions
private final float[][] positions -
normals
private final byte[][] normals -
packedLightmaps
private final int[] packedLightmaps
-
-
Constructor Details
-
QuadLighter
-
-
Method Details
-
computeLightingAt
-
calculateBrightness
protected abstract float calculateBrightness(float[] position) -
calculateLightmap
protected abstract int calculateLightmap(float[] position, byte[] normal) -
setup
-
reset
public final void reset() -
process
public final void process(VertexConsumer consumer, PoseStack.Pose pose, BakedQuad quad, int overlay) -
getColorFast
private float[] getColorFast(int tintIndex) -
calculateShade
public static float calculateShade(float normalX, float normalY, float normalZ, boolean constantAmbientLight) -
getLightColor
Note: This method is subtly different thanLevelRenderer.getLightColor(BlockAndTintGetter, BlockState, BlockPos)
as it only uses the state for querying if the state has emissive rendering but instead looks up the state at the given position for checking the light emission.
-