mirror of
https://github.com/overte-org/overte.git
synced 2025-08-14 17:25:21 +02:00
Fix zero-divide.
This commit is contained in:
parent
2ec62ecc9b
commit
b820f397fc
1 changed files with 17 additions and 2 deletions
|
@ -30,10 +30,25 @@ namespace model {
|
|||
-LOG_P_005 / hazeRange_m.z);
|
||||
}
|
||||
|
||||
inline float convertHazeRangeToHazeRangeFactor(const float hazeRange_m) { return (-LOG_P_005 / hazeRange_m); }
|
||||
|
||||
inline float convertHazeRangeToHazeRangeFactor(const float hazeRange_m) {
|
||||
// limit range to no less than 1.0 metres
|
||||
if (hazeRange_m < 1.0f) {
|
||||
return -LOG_P_005;
|
||||
}
|
||||
else {
|
||||
return -LOG_P_005 / hazeRange_m;
|
||||
}
|
||||
}
|
||||
|
||||
inline float convertHazeAltitudeToHazeAltitudeFactor(const float hazeAltitude_m) {
|
||||
return -LOG_P_005 / hazeAltitude_m;
|
||||
// limit altitude to no less than 1.0 metres
|
||||
if (hazeAltitude_m < 1.0) {
|
||||
return -LOG_P_005;
|
||||
}
|
||||
else {
|
||||
return -LOG_P_005 / hazeAltitude_m;
|
||||
}
|
||||
}
|
||||
|
||||
// Derivation (s is the proportion of sun blend, a is the angle at which the blend is 50%, solve for m = 0.5
|
||||
|
|
Loading…
Reference in a new issue