fix lighting color
This commit is contained in:
parent
d996d36742
commit
f647862095
3 changed files with 54 additions and 32 deletions
|
@ -748,54 +748,64 @@ public class EntityRenderer {
|
|||
if (world != null)
|
||||
{
|
||||
float sun = world.getSunBrightness(1.0F);
|
||||
float msun = world.getLastLightning() > 0 ? 1.0f : sun * 0.95F + 0.05F;
|
||||
float fsun = world.getLastLightning() > 0 ? 1.0f : sun;
|
||||
float msun = sun * 0.95F + 0.05F;
|
||||
|
||||
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 block = World.BRIGHTNESS[world.dimension.getBrightness()][n % 16] * (this.torchFlickerX * 0.1F + 1.5F);
|
||||
float rblock = World.BRIGHTNESS[0][n % 16];
|
||||
|
||||
float sred = sky * (sun * 0.65F + 0.35F);
|
||||
float sgreen = sky * (sun * 0.65F + 0.35F);
|
||||
float bgreen = block * ((block * 0.6F + 0.4F) * 0.6F + 0.4F);
|
||||
float bblue = block * (block * block * 0.6F + 0.4F);
|
||||
float red = sred + block;
|
||||
float green = sgreen + bgreen;
|
||||
float blue = sky + bblue;
|
||||
red = red * 0.96F + 0.03F;
|
||||
green = green * 0.96F + 0.03F;
|
||||
blue = blue * 0.96F + 0.03F;
|
||||
|
||||
float sblue = sky;
|
||||
if (world.dimension.getLightColor() != 0xffffffff)
|
||||
{
|
||||
Vec3 lightColor = new Vec3(world.dimension.getLightColor());
|
||||
float light = (float)(15 - (n % 16)) / 15.0f * (float)(n / 16) / 15.0f;
|
||||
red = red * (1.0F - light) + (float)lightColor.xCoord * fsun * light;
|
||||
green = green * (1.0F - light) + (float)lightColor.yCoord * fsun * light;
|
||||
blue = blue * (1.0F - light) + (float)lightColor.zCoord * fsun * light;
|
||||
float light = world.dimension.hasNoLight() ? 1.0f : sky;
|
||||
sred = (float)lightColor.xCoord * light;
|
||||
sgreen = (float)lightColor.yCoord * light;
|
||||
sblue = (float)lightColor.zCoord * light;
|
||||
}
|
||||
|
||||
if (world.dimension.getBlockColor() != 0xffffffff)
|
||||
{
|
||||
Vec3 lightColor = new Vec3(world.dimension.getBlockColor());
|
||||
float light = (float)(15 - (n / 16)) / 15.0f * (float)(n % 16) / 15.0f;
|
||||
red = red * (1.0F - light) + (float)lightColor.xCoord * light;
|
||||
green = green * (1.0F - light) + (float)lightColor.yCoord * light;
|
||||
blue = blue * (1.0F - light) + (float)lightColor.zCoord * light;
|
||||
}
|
||||
|
||||
if (world.getLastLightning() > 0)
|
||||
{
|
||||
Vec3 lightColor = world.getLightColor();
|
||||
float light = (float)world.getLastLightning() - partialTicks;
|
||||
float intens = (float)world.getLastLightning() - partialTicks;
|
||||
if(intens > 1.0F)
|
||||
intens = 1.0F;
|
||||
float light = world.dimension.hasNoLight() ? 1.0f : rsky;
|
||||
sred = sred * (1.0F - intens) + (float)lightColor.xCoord * light * intens;
|
||||
sgreen = sgreen * (1.0F - intens) + (float)lightColor.yCoord * light * intens;
|
||||
sblue = sblue * (1.0F - intens) + (float)lightColor.zCoord * light * intens;
|
||||
}
|
||||
|
||||
float bred = block;
|
||||
float bgreen = block * ((block * 0.6F + 0.4F) * 0.6F + 0.4F);
|
||||
float bblue = block * (block * block * 0.6F + 0.4F);
|
||||
if (world.dimension.getBlockColor() != 0xffffffff)
|
||||
{
|
||||
Vec3 lightColor = new Vec3(world.dimension.getBlockColor());
|
||||
float light = world.dimension.isBlockLightSubtracted() ? rblock * (this.torchFlickerX * 0.1F + 1.5F) : block;
|
||||
if(light > 1.0F)
|
||||
light = 1.0F;
|
||||
light *= (float)(15 - (n % 16)) / 15.0f * (float)(n / 16) / 15.0f;
|
||||
red = red * (1.0F - light) + (float)lightColor.xCoord * light;
|
||||
green = green * (1.0F - light) + (float)lightColor.yCoord * light;
|
||||
blue = blue * (1.0F - light) + (float)lightColor.zCoord * light;
|
||||
bred = (float)lightColor.xCoord * light;
|
||||
bgreen = (float)lightColor.yCoord * light;
|
||||
bblue = (float)lightColor.zCoord * light;
|
||||
if(world.dimension.isBlockLightSubtracted()) {
|
||||
sred *= 1.0f - rblock;
|
||||
sgreen *= 1.0f - rblock;
|
||||
sblue *= 1.0f - rblock;
|
||||
}
|
||||
}
|
||||
|
||||
float red = sred + bred;
|
||||
float green = sgreen + bgreen;
|
||||
float blue = sblue + bblue;
|
||||
|
||||
red = red * 0.96F + 0.03F;
|
||||
green = green * 0.96F + 0.03F;
|
||||
blue = blue * 0.96F + 0.03F;
|
||||
|
||||
if (this.gm.player.hasEffect(Effect.NIGHT_VISION))
|
||||
{
|
||||
|
|
|
@ -145,6 +145,7 @@ public abstract class Dimension extends Nameable {
|
|||
|
||||
// client
|
||||
private boolean denseFog = false;
|
||||
private boolean subtractBlock = false;
|
||||
private float cloudHeight = 192.0f;
|
||||
private int skyColor = 0x000000;
|
||||
private int fogColor = 0x000000;
|
||||
|
@ -561,6 +562,11 @@ public abstract class Dimension extends Nameable {
|
|||
return this;
|
||||
}
|
||||
|
||||
public final Dimension enableBlockLightSubtraction() {
|
||||
this.subtractBlock = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public final Dimension setTimeQualifier(int value) {
|
||||
this.timeQualifier = value;
|
||||
|
@ -717,6 +723,10 @@ public abstract class Dimension extends Nameable {
|
|||
public final int getBlockColor() {
|
||||
return this.blockColor;
|
||||
}
|
||||
|
||||
public final boolean isBlockLightSubtracted() {
|
||||
return this.subtractBlock;
|
||||
}
|
||||
|
||||
public final String getCloudTexture() {
|
||||
return "textures/world/" + this.cloudTexture.getTexture() + ".png";
|
||||
|
@ -1027,6 +1037,7 @@ public abstract class Dimension extends Nameable {
|
|||
this.cloudColor = tag.getInt("CloudColor");
|
||||
this.lightColor = tag.getInt("LightColor");
|
||||
this.blockColor = tag.getInt("BlockColor");
|
||||
this.subtractBlock = tag.getBool("SubtractBlock");
|
||||
this.gravity = tag.getFloat("Gravity");
|
||||
this.temperature = tag.getFloat("Temperature");
|
||||
this.orbitOffset = tag.getFloat("OrbitOffset");
|
||||
|
@ -1205,6 +1216,7 @@ public abstract class Dimension extends Nameable {
|
|||
tag.setInt("CloudColor", this.cloudColor);
|
||||
tag.setInt("LightColor", this.lightColor);
|
||||
tag.setInt("BlockColor", this.blockColor);
|
||||
tag.setBool("SubtractBlock", this.subtractBlock);
|
||||
tag.setFloat("Gravity", this.gravity);
|
||||
tag.setFloat("Temperature", this.temperature);
|
||||
tag.setFloat("OrbitOffset", this.orbitOffset);
|
||||
|
|
|
@ -583,14 +583,14 @@ public abstract class UniverseRegistry {
|
|||
.setStarColorSin(25.0f, 0.1f, 0.25f, 0xff00ff, 1, 4).setDeepStarColorSin(25.0f, 0.1f, 0.5f, 0xff00ff, 1, 4));
|
||||
|
||||
registerDomain("tianxin", "Tian'Xin");
|
||||
registerArea("nienrath", "Ni'enrath", new Area(0x7f00ff, 0x7f00ff, 276.15f, 1).setLightColor(0x7f00ff).setBlockColor(0xcf6fff)
|
||||
registerArea("nienrath", "Ni'enrath", new Area(0x7f00ff, 0x7f00ff, 276.15f, 1).setLightColor(0x07000f).setBlockColor(0xcf6fff)
|
||||
.setPerlinGen(Blocks.tian.getState(), Blocks.springwater.getState(), 63).setBiome(Biome.TIAN)
|
||||
.setBiomeReplacer(Blocks.tian.getState()).enableLongCaves().enableMobs().enableSnow()
|
||||
.addLake(Blocks.springwater.getState(), Blocks.tian.getState(), Blocks.tian.getState(), 4, 0, 255, false)
|
||||
.addLiquid(Blocks.flowing_springwater.getState(), 50, 8, 255, false), "tianxin");
|
||||
|
||||
registerDomain("digital", "Digital");
|
||||
registerArea("cyberspace", "Cyberspace", new Area(0x000000, 0x000000, 293.15f, 15).setLightColor(0x00ff00).setBlockColor(0x00ff00)
|
||||
registerArea("cyberspace", "Cyberspace", new Area(0x000000, 0x000000, 293.15f, 15).setLightColor(0x00ff00).setBlockColor(0xff0000).enableBlockLightSubtraction()
|
||||
.setFlatGen(Blocks.green_clay.getState(), 2)
|
||||
.enableMobs(), "digital");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue