diff --git a/interface/resources/images/audio-box.svg b/interface/resources/images/audio-box.svg new file mode 100644 index 0000000000..0c0db4f51f --- /dev/null +++ b/interface/resources/images/audio-box.svg @@ -0,0 +1,12 @@ + + + Slice 1 + Created with Sketch (http://www.bohemiancoding.com/sketch) + + + + + + + + \ No newline at end of file diff --git a/interface/resources/images/body.png b/interface/resources/images/body.png deleted file mode 100644 index dda65bad07..0000000000 Binary files a/interface/resources/images/body.png and /dev/null differ diff --git a/interface/resources/images/close.png b/interface/resources/images/close.png deleted file mode 100644 index 8090e3d3d0..0000000000 Binary files a/interface/resources/images/close.png and /dev/null differ diff --git a/interface/resources/images/close.svg b/interface/resources/images/close.svg index 8fe4bf4bdb..0cae08c590 100644 --- a/interface/resources/images/close.svg +++ b/interface/resources/images/close.svg @@ -1,14 +1,12 @@ - - - - - - - - - - + + + Slice 1 + Created with Sketch (http://www.bohemiancoding.com/sketch) + + + + + + + + \ No newline at end of file diff --git a/interface/resources/images/head.png b/interface/resources/images/head.png deleted file mode 100644 index d21b453bee..0000000000 Binary files a/interface/resources/images/head.png and /dev/null differ diff --git a/interface/resources/images/mic-mute.svg b/interface/resources/images/mic-mute.svg new file mode 100644 index 0000000000..39dd811df4 --- /dev/null +++ b/interface/resources/images/mic-mute.svg @@ -0,0 +1,115 @@ + + + +image/svg+xml + + + + + + + + Mic + Created with Sketch (http://www.bohemiancoding.com/sketch) + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/interface/resources/images/mic.svg b/interface/resources/images/mic.svg index a6dee50740..3329f19647 100644 --- a/interface/resources/images/mic.svg +++ b/interface/resources/images/mic.svg @@ -1,20 +1,105 @@ - - Mic - Created with Sketch (http://www.bohemiancoding.com/sketch) - - - - - - - - - - - - - - - + + +image/svg+xml + + + + + + + + Mic + Created with Sketch (http://www.bohemiancoding.com/sketch) + + + + + + + + + + + + + + \ No newline at end of file diff --git a/interface/resources/images/minus.svg b/interface/resources/images/minus.svg new file mode 100644 index 0000000000..463b24aa4c --- /dev/null +++ b/interface/resources/images/minus.svg @@ -0,0 +1,11 @@ + + + Slice 1 + Created with Sketch (http://www.bohemiancoding.com/sketch) + + + + + + + \ No newline at end of file diff --git a/interface/resources/images/mute.svg b/interface/resources/images/mute.svg deleted file mode 100644 index 1f1b238463..0000000000 --- a/interface/resources/images/mute.svg +++ /dev/null @@ -1,20 +0,0 @@ - - - mute - Created with Sketch (http://www.bohemiancoding.com/sketch) - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/interface/resources/images/plus.svg b/interface/resources/images/plus.svg new file mode 100644 index 0000000000..6efaa31abc --- /dev/null +++ b/interface/resources/images/plus.svg @@ -0,0 +1,12 @@ + + + Slice 1 + Created with Sketch (http://www.bohemiancoding.com/sketch) + + + + + + + + \ No newline at end of file diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index d54cceb245..deaab1ac10 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -2503,20 +2503,19 @@ void Application::displayOverlay() { // Audio VU Meter and Mute Icon const int MUTE_ICON_SIZE = 24; const int AUDIO_METER_INSET = 2; - const int AUDIO_METER_WIDTH = MIRROR_VIEW_WIDTH - MUTE_ICON_SIZE - AUDIO_METER_INSET; + const int MUTE_ICON_PADDING = 10; + const int AUDIO_METER_WIDTH = MIRROR_VIEW_WIDTH - MUTE_ICON_SIZE - AUDIO_METER_INSET - MUTE_ICON_PADDING; const int AUDIO_METER_SCALE_WIDTH = AUDIO_METER_WIDTH - 2 * AUDIO_METER_INSET; const int AUDIO_METER_HEIGHT = 8; - const int AUDIO_METER_Y_GAP = 8; - const int AUDIO_METER_X = MIRROR_VIEW_LEFT_PADDING + MUTE_ICON_SIZE + AUDIO_METER_INSET; + const int AUDIO_METER_GAP = 5; + const int AUDIO_METER_X = MIRROR_VIEW_LEFT_PADDING + MUTE_ICON_SIZE + AUDIO_METER_INSET + AUDIO_METER_GAP; int audioMeterY; if (Menu::getInstance()->isOptionChecked(MenuOption::Mirror)) { - audioMeterY = MIRROR_VIEW_HEIGHT + AUDIO_METER_Y_GAP; + audioMeterY = MIRROR_VIEW_HEIGHT + AUDIO_METER_GAP + MUTE_ICON_PADDING; } else { - audioMeterY = AUDIO_METER_Y_GAP; + audioMeterY = AUDIO_METER_GAP + MUTE_ICON_PADDING; } - _audio.renderMuteIcon(MIRROR_VIEW_LEFT_PADDING, audioMeterY); - const float AUDIO_METER_BLUE[] = {0.0, 0.0, 1.0}; const float AUDIO_METER_GREEN[] = {0.0, 1.0, 0.0}; @@ -2545,18 +2544,27 @@ void Application::displayOverlay() { bool isClipping = ((_audio.getTimeSinceLastClip() > 0.f) && (_audio.getTimeSinceLastClip() < CLIPPING_INDICATOR_TIME)); + _audio.renderToolBox(MIRROR_VIEW_LEFT_PADDING + AUDIO_METER_GAP, + audioMeterY, + Menu::getInstance()->isOptionChecked(MenuOption::Mirror)); + glBegin(GL_QUADS); if (isClipping) { glColor3f(1, 0, 0); } else { - glColor3f(0, 0, 0); + glColor3f(0.475f, 0.475f, 0.475f); } + + audioMeterY += AUDIO_METER_HEIGHT; + + glColor3f(0, 0, 0); // Draw audio meter background Quad glVertex2i(AUDIO_METER_X, audioMeterY); glVertex2i(AUDIO_METER_X + AUDIO_METER_WIDTH, audioMeterY); glVertex2i(AUDIO_METER_X + AUDIO_METER_WIDTH, audioMeterY + AUDIO_METER_HEIGHT); glVertex2i(AUDIO_METER_X, audioMeterY + AUDIO_METER_HEIGHT); + if (audioLevel > AUDIO_RED_START) { if (!isClipping) { glColor3fv(AUDIO_METER_RED); @@ -2596,6 +2604,7 @@ void Application::displayOverlay() { glVertex2i(AUDIO_METER_X + AUDIO_METER_INSET, audioMeterY + AUDIO_METER_HEIGHT - AUDIO_METER_INSET); glEnd(); + if (Menu::getInstance()->isOptionChecked(MenuOption::HeadMouse)) { _myAvatar->renderHeadMouse(); } diff --git a/interface/src/Audio.cpp b/interface/src/Audio.cpp index 63c683dbb0..4843b2f462 100644 --- a/interface/src/Audio.cpp +++ b/interface/src/Audio.cpp @@ -86,7 +86,8 @@ Audio::Audio(Oscilloscope* scope, int16_t initialJitterBufferSamples, QObject* p void Audio::init(QGLWidget *parent) { _micTextureId = parent->bindTexture(QImage(Application::resourcesPath() + "images/mic.svg")); - _muteTextureId = parent->bindTexture(QImage(Application::resourcesPath() + "images/mute.svg")); + _muteTextureId = parent->bindTexture(QImage(Application::resourcesPath() + "images/mic-mute.svg")); + _boxTextureId = parent->bindTexture(QImage(Application::resourcesPath() + "images/audio-box.svg")); } void Audio::reset() { @@ -817,13 +818,52 @@ void Audio::handleAudioByteArray(const QByteArray& audioByteArray) { // or send to the mixer and use delayed loopback } -void Audio::renderMuteIcon(int x, int y) { +void Audio::renderToolBox(int x, int y, bool boxed) { - _iconBounds = QRect(x, y, MUTE_ICON_SIZE, MUTE_ICON_SIZE); glEnable(GL_TEXTURE_2D); - glBindTexture(GL_TEXTURE_2D, _micTextureId); - glColor3f(.93f, .93f, .93f); + if (boxed) { + + bool isClipping = ((getTimeSinceLastClip() > 0.f) && (getTimeSinceLastClip() < 1.f)); + const int BOX_LEFT_PADDING = 5; + const int BOX_TOP_PADDING = 10; + const int BOX_WIDTH = 266; + const int BOX_HEIGHT = 44; + + QRect boxBounds = QRect(x - BOX_LEFT_PADDING, y - BOX_TOP_PADDING, BOX_WIDTH, BOX_HEIGHT); + + glBindTexture(GL_TEXTURE_2D, _boxTextureId); + + if (isClipping) { + glColor3f(1.f,0.f,0.f); + } else { + glColor3f(.41f,.41f,.41f); + } + glBegin(GL_QUADS); + + glTexCoord2f(1, 1); + glVertex2f(boxBounds.left(), boxBounds.top()); + + glTexCoord2f(0, 1); + glVertex2f(boxBounds.right(), boxBounds.top()); + + glTexCoord2f(0, 0); + glVertex2f(boxBounds.right(), boxBounds.bottom()); + + glTexCoord2f(1, 0); + glVertex2f(boxBounds.left(), boxBounds.bottom()); + + glEnd(); + } + + _iconBounds = QRect(x, y, MUTE_ICON_SIZE, MUTE_ICON_SIZE); + if (!_muted) { + glBindTexture(GL_TEXTURE_2D, _micTextureId); + } else { + glBindTexture(GL_TEXTURE_2D, _muteTextureId); + } + + glColor3f(1,1,1); glBegin(GL_QUADS); glTexCoord2f(1, 1); @@ -840,25 +880,6 @@ void Audio::renderMuteIcon(int x, int y) { glEnd(); - if (_muted) { - glBindTexture(GL_TEXTURE_2D, _muteTextureId); - glBegin(GL_QUADS); - - glTexCoord2f(1, 1); - glVertex2f(_iconBounds.left(), _iconBounds.top()); - - glTexCoord2f(0, 1); - glVertex2f(_iconBounds.right(), _iconBounds.top()); - - glTexCoord2f(0, 0); - glVertex2f(_iconBounds.right(), _iconBounds.bottom()); - - glTexCoord2f(1, 0); - glVertex2f(_iconBounds.left(), _iconBounds.bottom()); - - glEnd(); - } - glDisable(GL_TEXTURE_2D); } diff --git a/interface/src/Audio.h b/interface/src/Audio.h index 88488922f3..c6a3619865 100644 --- a/interface/src/Audio.h +++ b/interface/src/Audio.h @@ -69,7 +69,7 @@ public: void init(QGLWidget *parent = 0); bool mousePressEvent(int x, int y); - void renderMuteIcon(int x, int y); + void renderToolBox(int x, int y, bool boxed); int getNetworkSampleRate() { return SAMPLE_RATE; } int getNetworkBufferLengthSamplesPerChannel() { return NETWORK_BUFFER_LENGTH_SAMPLES_PER_CHANNEL; } @@ -161,6 +161,7 @@ private: bool _localEcho; GLuint _micTextureId; GLuint _muteTextureId; + GLuint _boxTextureId; QRect _iconBounds; // Audio callback in class context. diff --git a/interface/src/ui/RearMirrorTools.cpp b/interface/src/ui/RearMirrorTools.cpp index 314fd7157b..07503c8cb2 100644 --- a/interface/src/ui/RearMirrorTools.cpp +++ b/interface/src/ui/RearMirrorTools.cpp @@ -18,9 +18,8 @@ const char SETTINGS_GROUP_NAME[] = "Rear View Tools"; const char ZOOM_LEVEL_SETTINGS[] = "ZoomLevel"; -const int ICON_SIZE = 20; +const int ICON_SIZE = 24; const int ICON_PADDING = 5; -const int MID_ICON_PADDING = 70; RearMirrorTools::RearMirrorTools(QGLWidget* parent, QRect& bounds, QSettings* settings) : _parent(parent), @@ -29,16 +28,19 @@ RearMirrorTools::RearMirrorTools(QGLWidget* parent, QRect& bounds, QSettings* se _fullScreen(false) { _zoomLevel = HEAD; - _closeTextureId = _parent->bindTexture(QImage(Application::resourcesPath() + "images/close.png")); - _resetTextureId = _parent->bindTexture(QImage(Application::resourcesPath() + "images/reset.png")); - _zoomHeadTextureId = _parent->bindTexture(QImage(Application::resourcesPath() + "images/head.png")); - _zoomBodyTextureId = _parent->bindTexture(QImage(Application::resourcesPath() + "images/body.png")); + _closeTextureId = _parent->bindTexture(QImage(Application::resourcesPath() + "images/close.svg")); + + // Disabled for now https://worklist.net/19548 + // _resetTextureId = _parent->bindTexture(QImage(Application::resourcesPath() + "images/reset.png")); + + _zoomHeadTextureId = _parent->bindTexture(QImage(Application::resourcesPath() + "images/plus.svg")); + _zoomBodyTextureId = _parent->bindTexture(QImage(Application::resourcesPath() + "images/minus.svg")); _shrinkIconRect = QRect(ICON_PADDING, ICON_PADDING, ICON_SIZE, ICON_SIZE); _closeIconRect = QRect(_bounds.left() + ICON_PADDING, _bounds.top() + ICON_PADDING, ICON_SIZE, ICON_SIZE); _resetIconRect = QRect(_bounds.width() - ICON_SIZE - ICON_PADDING, _bounds.top() + ICON_PADDING, ICON_SIZE, ICON_SIZE); - _bodyZoomIconRect = QRect(_bounds.width() - MID_ICON_PADDING - ICON_SIZE, _bounds.bottom() - ICON_PADDING - ICON_SIZE, ICON_SIZE, ICON_SIZE); - _headZoomIconRect = QRect(_bounds.left() + MID_ICON_PADDING, _bounds.bottom() - ICON_PADDING - ICON_SIZE, ICON_SIZE, ICON_SIZE); + _bodyZoomIconRect = QRect(_bounds.width() - ICON_SIZE - ICON_PADDING, _bounds.bottom() - ICON_PADDING - ICON_SIZE, ICON_SIZE, ICON_SIZE); + _headZoomIconRect = QRect(_bounds.left() + ICON_PADDING, _bounds.bottom() - ICON_PADDING - ICON_SIZE, ICON_SIZE, ICON_SIZE); settings->beginGroup(SETTINGS_GROUP_NAME); _zoomLevel = loadSetting(settings, ZOOM_LEVEL_SETTINGS, 0) == HEAD ? HEAD : BODY; @@ -55,7 +57,10 @@ void RearMirrorTools::render(bool fullScreen) { _windowed = _bounds.contains(mousePosition.x(), mousePosition.y()); if (_windowed) { displayIcon(_bounds, _closeIconRect, _closeTextureId); - displayIcon(_bounds, _resetIconRect, _resetTextureId); + + // Disabled for now https://worklist.net/19548 + // displayIcon(_bounds, _resetIconRect, _resetTextureId); + displayIcon(_bounds, _headZoomIconRect, _zoomHeadTextureId, _zoomLevel == HEAD); displayIcon(_bounds, _bodyZoomIconRect, _zoomBodyTextureId, _zoomLevel == BODY); } @@ -69,11 +74,13 @@ bool RearMirrorTools::mousePressEvent(int x, int y) { emit closeView(); return true; } - + + /* Disabled for now https://worklist.net/19548 if (_resetIconRect.contains(x, y)) { emit resetView(); return true; } + */ if (_headZoomIconRect.contains(x, y)) { _zoomLevel = HEAD; @@ -84,7 +91,7 @@ bool RearMirrorTools::mousePressEvent(int x, int y) { _zoomLevel = BODY; return true; } - + if (_bounds.contains(x, y)) { _windowed = false; emit restoreView(); @@ -120,7 +127,7 @@ void RearMirrorTools::displayIcon(QRect bounds, QRect iconBounds, GLuint texture glEnable(GL_TEXTURE_2D); if (selected) { - glColor3f(1, 1, 0); + glColor3f(.5f, .5f, .5f); } else { glColor3f(1, 1, 1); }