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 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | 570 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); |
| 571 | PerformanceWarning warn(showWarnings, "Application::paintGL()"); | 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 | glEnable(GL_LINE_SMOOTH); | 583 | glEnable(GL_LINE_SMOOTH); |
| 574 | 584 | ||
| 575 | if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON) { | 585 | if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON) { |
| @@ -578,28 +588,16 @@ void Application::paintGL() { · 2 unmodified lines | |||
| 578 | _myCamera.setTargetRotation(_myAvatar->getHead()->getCameraOrientation()); | 588 | _myCamera.setTargetRotation(_myAvatar->getHead()->getCameraOrientation()); |
| 579 | 589 | ||
| 580 | } else if (_myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) { | 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 | _myCamera.setTightness(0.0f); // Camera is directly connected to head without smoothing | 592 | _myCamera.setTightness(0.0f); // Camera is directly connected to head without smoothing |
| 582 | _myCamera.setTargetPosition(_myAvatar->getUprightHeadPosition()); | 593 | _myCamera.setTargetPosition(_myAvatar->getUprightHeadPosition()); |
| 583 | _myCamera.setTargetRotation(_myAvatar->getHead()->getCameraOrientation()); | 594 | _myCamera.setTargetRotation(_myAvatar->getWorldAlignedOrientation()); |
| 584 | 595 | ||
| 585 | } else if (_myCamera.getMode() == CAMERA_MODE_MIRROR) { | 596 | } else if (_myCamera.getMode() == CAMERA_MODE_MIRROR) { |
| 586 | _myCamera.setTightness(0.0f); | 597 | _myCamera.setTightness(0.0f); |
| 587 | glm::vec3 eyePosition = _myAvatar->getHead()->calculateAverageEyePosition(); | ||
| 588 | float headHeight = eyePosition.y - _myAvatar->getPosition().y; | ||
| 589 | _myCamera.setDistance(MIRROR_FULLSCREEN_DISTANCE * _scaleMirror); | 598 | _myCamera.setDistance(MIRROR_FULLSCREEN_DISTANCE * _scaleMirror); |
| 590 | _myCamera.setTargetPosition(_myAvatar->getPosition() + glm::vec3(0, headHeight + (_raiseMirror * _myAvatar->getScale()), 0)); | ||
| 591 | _myCamera.setTargetRotation(_myAvatar->getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f))); | 599 | _myCamera.setTargetRotation(_myAvatar->getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f))); |
| 592 | } | 600 | _myCamera.setTargetPosition(_myAvatar->getHead()->calculateAverageEyePosition()); |
| 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 | ||
| 603 | } | 601 | } |
| 604 | 602 | ||
| 605 | // Update camera position | 603 | // Update camera position |
| @@ -634,16 +632,32 @@ void Application::paintGL() { · 28 unmodified lines | |||
| 634 | updateShadowMap(); | 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 | if (OculusManager::isConnected()) { | 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 | } else if (TV3DManager::isConnected()) { | 648 | } else if (TV3DManager::isConnected()) { |
| 641 | _glowEffect.prepare(); | 649 | if (glowEnabled) { |
| 650 | _glowEffect.prepare(); | ||
| 651 | } | ||
| 642 | TV3DManager::display(whichCamera); | 652 | TV3DManager::display(whichCamera); |
| 643 | _glowEffect.render(); | 653 | if (glowEnabled) { |
| 654 | _glowEffect.render(); | ||
| 655 | } | ||
| 644 | 656 | ||
| 645 | } else { | 657 | } else { |
| 646 | _glowEffect.prepare(); | 658 | if (glowEnabled) { |
| 659 | _glowEffect.prepare(); | ||
| 660 | } | ||
| 647 | 661 | ||
| 648 | glMatrixMode(GL_MODELVIEW); | 662 | glMatrixMode(GL_MODELVIEW); |
| 649 | glPushMatrix(); | 663 | glPushMatrix(); |
| @@ -651,7 +665,9 @@ void Application::paintGL() { · 1 unmodified line | |||
| 651 | displaySide(whichCamera); | 665 | displaySide(whichCamera); |
| 652 | glPopMatrix(); | 666 | glPopMatrix(); |
| 653 | 667 | ||
| 654 | _glowEffect.render(); | 668 | if (glowEnabled) { |
| 669 | _glowEffect.render(); | ||
| 670 | } | ||
| 655 | 671 | ||
| 656 | if (Menu::getInstance()->isOptionChecked(MenuOption::Mirror)) { | 672 | if (Menu::getInstance()->isOptionChecked(MenuOption::Mirror)) { |
| 657 | renderRearViewMirror(_mirrorViewRect); | 673 | renderRearViewMirror(_mirrorViewRect); |
| @@ -2171,7 +2187,8 @@ int Application::sendNackPackets() { · 1513 unmodified lines | |||
| 2171 | OctreeSceneStats& stats = _octreeServerSceneStats[nodeUUID]; | 2187 | OctreeSceneStats& stats = _octreeServerSceneStats[nodeUUID]; |
| 2172 | 2188 | ||
| 2173 | // make copy of missing sequence numbers from stats | 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 | _octreeSceneStatsLock.unlock(); | 2193 | _octreeSceneStatsLock.unlock(); |
| 2177 | 2194 | ||
| @@ -3141,9 +3158,7 @@ void Application::resetSensors() { · 963 unmodified lines | |||
| 3141 | _faceshift.reset(); | 3158 | _faceshift.reset(); |
| 3142 | _visage.reset(); | 3159 | _visage.reset(); |
| 3143 | 3160 | ||
| 3144 | if (OculusManager::isConnected()) { | 3161 | OculusManager::reset(); |
| 3145 | OculusManager::reset(); | ||
| 3146 | } | ||
| 3147 | 3162 | ||
| 3148 | _prioVR.reset(); | 3163 | _prioVR.reset(); |
| 3149 | 3164 | ||
| @@ -3295,6 +3310,10 @@ void Application::nodeKilled(SharedNodePointer node) { · 145 unmodified lines | |||
| 3295 | _particleEditSender.nodeKilled(node); | 3310 | _particleEditSender.nodeKilled(node); |
| 3296 | _modelEditSender.nodeKilled(node); | 3311 | _modelEditSender.nodeKilled(node); |
| 3297 | 3312 | ||
| 3313 | if (node->getType() == NodeType::AudioMixer) { | ||
| 3314 | QMetaObject::invokeMethod(&_audio, "resetIncomingMixedAudioSequenceNumberStats"); | ||
| 3315 | } | ||
| 3316 | |||
| 3298 | if (node->getType() == NodeType::VoxelServer) { | 3317 | if (node->getType() == NodeType::VoxelServer) { |
| 3299 | QUuid nodeUUID = node->getUUID(); | 3318 | QUuid nodeUUID = node->getUUID(); |
| 3300 | // see if this is the first we've heard of this node... | 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 | // when the application is about to quit, stop our script engine so it unwinds properly | 3638 | // when the application is about to quit, stop our script engine so it unwinds properly |
| 3620 | connect(this, SIGNAL(aboutToQuit()), scriptEngine, SLOT(stop())); | 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 | scriptEngine->moveToThread(workerThread); | 3644 | scriptEngine->moveToThread(workerThread); |
| 3623 | 3645 | ||
| 3624 | // Starts an event loop, and emits workerThread->started() | 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 | void Application::scriptFinished(const QString& scriptName) { | 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 | if (it != _scriptEnginesHash.end()) { | 3661 | if (it != _scriptEnginesHash.end()) { |
| 3639 | _scriptEnginesHash.erase(it); | 3662 | _scriptEnginesHash.erase(it); |
| 3640 | _runningScriptsWidget->scriptStopped(scriptName); | 3663 | _runningScriptsWidget->scriptStopped(scriptName); |
| @@ -3656,8 +3679,9 @@ void Application::stopAllScripts(bool restart) { · 15 unmodified lines | |||
| 3656 | } | 3679 | } |
| 3657 | 3680 | ||
| 3658 | void Application::stopScript(const QString &scriptName) { | 3681 | void Application::stopScript(const QString &scriptName) { |
| 3659 | if (_scriptEnginesHash.contains(scriptName)) { | 3682 | const QString& scriptURLString = QUrl(scriptName).toString(); |
| 3660 | _scriptEnginesHash.value(scriptName)->stop(); | 3683 | if (_scriptEnginesHash.contains(scriptURLString)) { |
| 3684 | _scriptEnginesHash.value(scriptURLString)->stop(); | ||
| 3661 | qDebug() << "stopping script..." << scriptName; | 3685 | qDebug() << "stopping script..." << scriptName; |
| 3662 | } | 3686 | } |
| 3663 | } | 3687 | } |