Prevent audio average from becoming less than zero (thus causing sqrt to

return nan, thus making our fake blendshape coefficient nan, thus making the
jaw disappear).  Closes #2334.
This commit is contained in:
Andrzej Kapolka 2014-03-18 09:12:23 -07:00
parent 2673aa00f0
commit d80f110961

View file

@ -90,8 +90,7 @@ void Head::simulate(float deltaTime, bool isMine, bool billboard) {
_saccade += (_saccadeTarget - _saccade) * 0.50f;
const float AUDIO_AVERAGING_SECS = 0.05f;
_averageLoudness = (1.f - deltaTime / AUDIO_AVERAGING_SECS) * _averageLoudness +
(deltaTime / AUDIO_AVERAGING_SECS) * _audioLoudness;
_averageLoudness = glm::mix(_averageLoudness, _audioLoudness, glm::min(deltaTime / AUDIO_AVERAGING_SECS, 1.0f));
// Detect transition from talking to not; force blink after that and a delay
bool forceBlink = false;