From f675b198cb7c538856f977f76e02573d837c60b7 Mon Sep 17 00:00:00 2001 From: stojce Date: Sat, 26 Oct 2013 21:10:05 +0200 Subject: [PATCH 1/4] RearView Tools - moved to separate class - new icon/button for restore view - --- interface/src/Application.cpp | 76 +++++--------------- interface/src/Application.h | 7 +- interface/src/ui/RearMirrorTools.cpp | 100 +++++++++++++++++++++++++++ interface/src/ui/RearMirrorTools.h | 37 ++++++++++ 4 files changed, 162 insertions(+), 58 deletions(-) create mode 100644 interface/src/ui/RearMirrorTools.cpp create mode 100644 interface/src/ui/RearMirrorTools.h diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 952f6fff8c..850b7dbeaf 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -89,8 +89,6 @@ const int MIRROR_VIEW_TOP_PADDING = 5; const int MIRROR_VIEW_LEFT_PADDING = 10; const int MIRROR_VIEW_WIDTH = 265; const int MIRROR_VIEW_HEIGHT = 215; -const int MIRROR_ICON_SIZE = 16; -const int MIRROR_CLOSE_ICON_PADDING = 5; void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString &message) { fprintf(stdout, "%s", message.toLocal8Bit().constData()); @@ -109,6 +107,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : _wantToKillLocalVoxels(false), _audioScope(256, 200, true), _profile(QString()), + _mirrorViewRect(QRect(MIRROR_VIEW_LEFT_PADDING, MIRROR_VIEW_TOP_PADDING, MIRROR_VIEW_WIDTH, MIRROR_VIEW_HEIGHT)), _mouseX(0), _mouseY(0), _lastMouseMove(usecTimestampNow()), @@ -454,11 +453,7 @@ void Application::paintGL() { displaySide(_mirrorCamera, selfAvatarOnly); glPopMatrix(); - // render rear view tools if mouse is in the bounds - QPoint mousePosition = _glWidget->mapFromGlobal(QCursor::pos()); - if (_mirrorViewRect.contains(mousePosition.x(), mousePosition.y())) { - displayRearMirrorTools(); - } + _rearMirrorTools->render(); // reset Viewport and projection matrix glViewport(0, 0, _glWidget->width(), _glWidget->height()); @@ -489,8 +484,6 @@ void Application::resizeGL(int width, int height) { resetCamerasOnResizeGL(_viewFrustumOffsetCamera, width, height); resetCamerasOnResizeGL(_myCamera, width, height); - _mirrorViewRect = QRect(MIRROR_VIEW_LEFT_PADDING, MIRROR_VIEW_TOP_PADDING, MIRROR_VIEW_WIDTH, MIRROR_VIEW_HEIGHT); - glViewport(0, 0, width, height); // shouldn't this account for the menu??? updateProjectionMatrix(); @@ -1085,12 +1078,9 @@ void Application::mousePressEvent(QMouseEvent* event) { return; } - if (Menu::getInstance()->isOptionChecked(MenuOption::Mirror)) { - QRect closeIconRect = QRect(MIRROR_CLOSE_ICON_PADDING + _mirrorViewRect.left(), MIRROR_CLOSE_ICON_PADDING + _mirrorViewRect.top(), MIRROR_ICON_SIZE, MIRROR_ICON_SIZE); - - if (closeIconRect.contains(_mouseX, _mouseY)) { - Menu::getInstance()->triggerOption(MenuOption::Mirror); - } + if (_rearMirrorTools->mousePressEvent(_mouseX, _mouseY)) { + // stop propagation + return; } if (!_palette.isActive() && (!_isHoverVoxel || _lookatTargetAvatar)) { @@ -1675,10 +1665,6 @@ void Application::init() { _mirrorCamera.setMode(CAMERA_MODE_MIRROR); _mirrorCamera.setAspectRatio((float)MIRROR_VIEW_WIDTH / (float)MIRROR_VIEW_HEIGHT); _mirrorCamera.setFieldOfView(30); - _mirrorViewRect = QRect(MIRROR_VIEW_LEFT_PADDING, MIRROR_VIEW_TOP_PADDING, MIRROR_VIEW_WIDTH, MIRROR_VIEW_HEIGHT); - - switchToResourcesParentIfRequired(); - _closeTextureId = _glWidget->bindTexture(QImage("./resources/images/close.png")); OculusManager::connect(); if (OculusManager::isConnected()) { @@ -1731,8 +1717,22 @@ void Application::init() { _pieMenu.addAction(_followMode); _audio.init(_glWidget); + + _rearMirrorTools = new RearMirrorTools(_glWidget, _mirrorViewRect); + connect(_rearMirrorTools, SIGNAL(closeView()), SLOT(closeMirrorView())); + connect(_rearMirrorTools, SIGNAL(restoreView()), SLOT(restoreMirrorView())); } +void Application::closeMirrorView() { + Menu::getInstance()->triggerOption(MenuOption::Mirror); +} + +void Application::restoreMirrorView() { + Menu::getInstance()->triggerOption(MenuOption::Mirror); + if (!Menu::getInstance()->isOptionChecked(MenuOption::FullscreenMirror)) { + Menu::getInstance()->triggerOption(MenuOption::FullscreenMirror); + } +} const float MAX_AVATAR_EDIT_VELOCITY = 1.0f; const float MAX_VOXEL_EDIT_DISTANCE = 20.0f; @@ -3958,41 +3958,3 @@ void Application::packetSentNotification(ssize_t length) { _bandwidthMeter.outputStream(BandwidthMeter::VOXELS).updateValue(length); } -void Application::displayRearMirrorTools() { - - glMatrixMode(GL_PROJECTION); - glPushMatrix(); - glLoadIdentity(); - gluOrtho2D(_mirrorViewRect.left(), _mirrorViewRect.right(), _mirrorViewRect.bottom(), _mirrorViewRect.top()); - glDisable(GL_DEPTH_TEST); - glDisable(GL_LIGHTING); - - glEnable(GL_TEXTURE_2D); - glBindTexture(GL_TEXTURE_2D, _closeTextureId); - - glColor3f(1, 1, 1); - glBegin(GL_QUADS); - - int lp = MIRROR_CLOSE_ICON_PADDING + _mirrorViewRect.left(); - int tp = MIRROR_CLOSE_ICON_PADDING + _mirrorViewRect.top(); - int lwp = MIRROR_ICON_SIZE + lp; - int twp = MIRROR_ICON_SIZE + tp; - - glTexCoord2f(1, 1); - glVertex2f(lp, tp); - - glTexCoord2f(0, 1); - glVertex2f(lwp, tp); - - glTexCoord2f(0, 0); - glVertex2f(lwp, twp); - - glTexCoord2f(1, 0); - glVertex2f(lp, twp); - - glEnd(); - - glPopMatrix(); - - glDisable(GL_TEXTURE_2D); -} diff --git a/interface/src/Application.h b/interface/src/Application.h index fb258f0353..8901ff02be 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -59,6 +59,7 @@ #include "ui/BandwidthDialog.h" #include "ui/ChatEntry.h" #include "ui/VoxelStatsDialog.h" +#include "ui/RearMirrorTools.h" class QAction; class QActionGroup; @@ -175,6 +176,7 @@ public slots: void decreaseVoxelSize(); void increaseVoxelSize(); + private slots: void timer(); @@ -195,6 +197,9 @@ private slots: glm::vec2 getScaledScreenPoint(glm::vec2 projectedPoint); void toggleFollowMode(); + + void closeMirrorView(); + void restoreMirrorView(); private: void resetCamerasOnResizeGL(Camera& camera, int width, int height); @@ -303,7 +308,7 @@ private: Camera _viewFrustumOffsetCamera; // The camera we use to sometimes show the view frustum from an offset mode Camera _mirrorCamera; // Cammera for mirror view QRect _mirrorViewRect; - GLuint _closeTextureId; + RearMirrorTools* _rearMirrorTools; Environment _environment; diff --git a/interface/src/ui/RearMirrorTools.cpp b/interface/src/ui/RearMirrorTools.cpp new file mode 100644 index 0000000000..a12eb25c54 --- /dev/null +++ b/interface/src/ui/RearMirrorTools.cpp @@ -0,0 +1,100 @@ +// +// RearMirrorTools.cpp +// interface +// +// Created by stojce on 23.10.2013. +// Copyright (c) 2013 High Fidelity, Inc. All rights reserved. + +#include "RearMirrorTools.h" +#include +#include + +const int MIRROR_ICON_SIZE = 16; +const int MIRROR_ICON_PADDING = 5; + +RearMirrorTools::RearMirrorTools(QGLWidget* parent, QRect& bounds) : _parent(parent), _bounds(bounds), _visible(false) { + switchToResourcesParentIfRequired(); + _closeTextureId = _parent->bindTexture(QImage("./resources/images/close.png")); + _restoreTextureId = _parent->bindTexture(QImage("./resources/images/close.png")); +}; + +void RearMirrorTools::render() { + // render rear view tools if mouse is in the bounds + QPoint mousePosition = _parent->mapFromGlobal(QCursor::pos()); + _visible = _bounds.contains(mousePosition.x(), mousePosition.y()); + if (_visible) { + displayTools(); + } +} + +bool RearMirrorTools::mousePressEvent(int x, int y) { + QRect closeIconRect = QRect(MIRROR_ICON_PADDING + _bounds.left(), MIRROR_ICON_PADDING + _bounds.top(), MIRROR_ICON_SIZE, MIRROR_ICON_SIZE); + QRect restoreIconRect = QRect(_bounds.width() - _bounds.left() - MIRROR_ICON_PADDING, MIRROR_ICON_PADDING + _bounds.top(), MIRROR_ICON_SIZE, MIRROR_ICON_SIZE); + + if (closeIconRect.contains(x, y)) { + emit closeView(); + return true; + } + + if (restoreIconRect.contains(x, y)) { + emit restoreView(); + return true; + } + + return false; +} + +void RearMirrorTools::displayTools() { + int closeLeft = MIRROR_ICON_PADDING + _bounds.left(); + int resoreLeft = _bounds.width() - _bounds.left() - MIRROR_ICON_PADDING; + + int iconTop = MIRROR_ICON_PADDING + _bounds.top(); + int twp = MIRROR_ICON_SIZE + iconTop; + + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glLoadIdentity(); + gluOrtho2D(_bounds.left(), _bounds.right(), _bounds.bottom(), _bounds.top()); + glDisable(GL_DEPTH_TEST); + glDisable(GL_LIGHTING); + glEnable(GL_TEXTURE_2D); + + glColor3f(1, 1, 1); + + glBindTexture(GL_TEXTURE_2D, _closeTextureId); + glBegin(GL_QUADS); + { + glTexCoord2f(1, 1); + glVertex2f(closeLeft, iconTop); + + glTexCoord2f(0, 1); + glVertex2f(MIRROR_ICON_SIZE + closeLeft, iconTop); + + glTexCoord2f(0, 0); + glVertex2f(MIRROR_ICON_SIZE + closeLeft, twp); + + glTexCoord2f(1, 0); + glVertex2f(closeLeft, twp); + } + glEnd(); + + glBindTexture(GL_TEXTURE_2D, _restoreTextureId); + glBegin(GL_QUADS); + { + glTexCoord2f(1, 1); + glVertex2f(resoreLeft, iconTop); + + glTexCoord2f(0, 1); + glVertex2f(MIRROR_ICON_SIZE + resoreLeft, iconTop); + + glTexCoord2f(0, 0); + glVertex2f(MIRROR_ICON_SIZE + resoreLeft, twp); + + glTexCoord2f(1, 0); + glVertex2f(resoreLeft, twp); + } + glEnd(); + + glPopMatrix(); + glDisable(GL_TEXTURE_2D); +} diff --git a/interface/src/ui/RearMirrorTools.h b/interface/src/ui/RearMirrorTools.h new file mode 100644 index 0000000000..a7e6cdc678 --- /dev/null +++ b/interface/src/ui/RearMirrorTools.h @@ -0,0 +1,37 @@ +// +// RearMirrorTools.h +// interface +// +// Created by stojce on 23.10.2013. +// Copyright (c) 2013 High Fidelity, Inc. All rights reserved. + + +#ifndef __hifi__RearMirrorTools__ +#define __hifi__RearMirrorTools__ + +#include "InterfaceConfig.h" + +#include + +class RearMirrorTools : public QObject { + Q_OBJECT +public: + RearMirrorTools(QGLWidget* parent, QRect& bounds); + void render(); + bool mousePressEvent(int x, int y); + +signals: + void closeView(); + void restoreView(); + +private: + QGLWidget* _parent; + QRect _bounds; + GLuint _closeTextureId; + GLuint _restoreTextureId; + bool _visible; + + void displayTools(); +}; + +#endif /* defined(__hifi__RearMirrorTools__) */ From b09e657ecc2f20e66e688d77075102434c2fb22e Mon Sep 17 00:00:00 2001 From: stojce Date: Sun, 27 Oct 2013 09:57:00 +0100 Subject: [PATCH 2/4] click mirror behaviour - shrink function - restore mirror window view and set forward fullscreen view --- interface/src/Application.cpp | 24 +++++- interface/src/Application.h | 1 + interface/src/ui/RearMirrorTools.cpp | 122 +++++++++++++-------------- interface/src/ui/RearMirrorTools.h | 10 ++- 4 files changed, 87 insertions(+), 70 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 850b7dbeaf..36ffa179bb 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -453,12 +453,14 @@ void Application::paintGL() { displaySide(_mirrorCamera, selfAvatarOnly); glPopMatrix(); - _rearMirrorTools->render(); + _rearMirrorTools->render(false); // reset Viewport and projection matrix glViewport(0, 0, _glWidget->width(), _glWidget->height()); glDisable(GL_SCISSOR_TEST); updateProjectionMatrix(_myCamera, updateViewFrustum); + } else if (Menu::getInstance()->isOptionChecked(MenuOption::FullscreenMirror)) { + _rearMirrorTools->render(true); } displayOverlay(); @@ -1721,19 +1723,35 @@ void Application::init() { _rearMirrorTools = new RearMirrorTools(_glWidget, _mirrorViewRect); connect(_rearMirrorTools, SIGNAL(closeView()), SLOT(closeMirrorView())); connect(_rearMirrorTools, SIGNAL(restoreView()), SLOT(restoreMirrorView())); + connect(_rearMirrorTools, SIGNAL(shrinkView()), SLOT(shrinkMirrorView())); } void Application::closeMirrorView() { - Menu::getInstance()->triggerOption(MenuOption::Mirror); + if (Menu::getInstance()->isOptionChecked(MenuOption::Mirror)) { + Menu::getInstance()->triggerOption(MenuOption::Mirror);; + } } void Application::restoreMirrorView() { - Menu::getInstance()->triggerOption(MenuOption::Mirror); + if (Menu::getInstance()->isOptionChecked(MenuOption::Mirror)) { + Menu::getInstance()->triggerOption(MenuOption::Mirror);; + } + if (!Menu::getInstance()->isOptionChecked(MenuOption::FullscreenMirror)) { Menu::getInstance()->triggerOption(MenuOption::FullscreenMirror); } } +void Application::shrinkMirrorView() { + if (!Menu::getInstance()->isOptionChecked(MenuOption::Mirror)) { + Menu::getInstance()->triggerOption(MenuOption::Mirror);; + } + + if (Menu::getInstance()->isOptionChecked(MenuOption::FullscreenMirror)) { + Menu::getInstance()->triggerOption(MenuOption::FullscreenMirror); + } +} + const float MAX_AVATAR_EDIT_VELOCITY = 1.0f; const float MAX_VOXEL_EDIT_DISTANCE = 20.0f; const float HEAD_SPHERE_RADIUS = 0.07; diff --git a/interface/src/Application.h b/interface/src/Application.h index 8901ff02be..50ea7aa9e0 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -200,6 +200,7 @@ private slots: void closeMirrorView(); void restoreMirrorView(); + void shrinkMirrorView(); private: void resetCamerasOnResizeGL(Camera& camera, int width, int height); diff --git a/interface/src/ui/RearMirrorTools.cpp b/interface/src/ui/RearMirrorTools.cpp index a12eb25c54..cc18a40e12 100644 --- a/interface/src/ui/RearMirrorTools.cpp +++ b/interface/src/ui/RearMirrorTools.cpp @@ -9,92 +9,88 @@ #include #include -const int MIRROR_ICON_SIZE = 16; -const int MIRROR_ICON_PADDING = 5; +const int ICON_SIZE = 16; +const int ICON_PADDING = 5; -RearMirrorTools::RearMirrorTools(QGLWidget* parent, QRect& bounds) : _parent(parent), _bounds(bounds), _visible(false) { +RearMirrorTools::RearMirrorTools(QGLWidget* parent, QRect& bounds) : _parent(parent), _bounds(bounds), _windowed(false), _fullScreen(false) { switchToResourcesParentIfRequired(); _closeTextureId = _parent->bindTexture(QImage("./resources/images/close.png")); - _restoreTextureId = _parent->bindTexture(QImage("./resources/images/close.png")); + _shrinkTextureId = _parent->bindTexture(QImage("./resources/images/close.png")); }; -void RearMirrorTools::render() { - // render rear view tools if mouse is in the bounds - QPoint mousePosition = _parent->mapFromGlobal(QCursor::pos()); - _visible = _bounds.contains(mousePosition.x(), mousePosition.y()); - if (_visible) { - displayTools(); +void RearMirrorTools::render(bool fullScreen) { + if (fullScreen) { + _fullScreen = true; + displayIcon(_parent->geometry(), ICON_PADDING, ICON_PADDING, _shrinkTextureId); + } else { + // render rear view tools if mouse is in the bounds + QPoint mousePosition = _parent->mapFromGlobal(QCursor::pos()); + _windowed = _bounds.contains(mousePosition.x(), mousePosition.y()); + if (_windowed) { + displayIcon(_bounds, _bounds.left() + ICON_PADDING, ICON_PADDING, _closeTextureId); + } } } bool RearMirrorTools::mousePressEvent(int x, int y) { - QRect closeIconRect = QRect(MIRROR_ICON_PADDING + _bounds.left(), MIRROR_ICON_PADDING + _bounds.top(), MIRROR_ICON_SIZE, MIRROR_ICON_SIZE); - QRect restoreIconRect = QRect(_bounds.width() - _bounds.left() - MIRROR_ICON_PADDING, MIRROR_ICON_PADDING + _bounds.top(), MIRROR_ICON_SIZE, MIRROR_ICON_SIZE); - - if (closeIconRect.contains(x, y)) { - emit closeView(); - return true; + if (_windowed) { + QRect closeIconRect = QRect(ICON_PADDING + _bounds.left(), ICON_PADDING + _bounds.top(), ICON_SIZE, ICON_SIZE); + if (closeIconRect.contains(x, y)) { + _windowed = false; + emit closeView(); + return true; + } + + if (_bounds.contains(x, y)) { + _windowed = false; + emit restoreView(); + return true; + } } - if (restoreIconRect.contains(x, y)) { - emit restoreView(); - return true; + if (_fullScreen) { + QRect shrinkIconRect = QRect(ICON_PADDING, ICON_PADDING, ICON_SIZE, ICON_SIZE); + if (shrinkIconRect.contains(x, y)) { + _fullScreen = false; + emit shrinkView(); + return true; + } } - return false; } -void RearMirrorTools::displayTools() { - int closeLeft = MIRROR_ICON_PADDING + _bounds.left(); - int resoreLeft = _bounds.width() - _bounds.left() - MIRROR_ICON_PADDING; - - int iconTop = MIRROR_ICON_PADDING + _bounds.top(); - int twp = MIRROR_ICON_SIZE + iconTop; +void RearMirrorTools::displayIcon(QRect bounds, int left, int top, GLuint textureId) { + int twp = ICON_SIZE + top; + glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); - gluOrtho2D(_bounds.left(), _bounds.right(), _bounds.bottom(), _bounds.top()); + + gluOrtho2D(bounds.left(), bounds.right(), bounds.bottom(), bounds.top()); glDisable(GL_DEPTH_TEST); glDisable(GL_LIGHTING); glEnable(GL_TEXTURE_2D); - - glColor3f(1, 1, 1); - - glBindTexture(GL_TEXTURE_2D, _closeTextureId); - glBegin(GL_QUADS); - { - glTexCoord2f(1, 1); - glVertex2f(closeLeft, iconTop); - - glTexCoord2f(0, 1); - glVertex2f(MIRROR_ICON_SIZE + closeLeft, iconTop); - - glTexCoord2f(0, 0); - glVertex2f(MIRROR_ICON_SIZE + closeLeft, twp); - - glTexCoord2f(1, 0); - glVertex2f(closeLeft, twp); - } - glEnd(); - - glBindTexture(GL_TEXTURE_2D, _restoreTextureId); - glBegin(GL_QUADS); - { - glTexCoord2f(1, 1); - glVertex2f(resoreLeft, iconTop); - - glTexCoord2f(0, 1); - glVertex2f(MIRROR_ICON_SIZE + resoreLeft, iconTop); - - glTexCoord2f(0, 0); - glVertex2f(MIRROR_ICON_SIZE + resoreLeft, twp); - - glTexCoord2f(1, 0); - glVertex2f(resoreLeft, twp); - } - glEnd(); + glColor3f(1, 1, 1); + + glBindTexture(GL_TEXTURE_2D, textureId); + glBegin(GL_QUADS); + { + glTexCoord2f(0, 0); + glVertex2f(left, top); + + glTexCoord2f(1, 0); + glVertex2f(ICON_SIZE + left, top); + + glTexCoord2f(1, 1); + glVertex2f(ICON_SIZE + left, twp); + + glTexCoord2f(0, 1); + glVertex2f(left, twp); + } + glEnd(); glPopMatrix(); + glBindTexture(GL_TEXTURE_2D, 0); glDisable(GL_TEXTURE_2D); } diff --git a/interface/src/ui/RearMirrorTools.h b/interface/src/ui/RearMirrorTools.h index a7e6cdc678..77c8b88f3a 100644 --- a/interface/src/ui/RearMirrorTools.h +++ b/interface/src/ui/RearMirrorTools.h @@ -17,21 +17,23 @@ class RearMirrorTools : public QObject { Q_OBJECT public: RearMirrorTools(QGLWidget* parent, QRect& bounds); - void render(); + void render(bool fullScreen); bool mousePressEvent(int x, int y); signals: void closeView(); + void shrinkView(); void restoreView(); private: QGLWidget* _parent; QRect _bounds; GLuint _closeTextureId; - GLuint _restoreTextureId; - bool _visible; + GLuint _shrinkTextureId; + bool _windowed; + bool _fullScreen; - void displayTools(); + void displayIcon(QRect bounds, int left, int top, GLuint textureId); }; #endif /* defined(__hifi__RearMirrorTools__) */ From 4fe9964e5a44d419e22e005f512cab358098bfef Mon Sep 17 00:00:00 2001 From: stojce Date: Mon, 28 Oct 2013 18:19:31 +0100 Subject: [PATCH 3/4] reset view - reset icon - resetView signal --- interface/resources/images/reset.png | Bin 0 -> 1355 bytes interface/src/Application.cpp | 4 +++- interface/src/Application.h | 2 +- interface/src/ui/RearMirrorTools.cpp | 15 +++++++++++---- interface/src/ui/RearMirrorTools.h | 3 ++- 5 files changed, 17 insertions(+), 7 deletions(-) create mode 100644 interface/resources/images/reset.png diff --git a/interface/resources/images/reset.png b/interface/resources/images/reset.png new file mode 100644 index 0000000000000000000000000000000000000000..30735e9ed9fc3c342b8934ea6c9267498b73377a GIT binary patch literal 1355 zcmeAS@N?(olHy`uVBq!ia0y~yV31{CV36TpV_;yIdw$C*1_lPs0*}aI1_o|n5N2eU zHAjMhf$?f)NJL45ua8x7ey(0(N`6wRUPW#J0|?kuSXJZ}^~=l4^~#O)@{7{-4J|D#^$m>ljf`}QQqpvbEAvVcD|GXUl_7?}%yCIAPA4$as*bm2-Y> zK~ZXPab|v=ov962C5jlr9*FvYjQo=P+|-hy%w*5JlGLJtqSTT^kn8M>pt^CZKsU?3 zC^Iz=s@o8%8(9ph-bNqfaioBNgfdt($i>Z$%SIm_Wp-S-tlaY$7?@=|T^vI^c%O!y z%@%ePnSWNzceb1JDpt`cK_?Ezd{K&12?!|qr1C{%A;+tQO-n?a>^!8BrIZ{UPad3H z@1QrSSzLcF$Ic3_dqPY<4>@})Y-oG7`d`}HHJfjHZrXaGn|t>6XWyUgy}!rYIA2*- zR(9g&I-Tdf9zXxd2ff}u#ayoczGSc4b`{T8H*&V+ce*@!p83dQxvj^=j4#49W)3SH z`W%+&=;~H(+rC|N^O5CBy+@PIAA9`K-MPR^=k`a1$NLVd$;`6zIGIw!r|QeS=){R% z*AomX6gO}xUS4we;fIw+lV*y$I?j}>DBobP{6yXnpNUF0Y)<`>YP`DO^y$+_o_`jc zetPNAW?#2$io7!x%}`pp)Hy)9SNXINCtGt$Zf4p1&)s+P zI;QoMzxn=~Wd~Q}+OVR6f&;Tx<~5%`?4k0=RO&{A_=LugG^3f`8rQv7aNGEOjas|R ziOET{eZK7V*K@4|{`jbbim0ZYne;P!b?8@vi$VSsDLJQYzr5J3w0nXG`$Mid^W^1w zgzLUm&0TPDvfJXqL&q4oEmGunY+T0WxiR1KjKHlG>e||qqfGWTIeD6YZ2a&#(J{f~ z>+2IA4ApM+PX1YFH~;##X~!#N3+GhaXP#UUGsRa*`^r02`b>=O%(*;u|2tnvE{}IOv%S^H(c8tn>sy(; zT>b6di+?L(bi}T%b9w*r-o1M*kyaHOWAyH)b-a7eWfbF@`F6q?y(vqBI^Vp1KRIl* zYt`O)1$_LMgj;j2-t#R~&g3ln_4WG08ir-zTB6I&P4Rf7w9n1{hD&T^d3m}0;SW&{?H`7*zFZ*xM4|&e=*PLPB8ThWBbMQ&7ckj`ESrRq9W5O36mt`^a%nH(O U0^9g(ltIOvr>mdKI;Vst09tV;<^TWy literal 0 HcmV?d00001 diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 36ffa179bb..0ac8a74827 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -685,7 +685,6 @@ void Application::keyPressEvent(QKeyEvent* event) { case Qt::Key_Space: resetSensors(); - _audio.reset(); break; case Qt::Key_G: @@ -1724,6 +1723,7 @@ void Application::init() { connect(_rearMirrorTools, SIGNAL(closeView()), SLOT(closeMirrorView())); connect(_rearMirrorTools, SIGNAL(restoreView()), SLOT(restoreMirrorView())); connect(_rearMirrorTools, SIGNAL(shrinkView()), SLOT(shrinkMirrorView())); + connect(_rearMirrorTools, SIGNAL(resetView()), SLOT(resetSensors())); } void Application::closeMirrorView() { @@ -3777,6 +3777,8 @@ void Application::resetSensors() { _myTransmitter.resetLevels(); _myAvatar.setVelocity(glm::vec3(0,0,0)); _myAvatar.setThrust(glm::vec3(0,0,0)); + + _audio.reset(); } static void setShortcutsEnabled(QWidget* widget, bool enabled) { diff --git a/interface/src/Application.h b/interface/src/Application.h index 50ea7aa9e0..531ff1813b 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -201,6 +201,7 @@ private slots: void closeMirrorView(); void restoreMirrorView(); void shrinkMirrorView(); + void resetSensors(); private: void resetCamerasOnResizeGL(Camera& camera, int width, int height); @@ -241,7 +242,6 @@ private: bool maybeEditVoxelUnderCursor(); void deleteVoxelUnderCursor(); void eyedropperVoxelUnderCursor(); - void resetSensors(); void injectVoxelAddedSoundEffect(); void setMenuShortcutsEnabled(bool enabled); diff --git a/interface/src/ui/RearMirrorTools.cpp b/interface/src/ui/RearMirrorTools.cpp index cc18a40e12..302c58d8a3 100644 --- a/interface/src/ui/RearMirrorTools.cpp +++ b/interface/src/ui/RearMirrorTools.cpp @@ -15,32 +15,39 @@ const int ICON_PADDING = 5; RearMirrorTools::RearMirrorTools(QGLWidget* parent, QRect& bounds) : _parent(parent), _bounds(bounds), _windowed(false), _fullScreen(false) { switchToResourcesParentIfRequired(); _closeTextureId = _parent->bindTexture(QImage("./resources/images/close.png")); - _shrinkTextureId = _parent->bindTexture(QImage("./resources/images/close.png")); + _resetTextureId = _parent->bindTexture(QImage("./resources/images/reset.png")); }; void RearMirrorTools::render(bool fullScreen) { if (fullScreen) { _fullScreen = true; - displayIcon(_parent->geometry(), ICON_PADDING, ICON_PADDING, _shrinkTextureId); + displayIcon(_parent->geometry(), ICON_PADDING, ICON_PADDING, _closeTextureId); } else { // render rear view tools if mouse is in the bounds QPoint mousePosition = _parent->mapFromGlobal(QCursor::pos()); _windowed = _bounds.contains(mousePosition.x(), mousePosition.y()); if (_windowed) { - displayIcon(_bounds, _bounds.left() + ICON_PADDING, ICON_PADDING, _closeTextureId); + displayIcon(_bounds, _bounds.left() + ICON_PADDING, _bounds.top() + ICON_PADDING, _closeTextureId); + displayIcon(_bounds, _bounds.width() - ICON_SIZE - ICON_PADDING, _bounds.top() + ICON_PADDING, _resetTextureId); } } } bool RearMirrorTools::mousePressEvent(int x, int y) { if (_windowed) { - QRect closeIconRect = QRect(ICON_PADDING + _bounds.left(), ICON_PADDING + _bounds.top(), ICON_SIZE, ICON_SIZE); + QRect closeIconRect = QRect(_bounds.left() + ICON_PADDING, _bounds.top() + ICON_PADDING, ICON_SIZE, ICON_SIZE); if (closeIconRect.contains(x, y)) { _windowed = false; emit closeView(); return true; } + QRect resetIconRect = QRect(_bounds.width() - ICON_SIZE - ICON_PADDING, _bounds.top() + ICON_PADDING, ICON_SIZE, ICON_SIZE); + if (resetIconRect.contains(x, y)) { + emit resetView(); + return true; + } + if (_bounds.contains(x, y)) { _windowed = false; emit restoreView(); diff --git a/interface/src/ui/RearMirrorTools.h b/interface/src/ui/RearMirrorTools.h index 77c8b88f3a..b62731c8b2 100644 --- a/interface/src/ui/RearMirrorTools.h +++ b/interface/src/ui/RearMirrorTools.h @@ -23,13 +23,14 @@ public: signals: void closeView(); void shrinkView(); + void resetView(); void restoreView(); private: QGLWidget* _parent; QRect _bounds; GLuint _closeTextureId; - GLuint _shrinkTextureId; + GLuint _resetTextureId; bool _windowed; bool _fullScreen; From 905fd48e8488a492b69ce7d9b9210d19792a0658 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Mon, 28 Oct 2013 16:03:29 -0700 Subject: [PATCH 4/4] fix blinking --- libraries/voxels/src/VoxelTree.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/voxels/src/VoxelTree.cpp b/libraries/voxels/src/VoxelTree.cpp index 031d407ea0..ac14f0dc58 100644 --- a/libraries/voxels/src/VoxelTree.cpp +++ b/libraries/voxels/src/VoxelTree.cpp @@ -1234,7 +1234,7 @@ int VoxelTree::encodeTreeBitstreamRecursion(VoxelNode* node, unsigned char* outp // even if they don't in our local tree bool notMyJurisdiction = false; if (params.jurisdictionMap) { - notMyJurisdiction = (JurisdictionMap::BELOW == params.jurisdictionMap->isMyJurisdiction(node->getOctalCode(), i)); + notMyJurisdiction = (JurisdictionMap::WITHIN != params.jurisdictionMap->isMyJurisdiction(node->getOctalCode(), i)); } if (params.includeExistsBits) { // If the child is known to exist, OR, it's not my jurisdiction, then we mark the bit as existing