remove Mini Mirror from View menu

Avatar inputs only contains the audio meter now.
This commit is contained in:
Triplelexx 2017-03-18 00:53:13 +00:00
parent 60e0eb0cf9
commit a9b1a38665
11 changed files with 41 additions and 266 deletions

View file

@ -15,12 +15,11 @@ import Qt.labs.settings 1.0
Hifi.AvatarInputs {
id: root
objectName: "AvatarInputs"
width: mirrorWidth
height: controls.height + mirror.height
width: rootWidth
height: controls.height
x: 10; y: 5
readonly property int mirrorHeight: 215
readonly property int mirrorWidth: 265
readonly property int rootWidth: 265
readonly property int iconSize: 24
readonly property int iconPadding: 5
@ -39,61 +38,15 @@ Hifi.AvatarInputs {
anchors.fill: parent
}
Item {
id: mirror
width: root.mirrorWidth
height: root.mirrorVisible ? root.mirrorHeight : 0
visible: root.mirrorVisible
anchors.left: parent.left
clip: true
Image {
id: closeMirror
visible: hover.containsMouse
width: root.iconSize
height: root.iconSize
anchors.top: parent.top
anchors.topMargin: root.iconPadding
anchors.left: parent.left
anchors.leftMargin: root.iconPadding
source: "../images/close.svg"
MouseArea {
anchors.fill: parent
onClicked: {
root.closeMirror();
}
}
}
Image {
id: zoomIn
visible: hover.containsMouse
width: root.iconSize
height: root.iconSize
anchors.bottom: parent.bottom
anchors.bottomMargin: root.iconPadding
anchors.left: parent.left
anchors.leftMargin: root.iconPadding
source: root.mirrorZoomed ? "../images/minus.svg" : "../images/plus.svg"
MouseArea {
anchors.fill: parent
onClicked: {
root.toggleZoom();
}
}
}
}
Item {
id: controls
width: root.mirrorWidth
width: root.rootWidth
height: 44
visible: root.showAudioTools
anchors.top: mirror.bottom
Rectangle {
anchors.fill: parent
color: root.mirrorVisible ? (root.audioClipping ? "red" : "#696969") : "#00000000"
color: "#00000000"
Item {
id: audioMeter

View file

@ -213,14 +213,7 @@ static const QString FBX_EXTENSION = ".fbx";
static const QString OBJ_EXTENSION = ".obj";
static const QString AVA_JSON_EXTENSION = ".ava.json";
static const int MIRROR_VIEW_TOP_PADDING = 5;
static const int MIRROR_VIEW_LEFT_PADDING = 10;
static const int MIRROR_VIEW_WIDTH = 265;
static const int MIRROR_VIEW_HEIGHT = 215;
static const float MIRROR_FULLSCREEN_DISTANCE = 0.389f;
static const float MIRROR_REARVIEW_DISTANCE = 0.722f;
static const float MIRROR_REARVIEW_BODY_DISTANCE = 2.56f;
static const float MIRROR_FIELD_OF_VIEW = 30.0f;
static const quint64 TOO_LONG_SINCE_LAST_SEND_DOWNSTREAM_AUDIO_STATS = 1 * USECS_PER_SECOND;
@ -565,7 +558,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
_entityClipboardRenderer(false, this, this),
_entityClipboard(new EntityTree()),
_lastQueriedTime(usecTimestampNow()),
_mirrorViewRect(QRect(MIRROR_VIEW_LEFT_PADDING, MIRROR_VIEW_TOP_PADDING, MIRROR_VIEW_WIDTH, MIRROR_VIEW_HEIGHT)),
_previousScriptLocation("LastScriptLocation", DESKTOP_LOCATION),
_fieldOfView("fieldOfView", DEFAULT_FIELD_OF_VIEW_DEGREES),
_hmdTabletScale("hmdTabletScale", DEFAULT_HMD_TABLET_SCALE_PERCENT),
@ -2119,21 +2111,6 @@ void Application::paintGL() {
batch.resetStages();
});
auto inputs = AvatarInputs::getInstance();
if (inputs->mirrorVisible()) {
PerformanceTimer perfTimer("Mirror");
renderArgs._renderMode = RenderArgs::MIRROR_RENDER_MODE;
renderArgs._blitFramebuffer = DependencyManager::get<FramebufferCache>()->getSelfieFramebuffer();
_mirrorViewRect.moveTo(inputs->x(), inputs->y());
renderRearViewMirror(&renderArgs, _mirrorViewRect, inputs->mirrorZoomed());
renderArgs._blitFramebuffer.reset();
renderArgs._renderMode = RenderArgs::DEFAULT_RENDER_MODE;
}
{
PerformanceTimer perfTimer("renderOverlay");
// NOTE: There is no batch associated with this renderArgs
@ -2887,49 +2864,45 @@ void Application::keyPressEvent(QKeyEvent* event) {
#endif
case Qt::Key_H:
if (isShifted) {
Menu::getInstance()->triggerOption(MenuOption::MiniMirror);
} else {
// whenever switching to/from full screen mirror from the keyboard, remember
// the state you were in before full screen mirror, and return to that.
auto previousMode = _myCamera.getMode();
if (previousMode != CAMERA_MODE_MIRROR) {
switch (previousMode) {
case CAMERA_MODE_FIRST_PERSON:
_returnFromFullScreenMirrorTo = MenuOption::FirstPerson;
break;
case CAMERA_MODE_THIRD_PERSON:
_returnFromFullScreenMirrorTo = MenuOption::ThirdPerson;
break;
// FIXME - it's not clear that these modes make sense to return to...
case CAMERA_MODE_INDEPENDENT:
_returnFromFullScreenMirrorTo = MenuOption::IndependentMode;
break;
case CAMERA_MODE_ENTITY:
_returnFromFullScreenMirrorTo = MenuOption::CameraEntityMode;
break;
default:
_returnFromFullScreenMirrorTo = MenuOption::ThirdPerson;
break;
}
}
bool isMirrorChecked = Menu::getInstance()->isOptionChecked(MenuOption::FullscreenMirror);
Menu::getInstance()->setIsOptionChecked(MenuOption::FullscreenMirror, !isMirrorChecked);
if (isMirrorChecked) {
// if we got here without coming in from a non-Full Screen mirror case, then our
// _returnFromFullScreenMirrorTo is unknown. In that case we'll go to the old
// behavior of returning to ThirdPerson
if (_returnFromFullScreenMirrorTo.isEmpty()) {
// whenever switching to/from full screen mirror from the keyboard, remember
// the state you were in before full screen mirror, and return to that.
auto previousMode = _myCamera.getMode();
if (previousMode != CAMERA_MODE_MIRROR) {
switch (previousMode) {
case CAMERA_MODE_FIRST_PERSON:
_returnFromFullScreenMirrorTo = MenuOption::FirstPerson;
break;
case CAMERA_MODE_THIRD_PERSON:
_returnFromFullScreenMirrorTo = MenuOption::ThirdPerson;
}
Menu::getInstance()->setIsOptionChecked(_returnFromFullScreenMirrorTo, true);
break;
// FIXME - it's not clear that these modes make sense to return to...
case CAMERA_MODE_INDEPENDENT:
_returnFromFullScreenMirrorTo = MenuOption::IndependentMode;
break;
case CAMERA_MODE_ENTITY:
_returnFromFullScreenMirrorTo = MenuOption::CameraEntityMode;
break;
default:
_returnFromFullScreenMirrorTo = MenuOption::ThirdPerson;
break;
}
cameraMenuChanged();
}
bool isMirrorChecked = Menu::getInstance()->isOptionChecked(MenuOption::FullscreenMirror);
Menu::getInstance()->setIsOptionChecked(MenuOption::FullscreenMirror, !isMirrorChecked);
if (isMirrorChecked) {
// if we got here without coming in from a non-Full Screen mirror case, then our
// _returnFromFullScreenMirrorTo is unknown. In that case we'll go to the old
// behavior of returning to ThirdPerson
if (_returnFromFullScreenMirrorTo.isEmpty()) {
_returnFromFullScreenMirrorTo = MenuOption::ThirdPerson;
}
Menu::getInstance()->setIsOptionChecked(_returnFromFullScreenMirrorTo, true);
}
cameraMenuChanged();
break;
case Qt::Key_P: {
if (!(isShifted || isMeta || isOption)) {
@ -3845,8 +3818,6 @@ void Application::init() {
DependencyManager::get<AvatarManager>()->init();
_myCamera.setMode(CAMERA_MODE_FIRST_PERSON);
_mirrorCamera.setMode(CAMERA_MODE_MIRROR);
_timerStart.start();
_lastTimeUpdated.start();
@ -5122,58 +5093,6 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se
activeRenderingThread = nullptr;
}
void Application::renderRearViewMirror(RenderArgs* renderArgs, const QRect& region, bool isZoomed) {
auto originalViewport = renderArgs->_viewport;
// Grab current viewport to reset it at the end
float aspect = (float)region.width() / region.height();
float fov = MIRROR_FIELD_OF_VIEW;
auto myAvatar = getMyAvatar();
// bool eyeRelativeCamera = false;
if (!isZoomed) {
_mirrorCamera.setPosition(myAvatar->getChestPosition() +
myAvatar->getOrientation() * glm::vec3(0.0f, 0.0f, -1.0f) * MIRROR_REARVIEW_BODY_DISTANCE * myAvatar->getScale());
} else { // HEAD zoom level
// FIXME note that the positioning of the camera relative to the avatar can suffer limited
// precision as the user's position moves further away from the origin. Thus at
// /1e7,1e7,1e7 (well outside the buildable volume) the mirror camera veers and sways
// wildly as you rotate your avatar because the floating point values are becoming
// larger, squeezing out the available digits of precision you have available at the
// human scale for camera positioning.
// Previously there was a hack to correct this using the mechanism of repositioning
// the avatar at the origin of the world for the purposes of rendering the mirror,
// but it resulted in failing to render the avatar's head model in the mirror view
// when in first person mode. Presumably this was because of some missed culling logic
// that was not accounted for in the hack.
// This was removed in commit 71e59cfa88c6563749594e25494102fe01db38e9 but could be further
// investigated in order to adapt the technique while fixing the head rendering issue,
// but the complexity of the hack suggests that a better approach
_mirrorCamera.setPosition(myAvatar->getDefaultEyePosition() +
myAvatar->getOrientation() * glm::vec3(0.0f, 0.0f, -1.0f) * MIRROR_REARVIEW_DISTANCE * myAvatar->getScale());
}
_mirrorCamera.setProjection(glm::perspective(glm::radians(fov), aspect, DEFAULT_NEAR_CLIP, DEFAULT_FAR_CLIP));
_mirrorCamera.setOrientation(myAvatar->getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PI, 0.0f)));
// set the bounds of rear mirror view
// the region is in device independent coordinates; must convert to device
float ratio = (float)QApplication::desktop()->windowHandle()->devicePixelRatio() * getRenderResolutionScale();
int width = region.width() * ratio;
int height = region.height() * ratio;
gpu::Vec4i viewport = gpu::Vec4i(0, 0, width, height);
renderArgs->_viewport = viewport;
// render rear mirror view
displaySide(renderArgs, _mirrorCamera, true);
renderArgs->_viewport = originalViewport;
}
void Application::resetSensors(bool andReload) {
DependencyManager::get<Faceshift>()->reset();
DependencyManager::get<DdeFaceTracker>()->reset();

View file

@ -276,8 +276,6 @@ public:
virtual void pushPostUpdateLambda(void* key, std::function<void()> func) override;
const QRect& getMirrorViewRect() const { return _mirrorViewRect; }
void updateMyAvatarLookAtPosition();
float getAvatarSimrate() const { return _avatarSimCounter.rate(); }
@ -557,8 +555,6 @@ private:
int _avatarSimsPerSecondReport {0};
quint64 _lastAvatarSimsPerSecondUpdate {0};
Camera _myCamera; // My view onto the world
Camera _mirrorCamera; // Camera for mirror view
QRect _mirrorViewRect;
Setting::Handle<QString> _previousScriptLocation;
Setting::Handle<float> _fieldOfView;

View file

@ -249,9 +249,6 @@ Menu::Menu() {
viewMenu->addSeparator();
// View > Mini Mirror
addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::MiniMirror, 0, false);
// View > Center Player In View
addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::CenterPlayerInView,
0, true, qApp, SLOT(rotationModeChanged()),

View file

@ -123,7 +123,6 @@ namespace MenuOption {
const QString LogExtraTimings = "Log Extra Timing Details";
const QString LowVelocityFilter = "Low Velocity Filter";
const QString MeshVisible = "Draw Mesh";
const QString MiniMirror = "Mini Mirror";
const QString MuteAudio = "Mute Microphone";
const QString MuteEnvironment = "Mute Environment";
const QString MuteFaceTracking = "Mute Face Tracking";

View file

@ -13,7 +13,6 @@
#include <avatar/AvatarManager.h>
#include <GLMHelpers.h>
#include <FramebufferCache.h>
#include <GLMHelpers.h>
#include <OffscreenUi.h>
#include <CursorManager.h>
@ -42,7 +41,6 @@ ApplicationOverlay::ApplicationOverlay()
_domainStatusBorder = geometryCache->allocateID();
_magnifierBorder = geometryCache->allocateID();
_qmlGeometryId = geometryCache->allocateID();
_rearViewGeometryId = geometryCache->allocateID();
}
ApplicationOverlay::~ApplicationOverlay() {
@ -51,7 +49,6 @@ ApplicationOverlay::~ApplicationOverlay() {
geometryCache->releaseID(_domainStatusBorder);
geometryCache->releaseID(_magnifierBorder);
geometryCache->releaseID(_qmlGeometryId);
geometryCache->releaseID(_rearViewGeometryId);
}
}
@ -86,7 +83,6 @@ void ApplicationOverlay::renderOverlay(RenderArgs* renderArgs) {
// Now render the overlay components together into a single texture
renderDomainConnectionStatusBorder(renderArgs); // renders the connected domain line
renderAudioScope(renderArgs); // audio scope in the very back - NOTE: this is the debug audio scope, not the VU meter
renderRearView(renderArgs); // renders the mirror view selfie
renderOverlays(renderArgs); // renders Scripts Overlay and AudioScope
renderQmlUi(renderArgs); // renders a unit quad with the QML UI texture, and the text overlays from scripts
renderStatsAndLogs(renderArgs); // currently renders nothing
@ -163,45 +159,6 @@ void ApplicationOverlay::renderOverlays(RenderArgs* renderArgs) {
qApp->getOverlays().renderHUD(renderArgs);
}
void ApplicationOverlay::renderRearViewToFbo(RenderArgs* renderArgs) {
}
void ApplicationOverlay::renderRearView(RenderArgs* renderArgs) {
if (!qApp->isHMDMode() && Menu::getInstance()->isOptionChecked(MenuOption::MiniMirror) &&
!Menu::getInstance()->isOptionChecked(MenuOption::FullscreenMirror)) {
gpu::Batch& batch = *renderArgs->_batch;
auto geometryCache = DependencyManager::get<GeometryCache>();
auto framebuffer = DependencyManager::get<FramebufferCache>();
auto selfieTexture = framebuffer->getSelfieFramebuffer()->getRenderBuffer(0);
int width = renderArgs->_viewport.z;
int height = renderArgs->_viewport.w;
mat4 legacyProjection = glm::ortho<float>(0, width, height, 0, ORTHO_NEAR_CLIP, ORTHO_FAR_CLIP);
batch.setProjectionTransform(legacyProjection);
batch.setModelTransform(Transform());
batch.resetViewTransform();
float screenRatio = ((float)qApp->getDevicePixelRatio());
float renderRatio = ((float)qApp->getRenderResolutionScale());
auto viewport = qApp->getMirrorViewRect();
glm::vec2 bottomLeft(viewport.left(), viewport.top() + viewport.height());
glm::vec2 topRight(viewport.left() + viewport.width(), viewport.top());
bottomLeft *= screenRatio;
topRight *= screenRatio;
glm::vec2 texCoordMinCorner(0.0f, 0.0f);
glm::vec2 texCoordMaxCorner(viewport.width() * renderRatio / float(selfieTexture->getWidth()), viewport.height() * renderRatio / float(selfieTexture->getHeight()));
batch.setResourceTexture(0, selfieTexture);
float alpha = DependencyManager::get<OffscreenUi>()->getDesktop()->property("unpinnedAlpha").toFloat();
geometryCache->renderQuad(batch, bottomLeft, topRight, texCoordMinCorner, texCoordMaxCorner, glm::vec4(1.0f, 1.0f, 1.0f, alpha), _rearViewGeometryId);
batch.setResourceTexture(0, renderArgs->_whiteTexture);
}
}
void ApplicationOverlay::renderStatsAndLogs(RenderArgs* renderArgs) {
// Display stats and log text onscreen

View file

@ -31,8 +31,6 @@ public:
private:
void renderStatsAndLogs(RenderArgs* renderArgs);
void renderDomainConnectionStatusBorder(RenderArgs* renderArgs);
void renderRearViewToFbo(RenderArgs* renderArgs);
void renderRearView(RenderArgs* renderArgs);
void renderQmlUi(RenderArgs* renderArgs);
void renderAudioScope(RenderArgs* renderArgs);
void renderOverlays(RenderArgs* renderArgs);
@ -51,7 +49,6 @@ private:
gpu::TexturePointer _overlayColorTexture;
gpu::FramebufferPointer _overlayFramebuffer;
int _qmlGeometryId { 0 };
int _rearViewGeometryId { 0 };
};
#endif // hifi_ApplicationOverlay_h

View file

@ -20,10 +20,6 @@ HIFI_QML_DEF(AvatarInputs)
static AvatarInputs* INSTANCE{ nullptr };
static const char SETTINGS_GROUP_NAME[] = "Rear View Tools";
static const char ZOOM_LEVEL_SETTINGS[] = "ZoomLevel";
static Setting::Handle<int> rearViewZoomLevel(QStringList() << SETTINGS_GROUP_NAME << ZOOM_LEVEL_SETTINGS, 0);
AvatarInputs* AvatarInputs::getInstance() {
if (!INSTANCE) {
@ -36,8 +32,6 @@ AvatarInputs* AvatarInputs::getInstance() {
AvatarInputs::AvatarInputs(QQuickItem* parent) : QQuickItem(parent) {
INSTANCE = this;
int zoomSetting = rearViewZoomLevel.get();
_mirrorZoomed = zoomSetting == 0;
}
#define AI_UPDATE(name, src) \
@ -62,8 +56,6 @@ void AvatarInputs::update() {
if (!Menu::getInstance()) {
return;
}
AI_UPDATE(mirrorVisible, Menu::getInstance()->isOptionChecked(MenuOption::MiniMirror) && !qApp->isHMDMode()
&& !Menu::getInstance()->isOptionChecked(MenuOption::FullscreenMirror));
AI_UPDATE(cameraEnabled, !Menu::getInstance()->isOptionChecked(MenuOption::NoFaceTracking));
AI_UPDATE(cameraMuted, Menu::getInstance()->isOptionChecked(MenuOption::MuteFaceTracking));
AI_UPDATE(isHMD, qApp->isHMDMode());
@ -122,15 +114,3 @@ void AvatarInputs::toggleAudioMute() {
void AvatarInputs::resetSensors() {
qApp->resetSensors();
}
void AvatarInputs::toggleZoom() {
_mirrorZoomed = !_mirrorZoomed;
rearViewZoomLevel.set(_mirrorZoomed ? 0 : 1);
emit mirrorZoomedChanged();
}
void AvatarInputs::closeMirror() {
if (Menu::getInstance()->isOptionChecked(MenuOption::MiniMirror)) {
Menu::getInstance()->triggerOption(MenuOption::MiniMirror);
}
}

View file

@ -28,8 +28,6 @@ class AvatarInputs : public QQuickItem {
AI_PROPERTY(bool, audioMuted, false)
AI_PROPERTY(bool, audioClipping, false)
AI_PROPERTY(float, audioLevel, 0)
AI_PROPERTY(bool, mirrorVisible, false)
AI_PROPERTY(bool, mirrorZoomed, true)
AI_PROPERTY(bool, isHMD, false)
AI_PROPERTY(bool, showAudioTools, true)
@ -44,8 +42,6 @@ signals:
void audioMutedChanged();
void audioClippingChanged();
void audioLevelChanged();
void mirrorVisibleChanged();
void mirrorZoomedChanged();
void isHMDChanged();
void showAudioToolsChanged();
@ -53,8 +49,6 @@ protected:
Q_INVOKABLE void resetSensors();
Q_INVOKABLE void toggleCameraMute();
Q_INVOKABLE void toggleAudioMute();
Q_INVOKABLE void toggleZoom();
Q_INVOKABLE void closeMirror();
private:
float _trailingAudioLoudness{ 0 };

View file

@ -21,7 +21,6 @@ void FramebufferCache::setFrameBufferSize(QSize frameBufferSize) {
//If the size changed, we need to delete our FBOs
if (_frameBufferSize != frameBufferSize) {
_frameBufferSize = frameBufferSize;
_selfieFramebuffer.reset();
{
std::unique_lock<std::mutex> lock(_mutex);
_cachedFramebuffers.clear();
@ -36,10 +35,6 @@ void FramebufferCache::createPrimaryFramebuffer() {
auto defaultSampler = gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_POINT);
_selfieFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("selfie"));
auto tex = gpu::TexturePointer(gpu::Texture::create2D(colorFormat, width * 0.5, height * 0.5, defaultSampler));
_selfieFramebuffer->setRenderBuffer(0, tex);
auto smoothSampler = gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_MIP_LINEAR);
}
@ -60,10 +55,3 @@ void FramebufferCache::releaseFramebuffer(const gpu::FramebufferPointer& framebu
_cachedFramebuffers.push_back(framebuffer);
}
}
gpu::FramebufferPointer FramebufferCache::getSelfieFramebuffer() {
if (!_selfieFramebuffer) {
createPrimaryFramebuffer();
}
return _selfieFramebuffer;
}

View file

@ -27,9 +27,6 @@ public:
void setFrameBufferSize(QSize frameBufferSize);
const QSize& getFrameBufferSize() const { return _frameBufferSize; }
/// Returns the framebuffer object used to render selfie maps;
gpu::FramebufferPointer getSelfieFramebuffer();
/// Returns a free framebuffer with a single color attachment for temp or intra-frame operations
gpu::FramebufferPointer getFramebuffer();
@ -42,8 +39,6 @@ private:
gpu::FramebufferPointer _shadowFramebuffer;
gpu::FramebufferPointer _selfieFramebuffer;
QSize _frameBufferSize{ 100, 100 };
std::mutex _mutex;