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
11251125 return qApp->isHMDMode() ? 1 : 0;
11261126 });
11271127 _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;
11291129 });
11301130 _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;
11321132 });
11331133 _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;
11351135 });
11361136 _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;
11381138 });
11391139 _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;
11411141 });
11421142 _applicationStateDevice->setInputVariant(STATE_SNAP_TURN, []() -> float {
11431143 return qApp->getMyAvatar()->getSnapTurn() ? 1 : 0;
@@ -1786,14 +1786,23 @@ void Application::cleanupBeforeQuit() { · 642 unmodified lines
17861786 DependencyManager::destroy<AudioClient>();
17871787 DependencyManager::destroy<AudioInjectorManager>();
17881788
1789− // shutdown render engine
1790− _main3DScene = nullptr;
1791− _renderEngine = nullptr;
1792−
17931789 qCDebug(interfaceapp) << "Application::cleanupBeforeQuit() complete";
17941790 }
17951791
17961792 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+
17971806 DependencyManager::destroy<Preferences>();
17981807
17991808 _entityClipboard->eraseAllOctreeElements();
@@ -1805,14 +1814,6 @@ Application::~Application() { · 5 unmodified lines
18051814 _octreeProcessor.terminate();
18061815 _entityEditSender.terminate();
18071816
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();
18161817
18171818 DependencyManager::destroy<AvatarManager>();
18181819 DependencyManager::destroy<AnimationCache>();
@@ -2441,7 +2442,7 @@ void Application::resizeGL() { · 622 unmodified lines
24412442 // Possible change in aspect ratio
24422443 {
24432444 QMutexLocker viewLocker(&_viewMutex);
2444− loadViewFrustum(_myCamera, _viewFrustum);
2445+ _myCamera.loadViewFrustum(_viewFrustum);
24452446 }
24462447
24472448 auto offscreenUi = DependencyManager::get<OffscreenUi>();
@@ -4532,7 +4533,7 @@ void Application::update(float deltaTime) { · 2084 unmodified lines
45324533 // to the server.
45334534 {
45344535 QMutexLocker viewLocker(&_viewMutex);
4535− loadViewFrustum(_myCamera, _viewFrustum);
4536+ _myCamera.loadViewFrustum(_viewFrustum);
45364537 }
45374538
45384539 quint64 now = usecTimestampNow();
@@ -4860,24 +4861,6 @@ QRect Application::getDesirableApplicationGeometry() const { · 321 unmodified lines
48604861 return applicationGeometry;
48614862 }
48624863
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−
48814864 glm::vec3 Application::getSunDirection() const {
48824865 // Sun direction is in fact just the location of the sun relative to the origin
48834866 auto skyStage = DependencyManager::get<SceneScriptingInterface>()->getSkyStage();
@@ -5049,7 +5032,7 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se · 165 unmodified lines
50495032 // load the view frustum
50505033 {
50515034 QMutexLocker viewLocker(&_viewMutex);
5052− loadViewFrustum(theCamera, _displayViewFrustum);
5035+ theCamera.loadViewFrustum(_displayViewFrustum);
50535036 }
50545037
50555038 // 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
50665049 transaction.resetItem(BackgroundRenderData::_item, backgroundRenderPayload);
50675050 }
50685051
5069− // Assuming nothing get's rendered through that
5052+ // Assuming nothing gets rendered through that
50705053 if (!selfAvatarOnly) {
50715054 if (DependencyManager::get<SceneScriptingInterface>()->shouldRenderEntities()) {
50725055 // render models...
@@ -5122,6 +5105,8 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se · 49 unmodified lines
51225105 QMutexLocker viewLocker(&_viewMutex);
51235106 renderArgs->setViewFrustum(_displayViewFrustum);
51245107 }
5108+ renderArgs->_cameraMode = (int8_t)theCamera.getMode(); // HACK
5109+ renderArgs->_scene = getMain3DScene();
51255110 _renderEngine->getRenderContext()->args = renderArgs;
51265111
51275112 // 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