Glow when you talk, flash when you clip

closes #2592
This commit is contained in:
Atlante45 2014-04-10 11:54:14 -07:00
parent 67c8fd5630
commit 2cc2149647
4 changed files with 13 additions and 4 deletions

View file

@ -2557,6 +2557,12 @@ void Application::displayOverlay() {
}
bool isClipping = ((_audio.getTimeSinceLastClip() > 0.f) && (_audio.getTimeSinceLastClip() < CLIPPING_INDICATOR_TIME));
if ((_audio.getTimeSinceLastClip() > 0.f) && (_audio.getTimeSinceLastClip() < CLIPPING_INDICATOR_TIME)) {
const float MAX_MAGNITUDE = 0.7f;
float magnitude = MAX_MAGNITUDE * (1 - _audio.getTimeSinceLastClip() / CLIPPING_INDICATOR_TIME);
renderCollisionOverlay(_glWidget->width(), _glWidget->height(), magnitude, 1.0f);
}
_audio.renderToolBox(MIRROR_VIEW_LEFT_PADDING + AUDIO_METER_GAP,
audioMeterY,

View file

@ -351,10 +351,10 @@ void drawvec3(int x, int y, float scale, float radians, float thick, int mono, g
glPopMatrix();
}
void renderCollisionOverlay(int width, int height, float magnitude) {
void renderCollisionOverlay(int width, int height, float magnitude, float red, float blue, float green) {
const float MIN_VISIBLE_COLLISION = 0.01f;
if (magnitude > MIN_VISIBLE_COLLISION) {
glColor4f(0, 0, 0, magnitude);
glColor4f(red, blue, green, magnitude);
glBegin(GL_QUADS);
glVertex2f(0, 0);
glVertex2d(width, 0);

View file

@ -62,7 +62,7 @@ float extractUniformScale(const glm::vec3& scale);
double diffclock(timeval *clock1,timeval *clock2);
void renderCollisionOverlay(int width, int height, float magnitude);
void renderCollisionOverlay(int width, int height, float magnitude, float red = 0, float blue = 0, float green = 0);
void renderOrientationDirections( glm::vec3 position, const glm::quat& orientation, float size );

View file

@ -210,7 +210,10 @@ void Avatar::render(const glm::vec3& cameraPosition, RenderMode renderMode) {
{
// glow when moving far away
const float GLOW_DISTANCE = 20.0f;
Glower glower(_moving && distanceToTarget > GLOW_DISTANCE && renderMode == NORMAL_RENDER_MODE ? 1.0f : 0.0f);
const float GLOW_MAX_LOUDNESS = 2500.0f;
const float MAX_GLOW = 0.7f;
const float GLOW_FROM_AVERAGE_LOUDNESS = MAX_GLOW * getHeadData()->getAudioLoudness() / GLOW_MAX_LOUDNESS;
Glower glower(_moving && distanceToTarget > GLOW_DISTANCE && renderMode == NORMAL_RENDER_MODE ? 1.0f : GLOW_FROM_AVERAGE_LOUDNESS);
// render body
if (Menu::getInstance()->isOptionChecked(MenuOption::Avatars)) {