Class QuadLighter

java.lang.Object
net.minecraftforge.client.model.lighting.QuadLighter
Direct Known Subclasses:
FlatQuadLighter, SmoothQuadLighter

public abstract class QuadLighter extends Object
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 Details

    • WHITE

      private static final float[] WHITE
    • colors

      private final BlockColors colors
    • currentHash

      private int currentHash
    • level

      private BlockAndTintGetter level
    • pos

      private BlockPos pos
    • state

      private BlockState 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

      protected QuadLighter(BlockColors colors)
  • Method Details

    • computeLightingAt

      protected abstract void computeLightingAt(BlockAndTintGetter level, BlockPos pos, BlockState state)
    • calculateBrightness

      protected abstract float calculateBrightness(float[] position)
    • calculateLightmap

      protected abstract int calculateLightmap(float[] position, byte[] normal)
    • setup

      public final void setup(BlockAndTintGetter level, BlockPos pos, BlockState state)
    • 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

      protected static int getLightColor(BlockAndTintGetter level, BlockPos pos, BlockState state)
      Note: This method is subtly different than LevelRenderer.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.