Use 15 blinks per minute as a base/maximum frequency.

This commit is contained in:
Andrzej Kapolka 2013-07-03 17:12:43 -07:00
parent b7e9173796
commit 43258f9dcd

View file

@ -189,12 +189,13 @@ void Head::simulate(float deltaTime, bool isMine) {
const float FULLY_CLOSED = 1.0f; const float FULLY_CLOSED = 1.0f;
if (_leftEyeBlinkVelocity == 0.0f && _rightEyeBlinkVelocity == 0.0f) { if (_leftEyeBlinkVelocity == 0.0f && _rightEyeBlinkVelocity == 0.0f) {
// no blinking when brows are raised; blink less with increasing loudness // no blinking when brows are raised; blink less with increasing loudness
const float ROOT_LOUDNESS_TO_BLINK_INTERVAL = 0.75f; const float BASE_BLINK_RATE = 15.0f / 60.0f;
if (forceBlink || (_browAudioLift < EPSILON && shouldDo( const float ROOT_LOUDNESS_TO_BLINK_INTERVAL = 0.25f;
sqrtf(_averageLoudness) * ROOT_LOUDNESS_TO_BLINK_INTERVAL, deltaTime))) { if (forceBlink || (_browAudioLift < EPSILON && shouldDo(glm::max(1.0f, sqrt(_averageLoudness) *
ROOT_LOUDNESS_TO_BLINK_INTERVAL) / BASE_BLINK_RATE, deltaTime))) {
_leftEyeBlinkVelocity = BLINK_SPEED; _leftEyeBlinkVelocity = BLINK_SPEED;
_rightEyeBlinkVelocity = BLINK_SPEED; _rightEyeBlinkVelocity = BLINK_SPEED;
} }
} else { } else {
_leftEyeBlink = glm::clamp(_leftEyeBlink + _leftEyeBlinkVelocity * deltaTime, FULLY_OPEN, FULLY_CLOSED); _leftEyeBlink = glm::clamp(_leftEyeBlink + _leftEyeBlinkVelocity * deltaTime, FULLY_OPEN, FULLY_CLOSED);
_rightEyeBlink = glm::clamp(_rightEyeBlink + _rightEyeBlinkVelocity * deltaTime, FULLY_OPEN, FULLY_CLOSED); _rightEyeBlink = glm::clamp(_rightEyeBlink + _rightEyeBlinkVelocity * deltaTime, FULLY_OPEN, FULLY_CLOSED);