Showing the changes to interface/src/Application.cpp (1 of 67 files). Show all
Unified · Split
| @@ -583,6 +583,16 @@ void Application::paintGL() { · 582 unmodified lines | ||
| 583 | 583 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); |
| 584 | 584 | PerformanceWarning warn(showWarnings, "Application::paintGL()"); |
| 585 | 585 | |
| 586 | + const bool glowEnabled = Menu::getInstance()->isOptionChecked(MenuOption::EnableGlowEffect); | |
| 587 | + | |
| 588 | + // Set the desired FBO texture size. If it hasn't changed, this does nothing. | |
| 589 | + // Otherwise, it must rebuild the FBOs | |
| 590 | + if (OculusManager::isConnected()) { | |
| 591 | + _textureCache.setFrameBufferSize(OculusManager::getRenderTargetSize()); | |
| 592 | + } else { | |
| 593 | + _textureCache.setFrameBufferSize(_glWidget->size()); | |
| 594 | + } | |
| 595 | + | |
| 586 | 596 | glEnable(GL_LINE_SMOOTH); |
| 587 | 597 | |
| 588 | 598 | if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON) { |
| @@ -591,28 +601,16 @@ void Application::paintGL() { · 2 unmodified lines | ||
| 591 | 601 | _myCamera.setTargetRotation(_myAvatar->getHead()->getCameraOrientation()); |
| 592 | 602 | |
| 593 | 603 | } else if (_myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) { |
| 604 | + //Note, the camera distance is set in Camera::setMode() so we dont have to do it here. | |
| 594 | 605 | _myCamera.setTightness(0.0f); // Camera is directly connected to head without smoothing |
| 595 | 606 | _myCamera.setTargetPosition(_myAvatar->getUprightHeadPosition()); |
| 596 | − _myCamera.setTargetRotation(_myAvatar->getHead()->getCameraOrientation()); | |
| 607 | + _myCamera.setTargetRotation(_myAvatar->getWorldAlignedOrientation()); | |
| 597 | 608 | |
| 598 | 609 | } else if (_myCamera.getMode() == CAMERA_MODE_MIRROR) { |
| 599 | 610 | _myCamera.setTightness(0.0f); |
| 600 | − glm::vec3 eyePosition = _myAvatar->getHead()->calculateAverageEyePosition(); | |
| 601 | − float headHeight = eyePosition.y - _myAvatar->getPosition().y; | |
| 602 | 611 | _myCamera.setDistance(MIRROR_FULLSCREEN_DISTANCE * _scaleMirror); |
| 603 | − _myCamera.setTargetPosition(_myAvatar->getPosition() + glm::vec3(0, headHeight + (_raiseMirror * _myAvatar->getScale()), 0)); | |
| 604 | 612 | _myCamera.setTargetRotation(_myAvatar->getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f))); |
| 605 | − } | |
| 606 | − | |
| 607 | − if (OculusManager::isConnected()) { | |
| 608 | − // Oculus in third person causes nausea, so only allow it if option is checked in dev menu | |
| 609 | − if (!Menu::getInstance()->isOptionChecked(MenuOption::AllowOculusCameraModeChange) || _myCamera.getMode() == CAMERA_MODE_FIRST_PERSON) { | |
| 610 | − _myCamera.setDistance(0.0f); | |
| 611 | − _myCamera.setTargetPosition(_myAvatar->getHead()->calculateAverageEyePosition()); | |
| 612 | − _myCamera.setTargetRotation(_myAvatar->getHead()->getCameraOrientation()); | |
| 613 | − } | |
| 614 | − _myCamera.setUpShift(0.0f); | |
| 615 | − _myCamera.setTightness(0.0f); // Camera is directly connected to head without smoothing | |
| 613 | + _myCamera.setTargetPosition(_myAvatar->getHead()->calculateAverageEyePosition()); | |
| 616 | 614 | } |
| 617 | 615 | |
| 618 | 616 | // Update camera position |
| @@ -647,16 +645,32 @@ void Application::paintGL() { · 28 unmodified lines | ||
| 647 | 645 | updateShadowMap(); |
| 648 | 646 | } |
| 649 | 647 | |
| 648 | + //If we aren't using the glow shader, we have to clear the color and depth buffer | |
| 649 | + if (!glowEnabled) { | |
| 650 | + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); | |
| 651 | + } | |
| 652 | + | |
| 650 | 653 | if (OculusManager::isConnected()) { |
| 651 | − OculusManager::display(whichCamera); | |
| 654 | + //When in mirror mode, use camera rotation. Otherwise, use body rotation | |
| 655 | + if (whichCamera.getMode() == CAMERA_MODE_MIRROR) { | |
| 656 | + OculusManager::display(whichCamera.getRotation(), whichCamera.getPosition(), whichCamera); | |
| 657 | + } else { | |
| 658 | + OculusManager::display(_myAvatar->getWorldAlignedOrientation(), whichCamera.getPosition(), whichCamera); | |
| 659 | + } | |
| 652 | 660 | |
| 653 | 661 | } else if (TV3DManager::isConnected()) { |
| 654 | − _glowEffect.prepare(); | |
| 662 | + if (glowEnabled) { | |
| 663 | + _glowEffect.prepare(); | |
| 664 | + } | |
| 655 | 665 | TV3DManager::display(whichCamera); |
| 656 | − _glowEffect.render(); | |
| 666 | + if (glowEnabled) { | |
| 667 | + _glowEffect.render(); | |
| 668 | + } | |
| 657 | 669 | |
| 658 | 670 | } else { |
| 659 | − _glowEffect.prepare(); | |
| 671 | + if (glowEnabled) { | |
| 672 | + _glowEffect.prepare(); | |
| 673 | + } | |
| 660 | 674 | |
| 661 | 675 | glMatrixMode(GL_MODELVIEW); |
| 662 | 676 | glPushMatrix(); |
| @@ -664,7 +678,9 @@ void Application::paintGL() { · 1 unmodified line | ||
| 664 | 678 | displaySide(whichCamera); |
| 665 | 679 | glPopMatrix(); |
| 666 | 680 | |
| 667 | − _glowEffect.render(); | |
| 681 | + if (glowEnabled) { | |
| 682 | + _glowEffect.render(); | |
| 683 | + } | |
| 668 | 684 | |
| 669 | 685 | if (Menu::getInstance()->isOptionChecked(MenuOption::Mirror)) { |
| 670 | 686 | renderRearViewMirror(_mirrorViewRect); |
| @@ -2184,7 +2200,8 @@ int Application::sendNackPackets() { · 1513 unmodified lines | ||
| 2184 | 2200 | OctreeSceneStats& stats = _octreeServerSceneStats[nodeUUID]; |
| 2185 | 2201 | |
| 2186 | 2202 | // make copy of missing sequence numbers from stats |
| 2187 | − const QSet<OCTREE_PACKET_SEQUENCE> missingSequenceNumbers = stats.getMissingSequenceNumbers(); | |
| 2203 | + const QSet<OCTREE_PACKET_SEQUENCE> missingSequenceNumbers = | |
| 2204 | + stats.getIncomingOctreeSequenceNumberStats().getMissingSet(); | |
| 2188 | 2205 | |
| 2189 | 2206 | _octreeSceneStatsLock.unlock(); |
| 2190 | 2207 | |
| @@ -3154,9 +3171,7 @@ void Application::resetSensors() { · 963 unmodified lines | ||
| 3154 | 3171 | _faceshift.reset(); |
| 3155 | 3172 | _visage.reset(); |
| 3156 | 3173 | |
| 3157 | − if (OculusManager::isConnected()) { | |
| 3158 | − OculusManager::reset(); | |
| 3159 | − } | |
| 3174 | + OculusManager::reset(); | |
| 3160 | 3175 | |
| 3161 | 3176 | _prioVR.reset(); |
| 3162 | 3177 | |
| @@ -3308,6 +3323,10 @@ void Application::nodeKilled(SharedNodePointer node) { · 145 unmodified lines | ||
| 3308 | 3323 | _particleEditSender.nodeKilled(node); |
| 3309 | 3324 | _modelEditSender.nodeKilled(node); |
| 3310 | 3325 | |
| 3326 | + if (node->getType() == NodeType::AudioMixer) { | |
| 3327 | + QMetaObject::invokeMethod(&_audio, "resetIncomingMixedAudioSequenceNumberStats"); | |
| 3328 | + } | |
| 3329 | + | |
| 3311 | 3330 | if (node->getType() == NodeType::VoxelServer) { |
| 3312 | 3331 | QUuid nodeUUID = node->getUUID(); |
| 3313 | 3332 | // see if this is the first we've heard of this node... |
| @@ -3632,6 +3651,9 @@ ScriptEngine* Application::loadScript(const QString& scriptName, bool loadScript · 318 unmodified lines | ||
| 3632 | 3651 | // when the application is about to quit, stop our script engine so it unwinds properly |
| 3633 | 3652 | connect(this, SIGNAL(aboutToQuit()), scriptEngine, SLOT(stop())); |
| 3634 | 3653 | |
| 3654 | + NodeList* nodeList = NodeList::getInstance(); | |
| 3655 | + connect(nodeList, &NodeList::nodeKilled, scriptEngine, &ScriptEngine::nodeKilled); | |
| 3656 | + | |
| 3635 | 3657 | scriptEngine->moveToThread(workerThread); |
| 3636 | 3658 | |
| 3637 | 3659 | // Starts an event loop, and emits workerThread->started() |