Skip to content

Commit

Permalink
Fog update
Browse files Browse the repository at this point in the history
  • Loading branch information
MihailRis committed Dec 27, 2023
1 parent 35b13ad commit 5d4e67f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions res/shaders/main.glslv
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ uniform float u_torchlightDistance;


void main(){
vec2 pos2d = (u_model * vec4(v_position, 1.0)).xz-u_cameraPos.xz;
vec3 pos3d = (u_model * vec4(v_position, 1.0)).xyz-u_cameraPos.xyz;
vec4 modelpos = u_model * vec4(v_position, 1.0);
vec4 viewmodelpos = u_view * modelpos;
vec4 decomp_light = decompress_light(v_light);
Expand All @@ -41,6 +41,6 @@ void main(){
skyLightColor = min(vec3(1.0), skyLightColor*SKY_LIGHT_MUL);

a_color.rgb = max(a_color.rgb, skyLightColor.rgb*decomp_light.a);
a_distance = length(viewmodelpos);
a_distance = length(u_view * u_model * vec4(pos3d.x, pos3d.y*0.2, pos3d.z, 0.0));
gl_Position = u_proj * viewmodelpos;
}
2 changes: 1 addition & 1 deletion src/frontend/WorldRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ void WorldRenderer::drawChunks(Chunks* chunks,
void WorldRenderer::draw(const GfxContext& pctx, Camera* camera){
EngineSettings& settings = engine->getSettings();
skybox->refresh(level->world->daytime,
fmax(1.0f, 10.0f/(settings.chunks.loadDistance-2))+fog*2.0f, 4);
1.0f+fog*2.0f, 4);

const Content* content = level->content;
const ContentIndices* contentIds = content->indices;
Expand Down

0 comments on commit 5d4e67f

Please sign in to comment.