Skip to content

Commit

Permalink
[ChunkBuilder] Now disabling fallback AO when smooth lighting is enab…
Browse files Browse the repository at this point in the history
…led.
  • Loading branch information
Unarelith committed Jun 30, 2020
1 parent b0aa1ad commit db6f775
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
8 changes: 0 additions & 8 deletions resources/shaders/game.f.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,6 @@ void main() {
// Very cheap "transparency": don't draw pixels with a low alpha value
if(color.a < 0.3 && blockFace > -1.) discard;

// FIXME: FINISH THIS WITH PROPER CODE AND SUN BASIC DISPLAY
// int maxTime = 5 * 1000;
// float time = mod(u_lightPosition, maxTime) / maxTime * 2 - 1;
// vec3 lightPosition = vec3(0.0, sin(time) * 40, cos(time) * 40);
// color *= light(vec3(1.0, 1.0, 1.0), vec4(lightPosition, 1.0), 0.5, 0.5);

float minBrightness = 2.0 / 16.0;
if (lightCheck != -1.) {
float ambientIntensity = max(max(v_lightValue.x, v_lightValue.y) / 16.0, minBrightness);
Expand All @@ -75,8 +69,6 @@ void main() {
ambientIntensity = max(ambientIntensity * 0.9, minBrightness);

color = light(color, vec3(1.0, 1.0, 1.0), v_coord3d, ambientIntensity, diffuseIntensity);

// color = vec4(0, 0, v_lightValue.x / 16.0, 1);
}

color.rgb *= v_ambientOcclusion;
Expand Down
2 changes: 1 addition & 1 deletion source/client/world/ChunkBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ inline void ChunkBuilder::addFace(s8f x, s8f y, s8f z, s8f f, const ClientChunk
}

auto addVertex = [&](u8 v) {
if (!Config::isAmbientOcclusionEnabled)
if (!Config::isAmbientOcclusionEnabled || Config::isSmoothLightingEnabled)
vertices[v].ambientOcclusion = 5;

if (block.drawType() == BlockDrawType::Liquid)
Expand Down

0 comments on commit db6f775

Please sign in to comment.