mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-12 16:27:47 +00:00
Fix improper handling of baked lighting in forge light pipeline
Closes #6803
This commit is contained in:
1 parent
7288c2106d
commit
f321e58a41
2 files changed
+13
-7
No files matched your search
@@ -19,12 +19,14 @@
|
||||
|
||||
package net.minecraftforge.client.model.pipeline;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.GameRenderer;
|
||||
import net.minecraft.client.renderer.LightTexture;
|
||||
import net.minecraft.client.renderer.Vector3f;
|
||||
import net.minecraft.client.renderer.color.BlockColors;
|
||||
@@ -35,14 +37,18 @@ import net.minecraft.client.renderer.vertex.VertexFormatElement;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.ILightReader;
|
||||
import net.minecraft.world.IWorldReader;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class VertexLighterFlat extends QuadGatheringTransformer
|
||||
{
|
||||
protected static final VertexFormatElement NORMAL_4F = new VertexFormatElement(0, VertexFormatElement.Type.FLOAT, VertexFormatElement.Usage.NORMAL, 4);
|
||||
|
||||
// TODO 1.16/1.17 possibly refactor out the need for the "unpacked" format entirely. It's creating more headaches than solutions.
|
||||
// This mess reverses the conversion to float bits done in LightUtil.unpack
|
||||
private static final int LIGHTMAP_PACKING_FACTOR = ((256 << (8 * (DefaultVertexFormats.TEX_2SB.getType().getSize() - 1))) - 1) >>> 1;
|
||||
// Max lightmap value, for rescaling
|
||||
private static final int LIGHTMAP_MAX = 0xF0;
|
||||
// Inlined factor for rescaling input lightmap values, "rounded" up to the next float value to avoid precision loss when result is truncated to int
|
||||
private static final float LIGHTMAP_RESCALE = Math.nextAfter((float) LIGHTMAP_PACKING_FACTOR / LIGHTMAP_MAX, LIGHTMAP_PACKING_FACTOR);
|
||||
|
||||
protected final BlockInfo blockInfo;
|
||||
private int tint = -1;
|
||||
@@ -198,7 +204,7 @@ public class VertexLighterFlat extends QuadGatheringTransformer
|
||||
z += normal[v][2] * .5f;
|
||||
}
|
||||
|
||||
float blockLight = lightmap[v][0], skyLight = lightmap[v][1];
|
||||
float blockLight = lightmap[v][0] * LIGHTMAP_RESCALE, skyLight = lightmap[v][1] * LIGHTMAP_RESCALE;
|
||||
updateLightmap(normal[v], lightmap[v], x, y, z);
|
||||
if(dataLength[lightmapIndex] > 1)
|
||||
{
|
||||
|
||||
@@ -107,7 +107,7 @@ public net.minecraft.entity.ai.brain.schedule.Activity <init>(Ljava/lang/String;
|
||||
public net.minecraft.entity.ai.brain.sensor.SensorType <init>(Ljava/util/function/Supplier;)V
|
||||
public net.minecraft.entity.item.ExperienceOrbEntity field_70530_e # xpValue
|
||||
protected net.minecraft.entity.item.TNTEntity func_70515_d()V # explode - make it easier to extend TNTEntity with custom explosion logic
|
||||
public net.minecraft.entity.merchant.villager.VillagerProcession <init>(Ljava/lang/String;Lnet/minecraft/village/PointOfInterestType;Lcom/google/common/collect/ImmutableSet;Lcom/google/common/collect/ImmutableSet;Lnet/minecraft/util/SoundEvent;)V
|
||||
public net.minecraft.entity.merchant.villager.VillagerProfession <init>(Ljava/lang/String;Lnet/minecraft/village/PointOfInterestType;Lcom/google/common/collect/ImmutableSet;Lcom/google/common/collect/ImmutableSet;Lnet/minecraft/util/SoundEvent;)V
|
||||
protected net.minecraft.entity.monster.AbstractSkeletonEntity func_190727_o()Lnet/minecraft/util/SoundEvent; # getStepSound - make AbstractSkeletonEntity implementable
|
||||
protected net.minecraft.entity.monster.SkeletonEntity func_190727_o()Lnet/minecraft/util/SoundEvent; # getStepSound - make AbstractSkeletonEntity implementable
|
||||
protected net.minecraft.entity.monster.StrayEntity func_190727_o()Lnet/minecraft/util/SoundEvent; # getStepSound - make AbstractSkeletonEntity implementable
|
||||
|
||||
Reference in new issue
Block a user