Fix divide by zero causing NaN with certain day cycles in DRTVWR-559
parent
2e2a821e36
commit
8d20d61b4d
|
|
@ -693,6 +693,7 @@ void LLSettingsBlender::update(const LLSettingsBase::BlendFactor& blendf)
|
|||
F64 LLSettingsBlender::setBlendFactor(const LLSettingsBase::BlendFactor& blendf_in)
|
||||
{
|
||||
LLSettingsBase::TrackPosition blendf = blendf_in;
|
||||
llassert(!isnan(blendf));
|
||||
if (blendf >= 1.0)
|
||||
{
|
||||
triggerComplete();
|
||||
|
|
|
|||
|
|
@ -467,6 +467,7 @@ protected:
|
|||
|
||||
class LLSettingsBlenderTimeDelta : public LLSettingsBlender
|
||||
{
|
||||
protected:
|
||||
LOG_CLASS(LLSettingsBlenderTimeDelta);
|
||||
public:
|
||||
static const LLSettingsBase::BlendFactor MIN_BLEND_DELTA;
|
||||
|
|
|
|||
|
|
@ -168,6 +168,9 @@ namespace
|
|||
// Find normalized track position of given time along full length of cycle
|
||||
inline LLSettingsBase::TrackPosition convert_time_to_position(const LLSettingsBase::Seconds& time, const LLSettingsBase::Seconds& len)
|
||||
{
|
||||
// early out to avoid divide by zero. if len is zero then jump to end position
|
||||
if (len == 0.f) return 1.f;
|
||||
|
||||
LLSettingsBase::TrackPosition position = LLSettingsBase::TrackPosition(fmod((F64)time, (F64)len) / (F64)len);
|
||||
return llclamp(position, 0.0f, 1.0f);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue