From: ehofman Date: Thu, 15 Jan 2004 18:10:00 +0000 (+0000) Subject: Fix a posible devide by zero situation X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=491e7c6feaa0ab12945c52b0f1818f4e26db9247;p=flightgear.git Fix a posible devide by zero situation --- diff --git a/src/Time/light.cxx b/src/Time/light.cxx index e4f67467c..72cc06fdd 100644 --- a/src/Time/light.cxx +++ b/src/Time/light.cxx @@ -297,6 +297,9 @@ void FGLight::update_adj_fog_color () { float avf = 0.87 - (45000 - av) / 83333.33; float sif = 0.5 - cos(_sun_angle*2)/2; + if (sif < 1e-4) + sif = 1e-4; + float rf1 = fabs((rotation - SGD_PI) / SGD_PI); // 0.0 .. 1.0 float rf2 = avf * pow(rf1 * rf1, 1/sif); float rf3 = 0.94 - rf2;