improve lighting
This commit is contained in:
parent
401f9dbe34
commit
995bc4c42f
4 changed files with 70 additions and 46 deletions
|
@ -177,9 +177,12 @@ public class Renderer {
|
|||
private double prevRenderSortY;
|
||||
private double prevRenderSortZ;
|
||||
private boolean displayListEntitiesDirty = true;
|
||||
private float lightColorRed;
|
||||
private float lightColorGreen;
|
||||
private float lightColorBlue;
|
||||
private float sunColorRed;
|
||||
private float sunColorGreen;
|
||||
private float sunColorBlue;
|
||||
private float moonColorRed;
|
||||
private float moonColorGreen;
|
||||
private float moonColorBlue;
|
||||
private float blockColorRed;
|
||||
private float blockColorGreen;
|
||||
private float blockColorBlue;
|
||||
|
@ -222,28 +225,28 @@ public class Renderer {
|
|||
return this.farPlaneDistance * SQRT_2;
|
||||
}
|
||||
|
||||
public float getFogColorRed() {
|
||||
return this.lightColorRed;
|
||||
public float getSunColorRed() {
|
||||
return this.sunColorRed;
|
||||
}
|
||||
|
||||
public float getFogColorGreen() {
|
||||
return this.lightColorGreen;
|
||||
public float getSunColorGreen() {
|
||||
return this.sunColorGreen;
|
||||
}
|
||||
|
||||
public float getFogColorBlue() {
|
||||
return this.lightColorBlue;
|
||||
public float getSunColorBlue() {
|
||||
return this.sunColorBlue;
|
||||
}
|
||||
|
||||
public float getBlockColorRed() {
|
||||
return this.blockColorRed;
|
||||
public float getMoonColorRed() {
|
||||
return this.moonColorRed;
|
||||
}
|
||||
|
||||
public float getBlockColorGreen() {
|
||||
return this.blockColorGreen;
|
||||
public float getMoonColorGreen() {
|
||||
return this.moonColorGreen;
|
||||
}
|
||||
|
||||
public float getBlockColorBlue() {
|
||||
return this.blockColorBlue;
|
||||
public float getMoonColorBlue() {
|
||||
return this.moonColorBlue;
|
||||
}
|
||||
|
||||
public ModelManager getModelManager()
|
||||
|
@ -1132,9 +1135,12 @@ public class Renderer {
|
|||
int g = (int)(green * 255.0F);
|
||||
int b = (int)(blue * 255.0F);
|
||||
if(n == 240) {
|
||||
this.lightColorRed = red;
|
||||
this.lightColorGreen = green;
|
||||
this.lightColorBlue = blue;
|
||||
this.sunColorRed = red * (world.dimension.hasSkyLight() ? sun : 1.0f);
|
||||
this.sunColorGreen = green * (world.dimension.hasSkyLight() ? sun : 1.0f);
|
||||
this.sunColorBlue = blue * (world.dimension.hasSkyLight() ? sun : 1.0f);
|
||||
this.moonColorRed = red * (1.0f - sun);
|
||||
this.moonColorGreen = green * (1.0f - sun);
|
||||
this.moonColorBlue = blue * (1.0f - sun);
|
||||
}
|
||||
else if(n == 15) {
|
||||
this.blockColorRed = red;
|
||||
|
@ -2578,7 +2584,15 @@ public class Renderer {
|
|||
if (this.initialized)
|
||||
{
|
||||
ShaderContext context = Shader.WORLD.use();
|
||||
boolean moon = false;
|
||||
for(int color : this.theWorld.dimension.getMoonColors()) {
|
||||
if((color & 0xff000000) == 0) {
|
||||
moon = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
context.bool("sky_light", this.theWorld.dimension.hasSkyLight() && !this.gm.setGamma);
|
||||
context.bool("moon_light", moon);
|
||||
for (RenderChunk renderchunk : this.renderChunks)
|
||||
{
|
||||
VertexBuffer vertexbuffer = renderchunk.getVertexBuffer();
|
||||
|
|
|
@ -32,19 +32,24 @@ public enum Shader {
|
|||
|
||||
float angle = -90.0f + Client.CLIENT.world.getCelestialAngle(Client.CLIENT.getTickFraction());
|
||||
|
||||
float ambientX = !Client.CLIENT.world.dimension.hasRotation() ? 0.0f : ExtMath.cos(angle / 180.0f * (float)Math.PI);
|
||||
float ambientY = !Client.CLIENT.world.dimension.hasRotation() ? -1.0f : ExtMath.sin(angle / 180.0f * (float)Math.PI);
|
||||
float ambientZ = 0.0f;
|
||||
float sunX = !Client.CLIENT.world.dimension.hasRotation() ? 0.0f : ExtMath.cos(angle / 180.0f * (float)Math.PI);
|
||||
float sunY = !Client.CLIENT.world.dimension.hasRotation() ? -1.0f : ExtMath.sin(angle / 180.0f * (float)Math.PI);
|
||||
context.vec("sun_direction", sunX, sunY, 0.0f);
|
||||
|
||||
float moonX = !Client.CLIENT.world.dimension.hasRotation() ? 0.0f : ExtMath.cos((180.0f + angle) / 180.0f * (float)Math.PI);
|
||||
float moonY = !Client.CLIENT.world.dimension.hasRotation() ? -1.0f : ExtMath.sin((180.0f + angle) / 180.0f * (float)Math.PI);
|
||||
context.vec("moon_direction", moonX, moonY, 0.0f);
|
||||
|
||||
float sunRed = Client.CLIENT.renderer.getSunColorRed();
|
||||
float sunGreen = Client.CLIENT.renderer.getSunColorGreen();
|
||||
float sunBlue = Client.CLIENT.renderer.getSunColorBlue();
|
||||
context.vec("sun_ambient", sunRed, sunGreen, sunBlue);
|
||||
|
||||
float moonRed = Client.CLIENT.renderer.getMoonColorRed();
|
||||
float moonGreen = Client.CLIENT.renderer.getMoonColorGreen();
|
||||
float moonBlue = Client.CLIENT.renderer.getMoonColorBlue();
|
||||
context.vec("moon_ambient", moonRed, moonGreen, moonBlue);
|
||||
|
||||
context.vec("dir_direction", ambientX, ambientY, ambientZ);
|
||||
float clear_r = Client.CLIENT.renderer.getFogColorRed();
|
||||
float clear_g = Client.CLIENT.renderer.getFogColorGreen();
|
||||
float clear_b = Client.CLIENT.renderer.getFogColorBlue();
|
||||
context.vec("dir_ambient", clear_r, clear_g, clear_b);
|
||||
float block_r = Client.CLIENT.renderer.getBlockColorRed();
|
||||
float block_g = Client.CLIENT.renderer.getBlockColorGreen();
|
||||
float block_b = Client.CLIENT.renderer.getBlockColorBlue();
|
||||
context.vec("block_ambient", block_r, block_g, block_b);
|
||||
context.vec("light_factor", Client.CLIENT.lightBlend);
|
||||
context.vec("max_vert_dist", Client.CLIENT.lightDistVert);
|
||||
context.vec("max_cam_dist", Client.CLIENT.lightDistCam);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue