Showing the changes to interface/src/Application.cpp (1 of 80 files). Show all
Unified · Split
| @@ -570,6 +570,16 @@ void Application::paintGL() { · 569 unmodified lines | ||
| 570 | 570 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); |
| 571 | 571 | PerformanceWarning warn(showWarnings, "Application::paintGL()"); |
| 572 | 572 | |
| 573 | + const bool glowEnabled = Menu::getInstance()->isOptionChecked(MenuOption::EnableGlowEffect); | |
| 574 | + | |
| 575 | + // Set the desired FBO texture size. If it hasn't changed, this does nothing. | |
| 576 | + // Otherwise, it must rebuild the FBOs | |
| 577 | + if (OculusManager::isConnected()) { | |
| 578 | + _textureCache.setFrameBufferSize(OculusManager::getRenderTargetSize()); | |
| 579 | + } else { | |
| 580 | + _textureCache.setFrameBufferSize(_glWidget->size()); | |
| 581 | + } | |
| 582 | + | |
| 573 | 583 | glEnable(GL_LINE_SMOOTH); |
| 574 | 584 | |
| 575 | 585 | if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON) { |
| @@ -578,28 +588,16 @@ void Application::paintGL() { · 2 unmodified lines | ||
| 578 | 588 | _myCamera.setTargetRotation(_myAvatar->getHead()->getCameraOrientation()); |
| 579 | 589 | |
| 580 | 590 | } else if (_myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) { |
| 591 | + //Note, the camera distance is set in Camera::setMode() so we dont have to do it here. | |
| 581 | 592 | _myCamera.setTightness(0.0f); // Camera is directly connected to head without smoothing |
| 582 | 593 | _myCamera.setTargetPosition(_myAvatar->getUprightHeadPosition()); |
| 583 | − _myCamera.setTargetRotation(_myAvatar->getHead()->getCameraOrientation()); | |
| 594 | + _myCamera.setTargetRotation(_myAvatar->getWorldAlignedOrientation()); | |
| 584 | 595 | |
| 585 | 596 | } else if (_myCamera.getMode() == CAMERA_MODE_MIRROR) { |
| 586 | 597 | _myCamera.setTightness(0.0f); |
| 587 | − glm::vec3 eyePosition = _myAvatar->getHead()->calculateAverageEyePosition(); | |
| 588 | − float headHeight = eyePosition.y - _myAvatar->getPosition().y; | |
| 589 | 598 | _myCamera.setDistance(MIRROR_FULLSCREEN_DISTANCE * _scaleMirror); |
| 590 | − _myCamera.setTargetPosition(_myAvatar->getPosition() + glm::vec3(0, headHeight + (_raiseMirror * _myAvatar->getScale()), 0)); | |
| 591 | 599 | _myCamera.setTargetRotation(_myAvatar->getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f))); |
| 592 | − } | |
| 593 | − | |
| 594 | − if (OculusManager::isConnected()) { | |
| 595 | − // Oculus in third person causes nausea, so only allow it if option is checked in dev menu | |
| 596 | − if (!Menu::getInstance()->isOptionChecked(MenuOption::AllowOculusCameraModeChange) || _myCamera.getMode() == CAMERA_MODE_FIRST_PERSON) { | |
| 597 | − _myCamera.setDistance(0.0f); | |
| 598 | − _myCamera.setTargetPosition(_myAvatar->getHead()->calculateAverageEyePosition()); | |
| 599 | − _myCamera.setTargetRotation(_myAvatar->getHead()->getCameraOrientation()); | |
| 600 | − } | |
| 601 | − _myCamera.setUpShift(0.0f); | |
| 602 | − _myCamera.setTightness(0.0f); // Camera is directly connected to head without smoothing | |
| 600 | + _myCamera.setTargetPosition(_myAvatar->getHead()->calculateAverageEyePosition()); | |
| 603 | 601 | } |
| 604 | 602 | |
| 605 | 603 | // Update camera position |
| @@ -634,16 +632,32 @@ void Application::paintGL() { · 28 unmodified lines | ||
| 634 | 632 | updateShadowMap(); |
| 635 | 633 | } |
| 636 | 634 | |
| 635 | + //If we aren't using the glow shader, we have to clear the color and depth buffer | |
| 636 | + if (!glowEnabled) { | |
| 637 | + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); | |
| 638 | + } | |
| 639 | + | |
| 637 | 640 | if (OculusManager::isConnected()) { |
| 638 | − OculusManager::display(whichCamera); | |
| 641 | + //When in mirror mode, use camera rotation. Otherwise, use body rotation | |
| 642 | + if (whichCamera.getMode() == CAMERA_MODE_MIRROR) { | |
| 643 | + OculusManager::display(whichCamera.getRotation(), whichCamera.getPosition(), whichCamera); | |
| 644 | + } else { | |
| 645 | + OculusManager::display(_myAvatar->getWorldAlignedOrientation(), whichCamera.getPosition(), whichCamera); | |
| 646 | + } | |
| 639 | 647 | |
| 640 | 648 | } else if (TV3DManager::isConnected()) { |
| 641 | − _glowEffect.prepare(); | |
| 649 | + if (glowEnabled) { | |
| 650 | + _glowEffect.prepare(); | |
| 651 | + } | |
| 642 | 652 | TV3DManager::display(whichCamera); |
| 643 | − _glowEffect.render(); | |
| 653 | + if (glowEnabled) { | |
| 654 | + _glowEffect.render(); | |
| 655 | + } | |
| 644 | 656 | |
| 645 | 657 | } else { |
| 646 | − _glowEffect.prepare(); | |
| 658 | + if (glowEnabled) { | |
| 659 | + _glowEffect.prepare(); | |
| 660 | + } | |
| 647 | 661 | |
| 648 | 662 | glMatrixMode(GL_MODELVIEW); |
| 649 | 663 | glPushMatrix(); |
| @@ -651,7 +665,9 @@ void Application::paintGL() { · 1 unmodified line | ||
| 651 | 665 | displaySide(whichCamera); |
| 652 | 666 | glPopMatrix(); |
| 653 | 667 | |
| 654 | − _glowEffect.render(); | |
| 668 | + if (glowEnabled) { | |
| 669 | + _glowEffect.render(); | |
| 670 | + } | |
| 655 | 671 | |
| 656 | 672 | if (Menu::getInstance()->isOptionChecked(MenuOption::Mirror)) { |
| 657 | 673 | renderRearViewMirror(_mirrorViewRect); |
| @@ -2171,7 +2187,8 @@ int Application::sendNackPackets() { · 1513 unmodified lines | ||
| 2171 | 2187 | OctreeSceneStats& stats = _octreeServerSceneStats[nodeUUID]; |
| 2172 | 2188 | |
| 2173 | 2189 | // make copy of missing sequence numbers from stats |
| 2174 | − const QSet<OCTREE_PACKET_SEQUENCE> missingSequenceNumbers = stats.getMissingSequenceNumbers(); | |
| 2190 | + const QSet<OCTREE_PACKET_SEQUENCE> missingSequenceNumbers = | |
| 2191 | + stats.getIncomingOctreeSequenceNumberStats().getMissingSet(); | |
| 2175 | 2192 | |
| 2176 | 2193 | _octreeSceneStatsLock.unlock(); |
| 2177 | 2194 | |
| @@ -3141,9 +3158,7 @@ void Application::resetSensors() { · 963 unmodified lines | ||
| 3141 | 3158 | _faceshift.reset(); |
| 3142 | 3159 | _visage.reset(); |
| 3143 | 3160 | |
| 3144 | − if (OculusManager::isConnected()) { | |
| 3145 | − OculusManager::reset(); | |
| 3146 | − } | |
| 3161 | + OculusManager::reset(); | |
| 3147 | 3162 | |
| 3148 | 3163 | _prioVR.reset(); |
| 3149 | 3164 | |
| @@ -3295,6 +3310,10 @@ void Application::nodeKilled(SharedNodePointer node) { · 145 unmodified lines | ||
| 3295 | 3310 | _particleEditSender.nodeKilled(node); |
| 3296 | 3311 | _modelEditSender.nodeKilled(node); |
| 3297 | 3312 | |
| 3313 | + if (node->getType() == NodeType::AudioMixer) { | |
| 3314 | + QMetaObject::invokeMethod(&_audio, "resetIncomingMixedAudioSequenceNumberStats"); | |
| 3315 | + } | |
| 3316 | + | |
| 3298 | 3317 | if (node->getType() == NodeType::VoxelServer) { |
| 3299 | 3318 | QUuid nodeUUID = node->getUUID(); |
| 3300 | 3319 | // see if this is the first we've heard of this node... |
| @@ -3619,6 +3638,9 @@ ScriptEngine* Application::loadScript(const QString& scriptName, bool loadScript · 318 unmodified lines | ||
| 3619 | 3638 | // when the application is about to quit, stop our script engine so it unwinds properly |
| 3620 | 3639 | connect(this, SIGNAL(aboutToQuit()), scriptEngine, SLOT(stop())); |
| 3621 | 3640 | |
| 3641 | + NodeList* nodeList = NodeList::getInstance(); | |
| 3642 | + connect(nodeList, &NodeList::nodeKilled, scriptEngine, &ScriptEngine::nodeKilled); | |
| 3643 | + | |
| 3622 | 3644 | scriptEngine->moveToThread(workerThread); |
| 3623 | 3645 | |
| 3624 | 3646 | // Starts an event loop, and emits workerThread->started() |
| @@ -3634,7 +3656,8 @@ ScriptEngine* Application::loadScript(const QString& scriptName, bool loadScript · 9 unmodified lines | ||
| 3634 | 3656 | } |
| 3635 | 3657 | |
| 3636 | 3658 | void Application::scriptFinished(const QString& scriptName) { |
| 3637 | − QHash<QString, ScriptEngine*>::iterator it = _scriptEnginesHash.find(scriptName); | |
| 3659 | + const QString& scriptURLString = QUrl(scriptName).toString(); | |
| 3660 | + QHash<QString, ScriptEngine*>::iterator it = _scriptEnginesHash.find(scriptURLString); | |
| 3638 | 3661 | if (it != _scriptEnginesHash.end()) { |
| 3639 | 3662 | _scriptEnginesHash.erase(it); |
| 3640 | 3663 | _runningScriptsWidget->scriptStopped(scriptName); |
| @@ -3656,8 +3679,9 @@ void Application::stopAllScripts(bool restart) { · 15 unmodified lines | ||
| 3656 | 3679 | } |
| 3657 | 3680 | |
| 3658 | 3681 | void Application::stopScript(const QString &scriptName) { |
| 3659 | − if (_scriptEnginesHash.contains(scriptName)) { | |
| 3660 | − _scriptEnginesHash.value(scriptName)->stop(); | |
| 3682 | + const QString& scriptURLString = QUrl(scriptName).toString(); | |
| 3683 | + if (_scriptEnginesHash.contains(scriptURLString)) { | |
| 3684 | + _scriptEnginesHash.value(scriptURLString)->stop(); | |
| 3661 | 3685 | qDebug() << "stopping script..." << scriptName; |
| 3662 | 3686 | } |
| 3663 | 3687 | } |