Fix for [#36610] The new sky model produces strange results

* Clamp theta sky coordinates, to prevent a negative solarElevation. 

Note: This means that you cannot get absolute night with the new model, but this is not supported anyway. So when you reach the maximum sunset, use the World Strength to further decrease the light.
This commit is contained in:
Thomas Dinges 2013-08-30 18:04:23 +00:00
parent a51f8e4353
commit 499bec2a85

@ -464,6 +464,9 @@ static void sky_texture_precompute_new(SunSky *sunsky, float3 dir, float turbidi
float2 spherical = sky_spherical_coordinates(dir);
float theta = spherical.x;
float phi = spherical.y;
/* Clamp to Horizon */
theta = clamp(theta, 0.0f, M_PI_2_F);
sunsky->theta = theta;
sunsky->phi = phi;