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))
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue