History

Merge with master

Sam Gondelman committed 11 years ago

Commit 19ec0802 parents 778e19a 0bef506214 files · +6701 −6001Browse files

Showing the changes to interface/src/Application.cpp (1 of 214 files). Show all

Unified · Split

interface/src/Application.cpp+115−156
@@ -66,6 +66,9 @@ · 65 unmodified lines
6666 #include <EntityScriptingInterface.h>
6767 #include <ErrorDialog.h>
6868 #include <GlowEffect.h>
69+#include <gpu/Batch.h>
70+#include <gpu/Context.h>
71+#include <gpu/GLBackend.h>
6972 #include <HFActionEvent.h>
7073 #include <HFBackEvent.h>
7174 #include <InfoView.h>
@@ -83,12 +86,14 @@ · 11 unmodified lines
8386 #include <PerfStat.h>
8487 #include <PhysicsEngine.h>
8588 #include <ProgramObject.h>
89+#include <RenderDeferredTask.h>
8690 #include <ResourceCache.h>
8791 #include <SceneScriptingInterface.h>
8892 #include <ScriptCache.h>
8993 #include <SettingHandle.h>
9094 #include <SoundCache.h>
9195 #include <TextRenderer.h>
96+#include <Tooltip.h>
9297 #include <UserActivityLogger.h>
9398 #include <UUID.h>
9499 #include <VrMenu.h>
@@ -106,11 +111,9 @@ · 11 unmodified lines
106111
107112 #include "avatar/AvatarManager.h"
108113
109−#include "audio/AudioToolBox.h"
110114 #include "audio/AudioIOStatsRenderer.h"
111115 #include "audio/AudioScope.h"
112116
113−#include "devices/CameraToolBox.h"
114117 #include "devices/DdeFaceTracker.h"
115118 #include "devices/Faceshift.h"
116119 #include "devices/Leapmotion.h"
@@ -120,12 +123,6 @@ · 3 unmodified lines
120123 #include "devices/OculusManager.h"
121124 #include "devices/TV3DManager.h"
122125
123−#include "gpu/Batch.h"
124−#include "gpu/Context.h"
125−#include "gpu/GLBackend.h"
126−
127−#include "RenderDeferredTask.h"
128−
129126 #include "scripting/AccountScriptingInterface.h"
130127 #include "scripting/AudioDeviceScriptingInterface.h"
131128 #include "scripting/ClipboardScriptingInterface.h"
@@ -141,6 +138,7 @@ · 9 unmodified lines
141138 #include "SpeechRecognizer.h"
142139 #endif
143140
141+#include "ui/AvatarInputs.h"
144142 #include "ui/DataWebDialog.h"
145143 #include "ui/DialogsManager.h"
146144 #include "ui/LoginDialog.h"
@@ -281,8 +279,6 @@ bool setupEssentials(int& argc, char** argv) { · 134 unmodified lines
281279 auto animationCache = DependencyManager::set<AnimationCache>();
282280 auto ddeFaceTracker = DependencyManager::set<DdeFaceTracker>();
283281 auto modelBlender = DependencyManager::set<ModelBlender>();
284− auto audioToolBox = DependencyManager::set<AudioToolBox>();
285− auto cameraToolBox = DependencyManager::set<CameraToolBox>();
286282 auto avatarManager = DependencyManager::set<AvatarManager>();
287283 auto lodManager = DependencyManager::set<LODManager>();
288284 auto jsConsole = DependencyManager::set<StandAloneJSConsole>();
@@ -335,8 +331,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 46 unmodified lines
335331 _cursorVisible(true),
336332 _lastMouseMove(usecTimestampNow()),
337333 _lastMouseMoveWasSimulated(false),
338− _touchAvgX(0.0f),
339− _touchAvgY(0.0f),
340334 _isTouchPressed(false),
341335 _mousePressed(false),
342336 _enableProcessOctreeThread(true),
@@ -814,9 +808,9 @@ void Application::initializeGL() { · 471 unmodified lines
814808 _idleLoopStdev.reset();
815809
816810 if (_justStarted) {
817− float startupTime = (float)_applicationStartupTime.elapsed() / 1000.0;
811+ float startupTime = (float)_applicationStartupTime.elapsed() / 1000.0f;
818812 _justStarted = false;
819− qCDebug(interfaceapp, "Startup time: %4.2f seconds.", startupTime);
813+ qCDebug(interfaceapp, "Startup time: %4.2f seconds.", (double)startupTime);
820814 }
821815
822816 // update before the first render
@@ -831,6 +825,7 @@ void Application::initializeUi() { · 8 unmodified lines
831825 LoginDialog::registerType();
832826 MessageDialog::registerType();
833827 VrMenu::registerType();
828+ Tooltip::registerType();
834829 UpdateDialog::registerType();
835830
836831 auto offscreenUi = DependencyManager::get<OffscreenUi>();
@@ -844,7 +839,7 @@ void Application::initializeUi() { · 7 unmodified lines
844839 VrMenu::executeQueuedLambdas();
845840 offscreenUi->setMouseTranslator([this](const QPointF& p){
846841 if (OculusManager::isConnected()) {
847− glm::vec2 pos = _applicationOverlay.screenToOverlay(toGlm(p));
842+ glm::vec2 pos = _compositor.screenToOverlay(toGlm(p));
848843 return QPointF(pos.x, pos.y);
849844 }
850845 return QPointF(p);
@@ -877,6 +872,7 @@ void Application::paintGL() { · 26 unmodified lines
877872 OculusManager::beginFrameTiming();
878873 }
879874
875+
880876 PerformanceWarning::setSuppressShortTimings(Menu::getInstance()->isOptionChecked(MenuOption::SuppressShortTimings));
881877 bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
882878 PerformanceWarning warn(showWarnings, "Application::paintGL()");
@@ -884,6 +880,12 @@ void Application::paintGL() { · 1 unmodified line
884880
885881 {
886882 PerformanceTimer perfTimer("renderOverlay");
883+ /*
884+ gpu::Context context(new gpu::GLBackend());
885+ RenderArgs renderArgs(&context, nullptr, getViewFrustum(), lodManager->getOctreeSizeScale(),
886+ lodManager->getBoundaryLevelAdjust(), RenderArgs::DEFAULT_RENDER_MODE,
887+ RenderArgs::MONO, RenderArgs::RENDER_DEBUG_NONE);
888+ */
887889 _applicationOverlay.renderOverlay(&renderArgs);
888890 }
889891
@@ -912,13 +914,18 @@ void Application::paintGL() { · 22 unmodified lines
912914 }
913915
914916 } else if (_myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) {
915− _myCamera.setPosition(_myAvatar->getDefaultEyePosition() +
916− _myAvatar->getOrientation() * glm::vec3(0.0f, 0.0f, 1.0f) * _myAvatar->getBoomLength() * _myAvatar->getScale());
917917 if (OculusManager::isConnected()) {
918918 _myCamera.setRotation(_myAvatar->getWorldAlignedOrientation());
919919 } else {
920920 _myCamera.setRotation(_myAvatar->getHead()->getOrientation());
921921 }
922+ if (Menu::getInstance()->isOptionChecked(MenuOption::CenterPlayerInView)) {
923+ _myCamera.setPosition(_myAvatar->getDefaultEyePosition() +
924+ _myCamera.getRotation() * glm::vec3(0.0f, 0.0f, 1.0f) * _myAvatar->getBoomLength() * _myAvatar->getScale());
925+ } else {
926+ _myCamera.setPosition(_myAvatar->getDefaultEyePosition() +
927+ _myAvatar->getOrientation() * glm::vec3(0.0f, 0.0f, 1.0f) * _myAvatar->getBoomLength() * _myAvatar->getScale());
928+ }
922929
923930 } else if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {
924931 _myCamera.setRotation(_myAvatar->getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f)));
@@ -967,9 +974,7 @@ void Application::paintGL() { · 42 unmodified lines
967974 glPopMatrix();
968975
969976 renderArgs._renderMode = RenderArgs::MIRROR_RENDER_MODE;
970− if (Menu::getInstance()->isOptionChecked(MenuOption::FullscreenMirror)) {
971− _rearMirrorTools->render(&renderArgs, true, _glWidget->mapFromGlobal(QCursor::pos()));
972− } else if (Menu::getInstance()->isOptionChecked(MenuOption::Mirror)) {
977+ if (Menu::getInstance()->isOptionChecked(MenuOption::Mirror)) {
973978 renderRearViewMirror(&renderArgs, _mirrorViewRect);
974979 }
975980
@@ -977,6 +982,7 @@ void Application::paintGL() { · 1 unmodified line
977982
978983 auto finalFbo = DependencyManager::get<GlowEffect>()->render(&renderArgs);
979984
985+
980986 glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
981987 glBindFramebuffer(GL_READ_FRAMEBUFFER, gpu::GLBackend::getFramebufferID(finalFbo));
982988 glBlitFramebuffer(0, 0, _renderResolution.x, _renderResolution.y,
@@ -984,9 +990,10 @@ void Application::paintGL() { · 1 unmodified line
984990 GL_COLOR_BUFFER_BIT, GL_NEAREST);
985991 glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
986992
987− _applicationOverlay.displayOverlayTexture();
993+ _compositor.displayOverlayTexture(&renderArgs);
988994 }
989995
996+
990997 if (!OculusManager::isConnected() || OculusManager::allowSwap()) {
991998 _glWidget->swapBuffers();
992999 }
@@ -1044,27 +1051,24 @@ void Application::resizeGL() { · 51 unmodified lines
10441051 } else {
10451052 renderSize = _glWidget->getDeviceSize() * getRenderResolutionScale();
10461053 }
1047− if (_renderResolution == toGlm(renderSize)) {
1048− return;
1049− }
10501054
1051− _renderResolution = toGlm(renderSize);
1052− DependencyManager::get<TextureCache>()->setFrameBufferSize(renderSize);
1053− resetCamerasOnResizeGL(_myCamera, _renderResolution);
1055+ if (_renderResolution != toGlm(renderSize)) {
1056+ _renderResolution = toGlm(renderSize);
1057+ DependencyManager::get<TextureCache>()->setFrameBufferSize(renderSize);
1058+ resetCamerasOnResizeGL(_myCamera, _renderResolution);
10541059
1055− glViewport(0, 0, _renderResolution.x, _renderResolution.y); // shouldn't this account for the menu???
1060+ glViewport(0, 0, _renderResolution.x, _renderResolution.y); // shouldn't this account for the menu???
10561061
1057− updateProjectionMatrix();
1058− glLoadIdentity();
1062+ updateProjectionMatrix();
1063+ glLoadIdentity();
1064+ }
10591065
10601066 auto offscreenUi = DependencyManager::get<OffscreenUi>();
1061− offscreenUi->resize(_glWidget->size());
1067+
1068+ auto canvasSize = _glWidget->size();
1069+ offscreenUi->resize(canvasSize);
10621070 _glWidget->makeCurrent();
10631071
1064− // update Stats width
1065− // let's set horizontal offset to give stats some margin to mirror
1066− int horizontalOffset = MIRROR_VIEW_WIDTH + MIRROR_VIEW_LEFT_PADDING * 2;
1067− Stats::getInstance()->resetWidth(_renderResolution.x, horizontalOffset);
10681072 }
10691073
10701074 void Application::updateProjectionMatrix() {
@@ -1568,27 +1572,9 @@ void Application::mousePressEvent(QMouseEvent* event, unsigned int deviceID) { · 497 unmodified lines
15681572 _keyboardMouseDevice.mousePressEvent(event);
15691573
15701574 if (event->button() == Qt::LeftButton) {
1571− _mouseDragStartedX = getTrueMouseX();
1572− _mouseDragStartedY = getTrueMouseY();
1575+ _mouseDragStarted = getTrueMouse();
15731576 _mousePressed = true;
15741577
1575− if (mouseOnScreen()) {
1576− if (DependencyManager::get<AudioToolBox>()->mousePressEvent(getMouseX(), getMouseY())) {
1577− // stop propagation
1578− return;
1579− }
1580−
1581− if (DependencyManager::get<CameraToolBox>()->mousePressEvent(getMouseX(), getMouseY())) {
1582− // stop propagation
1583− return;
1584− }
1585−
1586− if (_rearMirrorTools->mousePressEvent(getMouseX(), getMouseY())) {
1587− // stop propagation
1588− return;
1589− }
1590− }
1591−
15921578 // nobody handled this - make it an action event on the _window object
15931579 HFActionEvent actionEvent(HFActionEvent::startType(),
15941580 computePickRay(event->x(), event->y()));
@@ -1606,16 +1592,7 @@ void Application::mouseDoublePressEvent(QMouseEvent* event, unsigned int deviceI · 11 unmodified lines
16061592 return;
16071593 }
16081594
1609− if (activeWindow() == _window) {
1610− if (event->button() == Qt::LeftButton) {
1611− if (mouseOnScreen()) {
1612− if (DependencyManager::get<CameraToolBox>()->mouseDoublePressEvent(getMouseX(), getMouseY())) {
1613− // stop propagation
1614− return;
1615− }
1616− }
1617− }
1618− }
1595+ _controllerScriptingInterface.emitMouseDoublePressEvent(event);
16191596 }
16201597
16211598 void Application::mouseReleaseEvent(QMouseEvent* event, unsigned int deviceID) {
@@ -1637,13 +1614,6 @@ void Application::mouseReleaseEvent(QMouseEvent* event, unsigned int deviceID) { · 15 unmodified lines
16371614 if (event->button() == Qt::LeftButton) {
16381615 _mousePressed = false;
16391616
1640− if (Menu::getInstance()->isOptionChecked(MenuOption::Stats) && mouseOnScreen()) {
1641− // let's set horizontal offset to give stats some margin to mirror
1642− int horizontalOffset = MIRROR_VIEW_WIDTH;
1643− Stats::getInstance()->checkClick(getMouseX(), getMouseY(),
1644− getMouseDragStartedX(), getMouseDragStartedY(), horizontalOffset);
1645− }
1646−
16471617 // fire an action end event
16481618 HFActionEvent actionEvent(HFActionEvent::endType(),
16491619 computePickRay(event->x(), event->y()));
@@ -1671,22 +1641,18 @@ void Application::touchUpdateEvent(QTouchEvent* event) { · 21 unmodified lines
16711641 bool validTouch = false;
16721642 if (activeWindow() == _window) {
16731643 const QList<QTouchEvent::TouchPoint>& tPoints = event->touchPoints();
1674− _touchAvgX = 0.0f;
1675− _touchAvgY = 0.0f;
1644+ _touchAvg = vec2();
16761645 int numTouches = tPoints.count();
16771646 if (numTouches > 1) {
16781647 for (int i = 0; i < numTouches; ++i) {
1679− _touchAvgX += tPoints[i].pos().x();
1680− _touchAvgY += tPoints[i].pos().y();
1648+ _touchAvg += toGlm(tPoints[i].pos());
16811649 }
1682− _touchAvgX /= (float)(numTouches);
1683− _touchAvgY /= (float)(numTouches);
1650+ _touchAvg /= (float)(numTouches);
16841651 validTouch = true;
16851652 }
16861653 }
16871654 if (!_isTouchPressed) {
1688− _touchDragStartedAvgX = _touchAvgX;
1689− _touchDragStartedAvgY = _touchAvgY;
1655+ _touchDragStartedAvg = _touchAvg;
16901656 }
16911657 _isTouchPressed = validTouch;
16921658 }
@@ -1722,8 +1688,7 @@ void Application::touchEndEvent(QTouchEvent* event) { · 29 unmodified lines
17221688 _keyboardMouseDevice.touchEndEvent(event);
17231689
17241690 // put any application specific touch behavior below here..
1725− _touchDragStartedAvgX = _touchAvgX;
1726− _touchDragStartedAvgY = _touchAvgY;
1691+ _touchDragStartedAvg = _touchAvg;
17271692 _isTouchPressed = false;
17281693
17291694 }
@@ -1872,9 +1837,9 @@ void Application::setFullscreen(bool fullscreen) { · 142 unmodified lines
18721837 Menu::getInstance()->getActionForOption(MenuOption::Fullscreen)->setChecked(fullscreen);
18731838 }
18741839
1875−// The following code block is useful on platforms that can have a visible
1876−// app menu in a fullscreen window. However the OSX mechanism hides the
1877−// application menu for fullscreen apps, so the check is not required.
1840+ // The following code block is useful on platforms that can have a visible
1841+ // app menu in a fullscreen window. However the OSX mechanism hides the
1842+ // application menu for fullscreen apps, so the check is not required.
18781843 #ifndef Q_OS_MAC
18791844 if (Menu::getInstance()->isOptionChecked(MenuOption::EnableVRMode)) {
18801845 if (fullscreen) {
@@ -1939,16 +1904,15 @@ void Application::setEnableVRMode(bool enableVRMode) { · 58 unmodified lines
19391904 // attempt to reconnect the Oculus manager - it's possible this was a workaround
19401905 // for the sixense crash
19411906 OculusManager::disconnect();
1942− OculusManager::connect();
1907+ OculusManager::connect(_glWidget->context()->contextHandle());
1908+ _glWidget->setFocus();
1909+ _glWidget->makeCurrent();
1910+ glClear(GL_COLOR_BUFFER_BIT);
19431911 }
19441912 OculusManager::recalibrate();
19451913 } else {
19461914 OculusManager::abandonCalibration();
1947−
1948− _mirrorCamera.setHmdPosition(glm::vec3());
1949− _mirrorCamera.setHmdRotation(glm::quat());
1950− _myCamera.setHmdPosition(glm::vec3());
1951− _myCamera.setHmdRotation(glm::quat());
1915+ OculusManager::disconnect();
19521916 }
19531917
19541918 resizeGL();
@@ -1960,44 +1924,34 @@ void Application::setLowVelocityFilter(bool lowVelocityFilter) { · 5 unmodified lines
19601924
19611925 bool Application::mouseOnScreen() const {
19621926 if (OculusManager::isConnected()) {
1963− return getMouseX() >= 0 && getMouseX() <= _glWidget->getDeviceWidth() &&
1964− getMouseY() >= 0 && getMouseY() <= _glWidget->getDeviceHeight();
1927+ ivec2 mouse = getMouse();
1928+ if (!glm::all(glm::greaterThanEqual(mouse, ivec2()))) {
1929+ return false;
1930+ }
1931+ ivec2 size = toGlm(_glWidget->getDeviceSize());
1932+ if (!glm::all(glm::lessThanEqual(mouse, size))) {
1933+ return false;
1934+ }
19651935 }
19661936 return true;
19671937 }
19681938
1969−int Application::getMouseX() const {
1970− if (OculusManager::isConnected()) {
1971− glm::vec2 pos = _applicationOverlay.screenToOverlay(glm::vec2(getTrueMouseX(), getTrueMouseY()));
1972− return pos.x;
1973− }
1974− return getTrueMouseX();
1975−}
1976−
1977−int Application::getMouseY() const {
1939+ivec2 Application::getMouse() const {
19781940 if (OculusManager::isConnected()) {
1979− glm::vec2 pos = _applicationOverlay.screenToOverlay(glm::vec2(getTrueMouseX(), getTrueMouseY()));
1980− return pos.y;
1941+ return _compositor.screenToOverlay(getTrueMouse());
19811942 }
1982− return getTrueMouseY();
1943+ return getTrueMouse();
19831944 }
19841945
1985−int Application::getMouseDragStartedX() const {
1946+ivec2 Application::getMouseDragStarted() const {
19861947 if (OculusManager::isConnected()) {
1987− glm::vec2 pos = _applicationOverlay.screenToOverlay(glm::vec2(getTrueMouseDragStartedX(),
1988− getTrueMouseDragStartedY()));
1989− return pos.x;
1948+ return _compositor.screenToOverlay(getTrueMouseDragStarted());
19901949 }
1991− return getTrueMouseDragStartedX();
1950+ return getTrueMouseDragStarted();
19921951 }
19931952
1994−int Application::getMouseDragStartedY() const {
1995− if (OculusManager::isConnected()) {
1996− glm::vec2 pos = _applicationOverlay.screenToOverlay(glm::vec2(getTrueMouseDragStartedX(),
1997− getTrueMouseDragStartedY()));
1998− return pos.y;
1999− }
2000− return getTrueMouseDragStartedY();
1953+ivec2 Application::getTrueMouseDragStarted() const {
1954+ return _mouseDragStarted;
20011955 }
20021956
20031957 FaceTracker* Application::getActiveFaceTracker() {
@@ -2179,13 +2133,6 @@ void Application::init() { · 175 unmodified lines
21792133
21802134 _mirrorCamera.setMode(CAMERA_MODE_MIRROR);
21812135
2182− OculusManager::connect();
2183− if (OculusManager::isConnected()) {
2184− QMetaObject::invokeMethod(Menu::getInstance()->getActionForOption(MenuOption::Fullscreen),
2185− "trigger",
2186− Qt::QueuedConnection);
2187− }
2188−
21892136 TV3DManager::connect();
21902137 if (TV3DManager::isConnected()) {
21912138 QMetaObject::invokeMethod(Menu::getInstance()->getActionForOption(MenuOption::Fullscreen),
@@ -2249,13 +2196,6 @@ void Application::init() { · 57 unmodified lines
22492196 _entityClipboardRenderer.setViewFrustum(getViewFrustum());
22502197 _entityClipboardRenderer.setTree(&_entityClipboard);
22512198
2252− _rearMirrorTools = new RearMirrorTools(_mirrorViewRect);
2253−
2254− connect(_rearMirrorTools, SIGNAL(closeView()), SLOT(closeMirrorView()));
2255− connect(_rearMirrorTools, SIGNAL(restoreView()), SLOT(restoreMirrorView()));
2256− connect(_rearMirrorTools, SIGNAL(shrinkView()), SLOT(shrinkMirrorView()));
2257− connect(_rearMirrorTools, SIGNAL(resetView()), SLOT(resetSensors()));
2258−
22592199 // initialize the GlowEffect with our widget
22602200 bool glow = Menu::getInstance()->isOptionChecked(MenuOption::EnableGlowEffect);
22612201 DependencyManager::get<GlowEffect>()->init(glow);
@@ -2434,6 +2374,12 @@ void Application::cameraMenuChanged() { · 172 unmodified lines
24342374 }
24352375 }
24362376
2377+void Application::rotationModeChanged() {
2378+ if (!Menu::getInstance()->isOptionChecked(MenuOption::CenterPlayerInView)) {
2379+ _myAvatar->setHeadPitch(0);
2380+ }
2381+}
2382+
24372383 void Application::updateCamera(float deltaTime) {
24382384 PerformanceTimer perfTimer("updateCamera");
24392385 bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
@@ -3155,7 +3101,7 @@ PickRay Application::computePickRay(float x, float y) const { · 715 unmodified lines
31553101 y /= size.y;
31563102 PickRay result;
31573103 if (isHMDMode()) {
3158− getApplicationOverlay().computeHmdPickRay(glm::vec2(x, y), result.origin, result.direction);
3104+ getApplicationCompositor().computeHmdPickRay(glm::vec2(x, y), result.origin, result.direction);
31593105 } else {
31603106 if (QThread::currentThread() == activeRenderingThread) {
31613107 getDisplayViewFrustum()->computePickRay(x, y, result.origin, result.direction);
@@ -3184,13 +3130,11 @@ QImage Application::renderAvatarBillboard(RenderArgs* renderArgs) { · 22 unmodified lines
31843130 renderRearViewMirror(renderArgs, QRect(0, _glWidget->getDeviceHeight() - BILLBOARD_SIZE,
31853131 BILLBOARD_SIZE, BILLBOARD_SIZE),
31863132 true);
3187−
31883133 QImage image(BILLBOARD_SIZE, BILLBOARD_SIZE, QImage::Format_ARGB32);
31893134 glReadPixels(0, 0, BILLBOARD_SIZE, BILLBOARD_SIZE, GL_BGRA, GL_UNSIGNED_BYTE, image.bits());
31903135 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
31913136
31923137 glBindFramebuffer(GL_FRAMEBUFFER, 0);
3193−
31943138 return image;
31953139 }
31963140
@@ -3386,9 +3330,8 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se · 189 unmodified lines
33863330
33873331 // flip x if in mirror mode (also requires reversing winding order for backface culling)
33883332 if (theCamera.getMode() == CAMERA_MODE_MIRROR) {
3389− glScalef(-1.0f, 1.0f, 1.0f);
3390− glFrontFace(GL_CW);
3391−
3333+ //glScalef(-1.0f, 1.0f, 1.0f);
3334+ //glFrontFace(GL_CW);
33923335 } else {
33933336 glFrontFace(GL_CCW);
33943337 }
@@ -3411,7 +3354,7 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se · 16 unmodified lines
34113354 viewTransform.setTranslation(theCamera.getPosition());
34123355 viewTransform.setRotation(rotation);
34133356 if (theCamera.getMode() == CAMERA_MODE_MIRROR) {
3414− viewTransform.setScale(Transform::Vec3(-1.0f, 1.0f, 1.0f));
3357+// viewTransform.setScale(Transform::Vec3(-1.0f, 1.0f, 1.0f));
34153358 }
34163359 if (renderArgs->_renderSide != RenderArgs::MONO) {
34173360 glm::mat4 invView = glm::inverse(_untranslatedViewMatrix);
@@ -3548,6 +3491,7 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se · 130 unmodified lines
35483491
35493492 renderContext._maxDrawnOpaqueItems = sceneInterface->getEngineMaxDrawnOpaqueItems();
35503493 renderContext._maxDrawnTransparentItems = sceneInterface->getEngineMaxDrawnTransparentItems();
3494+ renderContext._maxDrawnOverlay3DItems = sceneInterface->getEngineMaxDrawnOverlay3DItems();
35513495
35523496 renderArgs->_shouldRender = LODManager::shouldRender;
35533497
@@ -3564,7 +3508,9 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se · 10 unmodified lines
35643508
35653509 sceneInterface->setEngineFeedTransparentItems(engineRC->_numFeedTransparentItems);
35663510 sceneInterface->setEngineDrawnTransparentItems(engineRC->_numDrawnTransparentItems);
3567−
3511+
3512+ sceneInterface->setEngineFeedOverlay3DItems(engineRC->_numFeedOverlay3DItems);
3513+ sceneInterface->setEngineDrawnOverlay3DItems(engineRC->_numDrawnOverlay3DItems);
35683514 }
35693515 //Render the sixense lasers
35703516 if (Menu::getInstance()->isOptionChecked(MenuOption::SixenseLasers)) {
@@ -3672,8 +3618,8 @@ glm::vec2 Application::getScaledScreenPoint(glm::vec2 projectedPoint) { · 101 unmodified lines
36723618 // +-----------------------+
36733619 // -1,-1 1,-1
36743620
3675− glm::vec2 screenPoint((projectedPoint.x + 1.0) * horizontalScale,
3676− ((projectedPoint.y + 1.0) * -verticalScale) + _glWidget->getDeviceHeight());
3621+ glm::vec2 screenPoint((projectedPoint.x + 1.0f) * horizontalScale,
3622+ ((projectedPoint.y + 1.0f) * -verticalScale) + _glWidget->getDeviceHeight());
36773623
36783624 return screenPoint;
36793625 }
@@ -3691,7 +3637,7 @@ void Application::renderRearViewMirror(RenderArgs* renderArgs, const QRect& regi · 11 unmodified lines
36913637 _mirrorCamera.setPosition(_myAvatar->getPosition() +
36923638 _myAvatar->getOrientation() * glm::vec3(0.0f, 0.0f, -1.0f) * BILLBOARD_DISTANCE * _myAvatar->getScale());
36933639
3694− } else if (RearMirrorTools::rearViewZoomLevel.get() == BODY) {
3640+ } else if (!AvatarInputs::getInstance()->mirrorZoomed()) {
36953641 _mirrorCamera.setPosition(_myAvatar->getChestPosition() +
36963642 _myAvatar->getOrientation() * glm::vec3(0.0f, 0.0f, -1.0f) * MIRROR_REARVIEW_BODY_DISTANCE * _myAvatar->getScale());
36973643
@@ -3726,7 +3672,7 @@ void Application::renderRearViewMirror(RenderArgs* renderArgs, const QRect& regi · 28 unmodified lines
37263672 } else {
37273673 // if not rendering the billboard, the region is in device independent coordinates; must convert to device
37283674 QSize size = DependencyManager::get<TextureCache>()->getFrameBufferSize();
3729− float ratio = QApplication::desktop()->windowHandle()->devicePixelRatio() * getRenderResolutionScale();
3675+ float ratio = (float)QApplication::desktop()->windowHandle()->devicePixelRatio() * getRenderResolutionScale();
37303676 int x = region.x() * ratio, y = region.y() * ratio, width = region.width() * ratio, height = region.height() * ratio;
37313677 glViewport(x, size.height() - y - height, width, height);
37323678 glScissor(x, size.height() - y - height, width, height);
@@ -3741,10 +3687,6 @@ void Application::renderRearViewMirror(RenderArgs* renderArgs, const QRect& regi · 8 unmodified lines
37413687 displaySide(renderArgs, _mirrorCamera, true, billboard);
37423688 glPopMatrix();
37433689
3744− if (!billboard) {
3745− _rearMirrorTools->render(renderArgs, false, _glWidget->mapFromGlobal(QCursor::pos()));
3746− }
3747−
37483690 // reset Viewport and projection matrix
37493691 glViewport(viewport[0], viewport[1], viewport[2], viewport[3]);
37503692 glDisable(GL_SCISSOR_TEST);
@@ -3884,7 +3826,7 @@ void Application::nodeKilled(SharedNodePointer node) { · 133 unmodified lines
38843826 _entityServerJurisdictions.unlock();
38853827
38863828 qCDebug(interfaceapp, "model server going away...... v[%f, %f, %f, %f]",
3887− rootDetails.x, rootDetails.y, rootDetails.z, rootDetails.s);
3829+ (double)rootDetails.x, (double)rootDetails.y, (double)rootDetails.z, (double)rootDetails.s);
38883830
38893831 // Add the jurisditionDetails object to the list of "fade outs"
38903832 if (!Menu::getInstance()->isOptionChecked(MenuOption::DontFadeOnOctreeServerChanges)) {
@@ -3970,7 +3912,8 @@ int Application::parseOctreeStats(const QByteArray& packet, const SharedNodePoin · 79 unmodified lines
39703912 jurisdiction->unlock();
39713913
39723914 qCDebug(interfaceapp, "stats from new %s server... [%f, %f, %f, %f]",
3973− qPrintable(serverType), rootDetails.x, rootDetails.y, rootDetails.z, rootDetails.s);
3915+ qPrintable(serverType),
3916+ (double)rootDetails.x, (double)rootDetails.y, (double)rootDetails.z, (double)rootDetails.s);
39743917
39753918 // Add the jurisditionDetails object to the list of "fade outs"
39763919 if (!Menu::getInstance()->isOptionChecked(MenuOption::DontFadeOnOctreeServerChanges)) {
@@ -4750,11 +4693,9 @@ void Application::postLambdaEvent(std::function<void()> f) { · 773 unmodified lines
47504693 }
47514694
47524695 void Application::initPlugins() {
4753− OculusManager::init();
47544696 }
47554697
47564698 void Application::shutdownPlugins() {
4757− OculusManager::deinit();
47584699 }
47594700
47604701 glm::vec3 Application::getHeadPosition() const {
@@ -4774,12 +4715,8 @@ QSize Application::getDeviceSize() const { · 13 unmodified lines
47744715 return _glWidget->getDeviceSize();
47754716 }
47764717
4777−int Application::getTrueMouseX() const {
4778− return _glWidget->mapFromGlobal(QCursor::pos()).x();
4779−}
4780−
4781−int Application::getTrueMouseY() const {
4782− return _glWidget->mapFromGlobal(QCursor::pos()).y();
4718+ivec2 Application::getTrueMouse() const {
4719+ return toGlm(_glWidget->mapFromGlobal(QCursor::pos()));
47834720 }
47844721
47854722 bool Application::isThrottleRendering() const {
@@ -4809,3 +4746,25 @@ qreal Application::getDevicePixelRatio() { · 23 unmodified lines
48094746 return _window ? _window->windowHandle()->devicePixelRatio() : 1.0;
48104747 }
48114748
4749+mat4 Application::getEyeProjection(int eye) const {
4750+ if (isHMDMode()) {
4751+ return OculusManager::getEyeProjection(eye);
4752+ }
4753+
4754+ return _viewFrustum.getProjection();
4755+}
4756+
4757+mat4 Application::getEyePose(int eye) const {
4758+ if (isHMDMode()) {
4759+ return OculusManager::getEyePose(eye);
4760+ }
4761+
4762+ return mat4();
4763+}
4764+
4765+mat4 Application::getHeadPose() const {
4766+ if (isHMDMode()) {
4767+ return OculusManager::getHeadPose();
4768+ }
4769+ return mat4();
4770+}