1
0
Fork 0

Fix a posible devide by zero situation

This commit is contained in:
ehofman 2004-01-15 18:10:00 +00:00
parent 2c59d1621f
commit 491e7c6fea

View file

@ -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;