fix lighting
This commit is contained in:
parent
e289dc7d5b
commit
2ea8656390
4 changed files with 14 additions and 13 deletions
|
@ -1737,7 +1737,7 @@ public class Client implements IThreadListener {
|
||||||
lline = "Licht: " + chunk.getLightSub(blockpos, 0) + " (" + chunk.getLight(LightType.SKY, blockpos) + " Himmel, "
|
lline = "Licht: " + chunk.getLightSub(blockpos, 0) + " (" + chunk.getLight(LightType.SKY, blockpos) + " Himmel, "
|
||||||
+ chunk.getLight(LightType.BLOCK, blockpos) + " Blöcke, " + String.format(
|
+ chunk.getLight(LightType.BLOCK, blockpos) + " Blöcke, " + String.format(
|
||||||
"%.1f", this.world.getSunBrightness(1.0f) * 15.0f) + " Welt), A: "
|
"%.1f", this.world.getSunBrightness(1.0f) * 15.0f) + " Welt), A: "
|
||||||
+ String.format("%.3f °", this.world.getCelestialAngle(1.0f));
|
+ String.format("%.1f °", this.world.getCelestialAngle(1.0f));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bline = "Biom: <?>, D: " +
|
bline = "Biom: <?>, D: " +
|
||||||
|
@ -1745,7 +1745,7 @@ public class Client implements IThreadListener {
|
||||||
" (" + (this.dimensionName == null ? UniverseRegistry.getName(this.world.dimension) : this.dimensionName) + ")";
|
" (" + (this.dimensionName == null ? UniverseRegistry.getName(this.world.dimension) : this.dimensionName) + ")";
|
||||||
lline = "Licht: " + String.format(
|
lline = "Licht: " + String.format(
|
||||||
"%.1f", this.world.getSunBrightness(1.0f) * 15.0f) + " Welt, A: "
|
"%.1f", this.world.getSunBrightness(1.0f) * 15.0f) + " Welt, A: "
|
||||||
+ String.format("%.3f °", this.world.getCelestialAngle(1.0f));
|
+ String.format("%.1f °", this.world.getCelestialAngle(1.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
float temp = Math.max(this.world.getTempOffset() + (biome != null ? biome.getTemperature(blockpos) : 0.0f), 0.0f);
|
float temp = Math.max(this.world.getTempOffset() + (biome != null ? biome.getTemperature(blockpos) : 0.0f), 0.0f);
|
||||||
|
|
|
@ -750,21 +750,22 @@ public class EntityRenderer {
|
||||||
float sun = world.getSunBrightness(1.0F);
|
float sun = world.getSunBrightness(1.0F);
|
||||||
float msun = sun * 0.95F + 0.05F;
|
float msun = sun * 0.95F + 0.05F;
|
||||||
float space = world.getSpaceFactor();
|
float space = world.getSpaceFactor();
|
||||||
|
float brightness = (float)world.dimension.getBrightness() / 15.0f;
|
||||||
|
|
||||||
for (int n = 0; n < 256; ++n)
|
for (int n = 0; n < 256; ++n)
|
||||||
{
|
{
|
||||||
float sky = World.BRIGHTNESS[world.dimension.getBrightness()][n / 16] * msun;
|
|
||||||
float rsky = World.BRIGHTNESS[0][n / 16];
|
float rsky = World.BRIGHTNESS[0][n / 16];
|
||||||
float block = World.BRIGHTNESS[world.dimension.getBrightness()][n % 16] * (this.torchFlickerX * 0.1F + 1.5F);
|
float sky = rsky * msun;
|
||||||
float rblock = World.BRIGHTNESS[0][n % 16];
|
float rblock = World.BRIGHTNESS[0][n % 16];
|
||||||
|
float block = rblock * (this.torchFlickerX * 0.1F + 1.5F);
|
||||||
|
|
||||||
float sred = sky * (sun * 0.65F + 0.35F);
|
float sred = Math.max(sky * (sun * 0.65F + 0.35F), brightness);
|
||||||
float sgreen = sky * (sun * 0.65F + 0.35F);
|
float sgreen = Math.max(sky * (sun * 0.65F + 0.35F), brightness);
|
||||||
float sblue = sky;
|
float sblue = Math.max(sky, brightness);
|
||||||
if (world.dimension.getLightColor() != 0xffffffff)
|
if (world.dimension.getLightColor() != 0xffffffff)
|
||||||
{
|
{
|
||||||
Vec3 lightColor = new Vec3(world.dimension.getLightColor());
|
Vec3 lightColor = new Vec3(world.dimension.getLightColor());
|
||||||
float light = world.dimension.hasSkyLight() ? sky : 1.0f;
|
float light = world.dimension.hasSkyLight() ? Math.max(sky, brightness) : 1.0f;
|
||||||
sred = (float)lightColor.xCoord * light;
|
sred = (float)lightColor.xCoord * light;
|
||||||
sgreen = (float)lightColor.yCoord * light;
|
sgreen = (float)lightColor.yCoord * light;
|
||||||
sblue = (float)lightColor.zCoord * light;
|
sblue = (float)lightColor.zCoord * light;
|
||||||
|
@ -792,7 +793,7 @@ public class EntityRenderer {
|
||||||
if (world.dimension.getBlockColor() != 0xffffffff)
|
if (world.dimension.getBlockColor() != 0xffffffff)
|
||||||
{
|
{
|
||||||
Vec3 lightColor = new Vec3(world.dimension.getBlockColor());
|
Vec3 lightColor = new Vec3(world.dimension.getBlockColor());
|
||||||
float light = world.dimension.isBlockLightSubtracted() ? rblock * (this.torchFlickerX * 0.1F + 1.5F) : block;
|
float light = block;
|
||||||
if(light > 1.0F)
|
if(light > 1.0F)
|
||||||
light = 1.0F;
|
light = 1.0F;
|
||||||
bred = (float)lightColor.xCoord * light;
|
bred = (float)lightColor.xCoord * light;
|
||||||
|
|
|
@ -40,12 +40,12 @@ public final class Moon extends Dimension {
|
||||||
if(planet == null)
|
if(planet == null)
|
||||||
return super.calcSunColor();
|
return super.calcSunColor();
|
||||||
Star star = UniverseRegistry.getStar(planet);
|
Star star = UniverseRegistry.getStar(planet);
|
||||||
return star == null ? super.calcSunColor() : (star.getSkyColor() | (star.isExterminated() ? 0x80000000 : 0));
|
return star == null ? super.calcSunColor() : ((star.getSkyColor() & 0xffffff) | (star.isExterminated() ? 0x80000000 : 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int[] calcMoonColors() {
|
protected int[] calcMoonColors() {
|
||||||
Planet planet = UniverseRegistry.getPlanet(this);
|
Planet planet = UniverseRegistry.getPlanet(this);
|
||||||
return planet == null ? super.calcMoonColors() : new int[] {planet.getSkyColor() | (planet.isExterminated() ? 0x80000000 : 0)};
|
return planet == null ? super.calcMoonColors() : new int[] {(planet.getSkyColor() & 0xffffff) | (planet.isExterminated() ? 0x80000000 : 0)};
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isBaseDestroyed() {
|
public boolean isBaseDestroyed() {
|
||||||
|
|
|
@ -49,14 +49,14 @@ public final class Planet extends Dimension {
|
||||||
|
|
||||||
protected int calcSunColor() {
|
protected int calcSunColor() {
|
||||||
Star star = UniverseRegistry.getStar(this);
|
Star star = UniverseRegistry.getStar(this);
|
||||||
return star == null ? super.calcSunColor() : (star.getSkyColor() | (star.isExterminated() ? 0x80000000 : 0));
|
return star == null ? super.calcSunColor() : ((star.getSkyColor() & 0xffffff) | (star.isExterminated() ? 0x80000000 : 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int[] calcMoonColors() {
|
protected int[] calcMoonColors() {
|
||||||
List<Moon> moons = UniverseRegistry.getMoons(this);
|
List<Moon> moons = UniverseRegistry.getMoons(this);
|
||||||
int[] colors = new int[moons.size()];
|
int[] colors = new int[moons.size()];
|
||||||
for(int z = 0; z < colors.length; z++) {
|
for(int z = 0; z < colors.length; z++) {
|
||||||
colors[z] = moons.get(z).getSkyColor() | (moons.get(z).isExterminated() ? 0x80000000 : 0);
|
colors[z] = (moons.get(z).getSkyColor() & 0xffffff) | (moons.get(z).isExterminated() ? 0x80000000 : 0);
|
||||||
}
|
}
|
||||||
return colors;
|
return colors;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue