Skip to content

Commit 4f37647

Browse files
author
dashodanger
committed
Sky/fog fixes
1 parent 3c6da71 commit 4f37647

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

source_files/edge/r_sky.cc

+8-2
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ static void RenderSkySlice(float top, float bottom, float atop, float abottom, f
342342
sg_color topcol = {1.0f, 1.0f, 1.0f, atop};
343343
sg_color bottomcol = {1.0f, 1.0f, 1.0f, abottom};
344344

345-
RendererVertex *glvert = BeginRenderUnit(GL_QUADS, 128, GL_MODULATE, sky_tex_id, (GLuint)kTextureEnvironmentDisable, 0, 0, blend|kBlendingAlpha, fc_to_use, fd_to_use);
345+
RendererVertex *glvert = BeginRenderUnit(GL_QUADS, 128, GL_MODULATE, sky_tex_id, (GLuint)kTextureEnvironmentDisable, 0, 0, blend, fc_to_use, fd_to_use);
346346

347347
// Go through circular points
348348
for (unsigned a = 0; a < 31; a++)
@@ -432,6 +432,10 @@ static void RenderSkyCylinder(void)
432432
fd_to_use = 0.0f;
433433
blend = (BlendingMode)(blend|kBlendingNoFog);
434434
}
435+
else if (fc_to_use != kRGBANoValue)
436+
{
437+
fd_to_use *= 0.005f;
438+
}
435439

436440
// Render top cap
437441
RendererVertex *glvert = BeginRenderUnit(GL_QUADS, 4, GL_MODULATE, 0, (GLuint)kTextureEnvironmentDisable, 0, 0, blend, fc_to_use, fd_to_use);
@@ -469,6 +473,8 @@ static void RenderSkyCylinder(void)
469473

470474
// Render skybox sides
471475

476+
blend = (BlendingMode)(blend|kBlendingAlpha);
477+
472478
// Check for odd sky sizes
473479
float tx = 0.125f;
474480
float ty = 2.0f;
@@ -756,7 +762,7 @@ void FinishSky(void)
756762
global_render_state->Disable(GL_DEPTH_TEST);
757763

758764
if (!renderer_dumb_sky.d_)
759-
global_render_state->DepthFunction(GL_GREATER);
765+
global_render_state->DepthFunction(GL_ALWAYS);
760766
else
761767
global_render_state->DepthMask(false);
762768

source_files/edge/r_units.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ void RenderCurrentUnits(void)
305305
global_render_state->ClearColor(fc.r, fc.g, fc.b, 1.0f);
306306
global_render_state->FogColor(fc.r, fc.g, fc.b, 1.0f);
307307
global_render_state->FogDensity(std::log1p(density));
308-
if (density > 0.00009f)
308+
if (!AlmostEquals(density, 0.0f))
309309
global_render_state->Enable(GL_FOG);
310310
else
311311
global_render_state->Disable(GL_FOG);

0 commit comments

Comments
 (0)