History

Merge branch 'master' of github.com:highfidelity/hifi into input-recorder

Dante Ruiz committed 9 years ago

Commit d4c8d062 parents 07f674e 788849e48 files · +1068 −900Browse files

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

Unified · Split

interface/src/Application.cpp+24−39
@@ -1125,19 +1125,19 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 1124 unmodified lines
1125 return qApp->isHMDMode() ? 1 : 0;1125 return qApp->isHMDMode() ? 1 : 0;
1126 });1126 });
1127 _applicationStateDevice->setInputVariant(STATE_CAMERA_FULL_SCREEN_MIRROR, []() -> float {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 _applicationStateDevice->setInputVariant(STATE_CAMERA_FIRST_PERSON, []() -> float {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 _applicationStateDevice->setInputVariant(STATE_CAMERA_THIRD_PERSON, []() -> float {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 _applicationStateDevice->setInputVariant(STATE_CAMERA_ENTITY, []() -> float {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 _applicationStateDevice->setInputVariant(STATE_CAMERA_INDEPENDENT, []() -> float {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 _applicationStateDevice->setInputVariant(STATE_SNAP_TURN, []() -> float {1142 _applicationStateDevice->setInputVariant(STATE_SNAP_TURN, []() -> float {
1143 return qApp->getMyAvatar()->getSnapTurn() ? 1 : 0;1143 return qApp->getMyAvatar()->getSnapTurn() ? 1 : 0;
@@ -1786,14 +1786,23 @@ void Application::cleanupBeforeQuit() { · 642 unmodified lines
1786 DependencyManager::destroy<AudioClient>();1786 DependencyManager::destroy<AudioClient>();
1787 DependencyManager::destroy<AudioInjectorManager>();1787 DependencyManager::destroy<AudioInjectorManager>();
1788 1788
1789 // shutdown render engine
1790 _main3DScene = nullptr;
1791 _renderEngine = nullptr;
1792
1793 qCDebug(interfaceapp) << "Application::cleanupBeforeQuit() complete";1789 qCDebug(interfaceapp) << "Application::cleanupBeforeQuit() complete";
1794}1790}
1795 1791
1796Application::~Application() {1792Application::~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 DependencyManager::destroy<Preferences>();1806 DependencyManager::destroy<Preferences>();
1798 1807
1799 _entityClipboard->eraseAllOctreeElements();1808 _entityClipboard->eraseAllOctreeElements();
@@ -1805,14 +1814,6 @@ Application::~Application() { · 5 unmodified lines
1805 _octreeProcessor.terminate();1814 _octreeProcessor.terminate();
1806 _entityEditSender.terminate();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 DependencyManager::destroy<AvatarManager>();1818 DependencyManager::destroy<AvatarManager>();
1818 DependencyManager::destroy<AnimationCache>();1819 DependencyManager::destroy<AnimationCache>();
@@ -2441,7 +2442,7 @@ void Application::resizeGL() { · 622 unmodified lines
2441 // Possible change in aspect ratio2442 // Possible change in aspect ratio
2442 {2443 {
2443 QMutexLocker viewLocker(&_viewMutex);2444 QMutexLocker viewLocker(&_viewMutex);
2444 loadViewFrustum(_myCamera, _viewFrustum);2445 _myCamera.loadViewFrustum(_viewFrustum);
2445 }2446 }
2446 2447
2447 auto offscreenUi = DependencyManager::get<OffscreenUi>();2448 auto offscreenUi = DependencyManager::get<OffscreenUi>();
@@ -4532,7 +4533,7 @@ void Application::update(float deltaTime) { · 2084 unmodified lines
4532 // to the server.4533 // to the server.
4533 {4534 {
4534 QMutexLocker viewLocker(&_viewMutex);4535 QMutexLocker viewLocker(&_viewMutex);
4535 loadViewFrustum(_myCamera, _viewFrustum);4536 _myCamera.loadViewFrustum(_viewFrustum);
4536 }4537 }
4537 4538
4538 quint64 now = usecTimestampNow();4539 quint64 now = usecTimestampNow();
@@ -4860,24 +4861,6 @@ QRect Application::getDesirableApplicationGeometry() const { · 321 unmodified lines
4860 return applicationGeometry;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//
4869void 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
4881glm::vec3 Application::getSunDirection() const {4864glm::vec3 Application::getSunDirection() const {
4882 // Sun direction is in fact just the location of the sun relative to the origin4865 // Sun direction is in fact just the location of the sun relative to the origin
4883 auto skyStage = DependencyManager::get<SceneScriptingInterface>()->getSkyStage();4866 auto skyStage = DependencyManager::get<SceneScriptingInterface>()->getSkyStage();
@@ -5049,7 +5032,7 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se · 165 unmodified lines
5049 // load the view frustum5032 // load the view frustum
5050 {5033 {
5051 QMutexLocker viewLocker(&_viewMutex);5034 QMutexLocker viewLocker(&_viewMutex);
5052 loadViewFrustum(theCamera, _displayViewFrustum);5035 theCamera.loadViewFrustum(_displayViewFrustum);
5053 }5036 }
5054 5037
5055 // TODO fix shadows and make them use the GPU library5038 // 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 transaction.resetItem(BackgroundRenderData::_item, backgroundRenderPayload);5049 transaction.resetItem(BackgroundRenderData::_item, backgroundRenderPayload);
5067 }5050 }
5068 5051
5069 // Assuming nothing get's rendered through that5052 // Assuming nothing gets rendered through that
5070 if (!selfAvatarOnly) {5053 if (!selfAvatarOnly) {
5071 if (DependencyManager::get<SceneScriptingInterface>()->shouldRenderEntities()) {5054 if (DependencyManager::get<SceneScriptingInterface>()->shouldRenderEntities()) {
5072 // render models...5055 // render models...
@@ -5122,6 +5105,8 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se · 49 unmodified lines
5122 QMutexLocker viewLocker(&_viewMutex);5105 QMutexLocker viewLocker(&_viewMutex);
5123 renderArgs->setViewFrustum(_displayViewFrustum);5106 renderArgs->setViewFrustum(_displayViewFrustum);
5124 }5107 }
5108 renderArgs->_cameraMode = (int8_t)theCamera.getMode(); // HACK
5109 renderArgs->_scene = getMain3DScene();
5125 _renderEngine->getRenderContext()->args = renderArgs;5110 _renderEngine->getRenderContext()->args = renderArgs;
5126 5111
5127 // Before the deferred pass, let's try to use the render engine5112 // Before the deferred pass, let's try to use the render engine

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t