Showing the changes to interface/src/Application.cpp (1 of 48 files). Show all
Unified · Split
| @@ -1125,19 +1125,19 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 1124 unmodified lines | ||
| 1125 | 1125 | return qApp->isHMDMode() ? 1 : 0; |
| 1126 | 1126 | }); |
| 1127 | 1127 | _applicationStateDevice->setInputVariant(STATE_CAMERA_FULL_SCREEN_MIRROR, []() -> float { |
| 1128 | − return qApp->getCamera()->getMode() == CAMERA_MODE_MIRROR ? 1 : 0; | |
| 1128 | + return qApp->getCamera().getMode() == CAMERA_MODE_MIRROR ? 1 : 0; | |
| 1129 | 1129 | }); |
| 1130 | 1130 | _applicationStateDevice->setInputVariant(STATE_CAMERA_FIRST_PERSON, []() -> float { |
| 1131 | − return qApp->getCamera()->getMode() == CAMERA_MODE_FIRST_PERSON ? 1 : 0; | |
| 1131 | + return qApp->getCamera().getMode() == CAMERA_MODE_FIRST_PERSON ? 1 : 0; | |
| 1132 | 1132 | }); |
| 1133 | 1133 | _applicationStateDevice->setInputVariant(STATE_CAMERA_THIRD_PERSON, []() -> float { |
| 1134 | − return qApp->getCamera()->getMode() == CAMERA_MODE_THIRD_PERSON ? 1 : 0; | |
| 1134 | + return qApp->getCamera().getMode() == CAMERA_MODE_THIRD_PERSON ? 1 : 0; | |
| 1135 | 1135 | }); |
| 1136 | 1136 | _applicationStateDevice->setInputVariant(STATE_CAMERA_ENTITY, []() -> float { |
| 1137 | − return qApp->getCamera()->getMode() == CAMERA_MODE_ENTITY ? 1 : 0; | |
| 1137 | + return qApp->getCamera().getMode() == CAMERA_MODE_ENTITY ? 1 : 0; | |
| 1138 | 1138 | }); |
| 1139 | 1139 | _applicationStateDevice->setInputVariant(STATE_CAMERA_INDEPENDENT, []() -> float { |
| 1140 | − return qApp->getCamera()->getMode() == CAMERA_MODE_INDEPENDENT ? 1 : 0; | |
| 1140 | + return qApp->getCamera().getMode() == CAMERA_MODE_INDEPENDENT ? 1 : 0; | |
| 1141 | 1141 | }); |
| 1142 | 1142 | _applicationStateDevice->setInputVariant(STATE_SNAP_TURN, []() -> float { |
| 1143 | 1143 | return qApp->getMyAvatar()->getSnapTurn() ? 1 : 0; |
| @@ -1786,14 +1786,23 @@ void Application::cleanupBeforeQuit() { · 642 unmodified lines | ||
| 1786 | 1786 | DependencyManager::destroy<AudioClient>(); |
| 1787 | 1787 | DependencyManager::destroy<AudioInjectorManager>(); |
| 1788 | 1788 | |
| 1789 | − // shutdown render engine | |
| 1790 | − _main3DScene = nullptr; | |
| 1791 | − _renderEngine = nullptr; | |
| 1792 | − | |
| 1793 | 1789 | qCDebug(interfaceapp) << "Application::cleanupBeforeQuit() complete"; |
| 1794 | 1790 | } |
| 1795 | 1791 | |
| 1796 | 1792 | Application::~Application() { |
| 1793 | + // remove avatars from physics engine | |
| 1794 | + DependencyManager::get<AvatarManager>()->clearOtherAvatars(); | |
| 1795 | + VectorOfMotionStates motionStates; | |
| 1796 | + DependencyManager::get<AvatarManager>()->getObjectsToRemoveFromPhysics(motionStates); | |
| 1797 | + _physicsEngine->removeObjects(motionStates); | |
| 1798 | + DependencyManager::get<AvatarManager>()->deleteAllAvatars(); | |
| 1799 | + | |
| 1800 | + _physicsEngine->setCharacterController(nullptr); | |
| 1801 | + | |
| 1802 | + // shutdown render engine | |
| 1803 | + _main3DScene = nullptr; | |
| 1804 | + _renderEngine = nullptr; | |
| 1805 | + | |
| 1797 | 1806 | DependencyManager::destroy<Preferences>(); |
| 1798 | 1807 | |
| 1799 | 1808 | _entityClipboard->eraseAllOctreeElements(); |
| @@ -1805,14 +1814,6 @@ Application::~Application() { · 5 unmodified lines | ||
| 1805 | 1814 | _octreeProcessor.terminate(); |
| 1806 | 1815 | _entityEditSender.terminate(); |
| 1807 | 1816 | |
| 1808 | − _physicsEngine->setCharacterController(nullptr); | |
| 1809 | − | |
| 1810 | − // remove avatars from physics engine | |
| 1811 | − DependencyManager::get<AvatarManager>()->clearOtherAvatars(); | |
| 1812 | − VectorOfMotionStates motionStates; | |
| 1813 | − DependencyManager::get<AvatarManager>()->getObjectsToRemoveFromPhysics(motionStates); | |
| 1814 | − _physicsEngine->removeObjects(motionStates); | |
| 1815 | − DependencyManager::get<AvatarManager>()->deleteAllAvatars(); | |
| 1816 | 1817 | |
| 1817 | 1818 | DependencyManager::destroy<AvatarManager>(); |
| 1818 | 1819 | DependencyManager::destroy<AnimationCache>(); |
| @@ -2441,7 +2442,7 @@ void Application::resizeGL() { · 622 unmodified lines | ||
| 2441 | 2442 | // Possible change in aspect ratio |
| 2442 | 2443 | { |
| 2443 | 2444 | QMutexLocker viewLocker(&_viewMutex); |
| 2444 | − loadViewFrustum(_myCamera, _viewFrustum); | |
| 2445 | + _myCamera.loadViewFrustum(_viewFrustum); | |
| 2445 | 2446 | } |
| 2446 | 2447 | |
| 2447 | 2448 | auto offscreenUi = DependencyManager::get<OffscreenUi>(); |
| @@ -4532,7 +4533,7 @@ void Application::update(float deltaTime) { · 2084 unmodified lines | ||
| 4532 | 4533 | // to the server. |
| 4533 | 4534 | { |
| 4534 | 4535 | QMutexLocker viewLocker(&_viewMutex); |
| 4535 | − loadViewFrustum(_myCamera, _viewFrustum); | |
| 4536 | + _myCamera.loadViewFrustum(_viewFrustum); | |
| 4536 | 4537 | } |
| 4537 | 4538 | |
| 4538 | 4539 | quint64 now = usecTimestampNow(); |
| @@ -4860,24 +4861,6 @@ QRect Application::getDesirableApplicationGeometry() const { · 321 unmodified lines | ||
| 4860 | 4861 | return applicationGeometry; |
| 4861 | 4862 | } |
| 4862 | 4863 | |
| 4863 | −///////////////////////////////////////////////////////////////////////////////////// | |
| 4864 | −// loadViewFrustum() | |
| 4865 | −// | |
| 4866 | −// Description: this will load the view frustum bounds for EITHER the head | |
| 4867 | −// or the "myCamera". | |
| 4868 | −// | |
| 4869 | −void Application::loadViewFrustum(Camera& camera, ViewFrustum& viewFrustum) { | |
| 4870 | − // We will use these below, from either the camera or head vectors calculated above | |
| 4871 | − viewFrustum.setProjection(camera.getProjection()); | |
| 4872 | − | |
| 4873 | − // Set the viewFrustum up with the correct position and orientation of the camera | |
| 4874 | − viewFrustum.setPosition(camera.getPosition()); | |
| 4875 | − viewFrustum.setOrientation(camera.getOrientation()); | |
| 4876 | − | |
| 4877 | − // Ask the ViewFrustum class to calculate our corners | |
| 4878 | − viewFrustum.calculate(); | |
| 4879 | −} | |
| 4880 | − | |
| 4881 | 4864 | glm::vec3 Application::getSunDirection() const { |
| 4882 | 4865 | // Sun direction is in fact just the location of the sun relative to the origin |
| 4883 | 4866 | auto skyStage = DependencyManager::get<SceneScriptingInterface>()->getSkyStage(); |
| @@ -5049,7 +5032,7 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se · 165 unmodified lines | ||
| 5049 | 5032 | // load the view frustum |
| 5050 | 5033 | { |
| 5051 | 5034 | QMutexLocker viewLocker(&_viewMutex); |
| 5052 | − loadViewFrustum(theCamera, _displayViewFrustum); | |
| 5035 | + theCamera.loadViewFrustum(_displayViewFrustum); | |
| 5053 | 5036 | } |
| 5054 | 5037 | |
| 5055 | 5038 | // TODO fix shadows and make them use the GPU library |
| @@ -5066,7 +5049,7 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se · 10 unmodified lines | ||
| 5066 | 5049 | transaction.resetItem(BackgroundRenderData::_item, backgroundRenderPayload); |
| 5067 | 5050 | } |
| 5068 | 5051 | |
| 5069 | − // Assuming nothing get's rendered through that | |
| 5052 | + // Assuming nothing gets rendered through that | |
| 5070 | 5053 | if (!selfAvatarOnly) { |
| 5071 | 5054 | if (DependencyManager::get<SceneScriptingInterface>()->shouldRenderEntities()) { |
| 5072 | 5055 | // render models... |
| @@ -5122,6 +5105,8 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se · 49 unmodified lines | ||
| 5122 | 5105 | QMutexLocker viewLocker(&_viewMutex); |
| 5123 | 5106 | renderArgs->setViewFrustum(_displayViewFrustum); |
| 5124 | 5107 | } |
| 5108 | + renderArgs->_cameraMode = (int8_t)theCamera.getMode(); // HACK | |
| 5109 | + renderArgs->_scene = getMain3DScene(); | |
| 5125 | 5110 | _renderEngine->getRenderContext()->args = renderArgs; |
| 5126 | 5111 | |
| 5127 | 5112 | // Before the deferred pass, let's try to use the render engine |