mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 04:44:11 +02:00
close button on rear mirror view
This commit is contained in:
parent
890313b8ca
commit
2fcb246923
5 changed files with 108 additions and 30 deletions
BIN
interface/resources/images/close.png
Normal file
BIN
interface/resources/images/close.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.7 KiB |
16
interface/resources/images/close.svg
Normal file
16
interface/resources/images/close.svg
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg width="36px" height="36px" viewBox="0 0 36 36" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
|
||||
<title>close</title>
|
||||
<description>Created with Sketch (http://www.bohemiancoding.com/sketch)</description>
|
||||
<defs></defs>
|
||||
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
|
||||
<g id="close" sketch:type="MSLayerGroup" transform="translate(2.000000, 2.000000)">
|
||||
<g id="close-button">
|
||||
<circle d="M14.8148148,29.6296296 C22.9968115,29.6296296 29.6296296,22.9968115 29.6296296,14.8148148 C29.6296296,6.63281812 22.9968115,0 14.8148148,0 C6.63281812,0 0,6.63281812 0,14.8148148 C0,22.9968115 6.63281812,29.6296296 14.8148148,29.6296296 Z M14.8148148,29.6296296" id="background" fill="#FFFFFF" cx="14.8148148" cy="14.8148148" r="14.8148148"></circle>
|
||||
<circle d="M15.7036966,30.8654803 C24.0773189,30.8654803 30.8654803,24.0773189 30.8654803,15.7036966 C30.8654803,7.33007426 24.0773189,0.541912889 15.7036966,0.541912889 C7.33007426,0.541912889 0.541912889,7.33007426 0.541912889,15.7036966 C0.541912889,24.0773189 7.33007426,30.8654803 15.7036966,30.8654803 Z M15.7036966,30.8654803" id="circle" stroke="#000000" stroke-width="4" cx="15.7036966" cy="15.7036966" r="15.1617837"></circle>
|
||||
<path d="M7.5368995,7.83319579 L23.5562405,23.8525368" id="topdown" stroke="#000000" stroke-width="4px" stroke-dasharray="0"></path>
|
||||
<path d="M8.14743772,23.5562661 L23.592926,8.11077784" id="botup" stroke="#000000" stroke-width="4px" stroke-dasharray="0"></path>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.7 KiB |
|
@ -69,6 +69,11 @@
|
|||
#include "ui/TextRenderer.h"
|
||||
#include "InfoView.h"
|
||||
|
||||
#include <QSvgRenderer>
|
||||
#include <QPainter>
|
||||
#include <QGLWidget>
|
||||
#include <SharedUtil.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
// Starfield information
|
||||
|
@ -85,11 +90,12 @@ const int STARTUP_JITTER_SAMPLES = PACKET_LENGTH_SAMPLES_PER_CHANNEL / 2;
|
|||
// Startup optimistically with small jitter buffer that
|
||||
// will start playback on the second received audio packet.
|
||||
|
||||
|
||||
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());
|
||||
|
@ -258,12 +264,12 @@ void Application::restoreSizeAndPosition() {
|
|||
|
||||
settings->beginGroup("Window");
|
||||
|
||||
float x = loadSetting(settings, "x", 0);
|
||||
float y = loadSetting(settings, "y", 0);
|
||||
int x = (int) loadSetting(settings, "x", 0);
|
||||
int y = (int) loadSetting(settings, "y", 0);
|
||||
_window->move(x, y);
|
||||
|
||||
int width = loadSetting(settings, "width", available.width());
|
||||
int height = loadSetting(settings, "height", available.height());
|
||||
int width = (int) loadSetting(settings, "width", available.width());
|
||||
int height = (int) loadSetting(settings, "height", available.height());
|
||||
_window->resize(width, height);
|
||||
|
||||
settings->endGroup();
|
||||
|
@ -427,7 +433,6 @@ void Application::paintGL() {
|
|||
_glowEffect.render();
|
||||
|
||||
if (Menu::getInstance()->isOptionChecked(MenuOption::Mirror)) {
|
||||
|
||||
glm::vec3 targetPosition = _myAvatar.getEyeLevelPosition();
|
||||
if (_myAvatar.getHead().getBlendFace().isActive()) {
|
||||
// make sure we're aligned to the blend face eyes
|
||||
|
@ -441,21 +446,30 @@ void Application::paintGL() {
|
|||
_mirrorCamera.setTargetRotation(_myAvatar.getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PIf, 0.0f)));
|
||||
_mirrorCamera.update(1.0f/_fps);
|
||||
|
||||
glViewport(MIRROR_VIEW_LEFT_PADDING, _glWidget->height() - MIRROR_VIEW_HEIGHT - MIRROR_VIEW_TOP_PADDING, MIRROR_VIEW_WIDTH, MIRROR_VIEW_HEIGHT);
|
||||
glScissor(MIRROR_VIEW_LEFT_PADDING, _glWidget->height() - MIRROR_VIEW_HEIGHT - MIRROR_VIEW_TOP_PADDING, MIRROR_VIEW_WIDTH, MIRROR_VIEW_HEIGHT);
|
||||
|
||||
// set the bounds of rear mirror view
|
||||
glViewport(_mirrorViewRect.x(), _glWidget->height() - _mirrorViewRect.y() - _mirrorViewRect.height(), _mirrorViewRect.width(), _mirrorViewRect.height());
|
||||
glScissor(_mirrorViewRect.x(), _glWidget->height() - _mirrorViewRect.y() - _mirrorViewRect.height(), _mirrorViewRect.width(), _mirrorViewRect.height());
|
||||
updateProjectionMatrix(_mirrorCamera);
|
||||
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
// render rear mirror view
|
||||
glPushMatrix();
|
||||
displaySide(_mirrorCamera);
|
||||
glPopMatrix();
|
||||
|
||||
// reset Viewport
|
||||
// render rear view tools if mouse is in the bounds
|
||||
QPoint mousePosition = _glWidget->mapFromGlobal(QCursor::pos());
|
||||
|
||||
qDebug("mouse pos: x = %d, y = %d\n", mousePosition.x(), mousePosition.y());
|
||||
|
||||
if (_mirrorViewRect.contains(mousePosition.x(), mousePosition.y())) {
|
||||
displayRearMirrorTools();
|
||||
}
|
||||
|
||||
// reset Viewport and projection matrix
|
||||
glViewport(0, 0, _glWidget->width(), _glWidget->height());
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
|
||||
updateProjectionMatrix();
|
||||
}
|
||||
|
||||
|
@ -481,6 +495,8 @@ void Application::resetCamerasOnResizeGL(Camera& camera, int width, int height)
|
|||
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???
|
||||
|
||||
|
@ -1024,7 +1040,7 @@ void Application::mouseMoveEvent(QMouseEvent* event) {
|
|||
if (activeWindow() == _window) {
|
||||
_mouseX = event->x();
|
||||
_mouseY = event->y();
|
||||
|
||||
|
||||
// detect drag
|
||||
glm::vec3 mouseVoxelPos(_mouseVoxel.x, _mouseVoxel.y, _mouseVoxel.z);
|
||||
if (!_justEditedVoxel && mouseVoxelPos != _lastMouseVoxelPos) {
|
||||
|
@ -1062,6 +1078,15 @@ 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 (!_palette.isActive() && (!_isHoverVoxel || _lookatTargetAvatar)) {
|
||||
_pieMenu.mousePressEvent(_mouseX, _mouseY);
|
||||
}
|
||||
|
@ -1636,11 +1661,14 @@ void Application::init() {
|
|||
_myAvatar.setPosition(START_LOCATION);
|
||||
_myCamera.setMode(CAMERA_MODE_FIRST_PERSON);
|
||||
_myCamera.setModeShiftRate(1.0f);
|
||||
_myAvatar.setDisplayingLookatVectors(false);
|
||||
_myAvatar.setDisplayingLookatVectors(false);
|
||||
|
||||
_mirrorCamera.setMode(CAMERA_MODE_MIRROR);
|
||||
_mirrorCamera.setModeShiftRate(1.0f);
|
||||
_mirrorCamera.setAspectRatio((float)MIRROR_VIEW_WIDTH / (float)MIRROR_VIEW_HEIGHT);
|
||||
_mirrorCamera.setFieldOfView(DEFAULT_FIELD_OF_VIEW_DEGREES);
|
||||
_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()) {
|
||||
|
@ -2472,15 +2500,6 @@ void Application::computeOffAxisFrustum(float& left, float& right, float& bottom
|
|||
float& far, glm::vec4& nearClipPlane, glm::vec4& farClipPlane) const {
|
||||
|
||||
_viewFrustum.computeOffAxisFrustum(left, right, bottom, top, near, far, nearClipPlane, farClipPlane);
|
||||
|
||||
/*
|
||||
// when mirrored, we must flip left and right
|
||||
if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {
|
||||
float tmp = left;
|
||||
left = -right;
|
||||
right = -tmp;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void Application::displaySide(Camera& whichCamera) {
|
||||
|
@ -2730,7 +2749,7 @@ void Application::displaySide(Camera& whichCamera) {
|
|||
}
|
||||
|
||||
// brad's frustum for debugging
|
||||
if (Menu::getInstance()->isOptionChecked(MenuOption::DisplayFrustum)) {
|
||||
if (Menu::getInstance()->isOptionChecked(MenuOption::DisplayFrustum) && whichCamera.getMode() != CAMERA_MODE_MIRROR) {
|
||||
PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings),
|
||||
"Application::displaySide() ... renderViewFrustum...");
|
||||
renderViewFrustum(_viewFrustum);
|
||||
|
@ -2962,7 +2981,7 @@ void Application::displayOverlay() {
|
|||
if (_pieMenu.isDisplayed()) {
|
||||
_pieMenu.render();
|
||||
}
|
||||
|
||||
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
|
@ -3781,3 +3800,42 @@ void* Application::networkReceive(void* args) {
|
|||
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);
|
||||
}
|
||||
|
|
|
@ -240,7 +240,9 @@ private:
|
|||
static void attachNewHeadToNode(Node *newNode);
|
||||
static void* networkReceive(void* args); // network receive thread
|
||||
|
||||
void findAxisAlignment();
|
||||
void findAxisAlignment();
|
||||
|
||||
void displayRearMirrorTools();
|
||||
|
||||
QMainWindow* _window;
|
||||
QGLWidget* _glWidget;
|
||||
|
@ -293,6 +295,8 @@ private:
|
|||
Camera _myCamera; // My view onto the world
|
||||
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;
|
||||
|
||||
Environment _environment;
|
||||
|
||||
|
|
|
@ -839,9 +839,9 @@ bool Audio::eventuallyAnalyzePing() {
|
|||
return true;
|
||||
}
|
||||
|
||||
void Audio::renderToolIcon(int screenHeigh) {
|
||||
void Audio::renderToolIcon(int screenHeight) {
|
||||
|
||||
_iconBounds = QRect(ICON_LEFT, screenHeigh - BOTTOM_PADDING, ICON_SIZE, ICON_SIZE);
|
||||
_iconBounds = QRect(ICON_LEFT, screenHeight - BOTTOM_PADDING, ICON_SIZE, ICON_SIZE);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, _micTextureId);
|
||||
|
|
Loading…
Reference in a new issue