History

Merge remote-tracking branch 'upstream/master' into HEAD

Brad Davis committed 9 years ago

Commit befe5832 parents aa4a8d0 58501bd177 files · +4260 −712Browse files

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

Unified · Split

interface/src/Application.cpp+32−17
@@ -1860,6 +1860,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 1859 unmodified lines
1860 DependencyManager::get<PickManager>()->setPrecisionPicking(rayPickID, value);1860 DependencyManager::get<PickManager>()->setPrecisionPicking(rayPickID, value);
1861 });1861 });
1862 1862
1863 // Preload Tablet sounds
1864 DependencyManager::get<TabletScriptingInterface>()->preloadSounds();
1865
1863 qCDebug(interfaceapp) << "Metaverse session ID is" << uuidStringWithoutCurlyBraces(accountManager->getSessionID());1866 qCDebug(interfaceapp) << "Metaverse session ID is" << uuidStringWithoutCurlyBraces(accountManager->getSessionID());
1864}1867}
1865 1868
@@ -2268,7 +2271,7 @@ void Application::initializeUi() { · 402 unmodified lines
2268 offscreenUi->setBaseUrl(QUrl::fromLocalFile(PathUtils::resourcesPath() + "/qml/"));2271 offscreenUi->setBaseUrl(QUrl::fromLocalFile(PathUtils::resourcesPath() + "/qml/"));
2269 // OffscreenUi is a subclass of OffscreenQmlSurface specifically designed to2272 // OffscreenUi is a subclass of OffscreenQmlSurface specifically designed to
2270 // support the window management and scripting proxies for VR use2273 // support the window management and scripting proxies for VR use
2271 offscreenUi->createDesktop(QString("hifi/Desktop.qml"));2274 offscreenUi->createDesktop(QString("qrc:///qml/hifi/Desktop.qml"));
2272 2275
2273 // FIXME either expose so that dialogs can set this themselves or2276 // FIXME either expose so that dialogs can set this themselves or
2274 // do better detection in the offscreen UI of what has focus2277 // do better detection in the offscreen UI of what has focus
@@ -2337,6 +2340,8 @@ void Application::initializeUi() { · 62 unmodified lines
2337 2340
2338 surfaceContext->setContextProperty("Account", AccountScriptingInterface::getInstance());2341 surfaceContext->setContextProperty("Account", AccountScriptingInterface::getInstance());
2339 surfaceContext->setContextProperty("Tablet", DependencyManager::get<TabletScriptingInterface>().data());2342 surfaceContext->setContextProperty("Tablet", DependencyManager::get<TabletScriptingInterface>().data());
2343 // Tablet inteference with Tablet.qml. Need to avoid this in QML space
2344 surfaceContext->setContextProperty("tabletInterface", DependencyManager::get<TabletScriptingInterface>().data());
2340 surfaceContext->setContextProperty("DialogsManager", _dialogsManagerScriptingInterface);2345 surfaceContext->setContextProperty("DialogsManager", _dialogsManagerScriptingInterface);
2341 surfaceContext->setContextProperty("GlobalServices", GlobalServicesScriptingInterface::getInstance());2346 surfaceContext->setContextProperty("GlobalServices", GlobalServicesScriptingInterface::getInstance());
2342 surfaceContext->setContextProperty("FaceTracker", DependencyManager::get<DdeFaceTracker>().data());2347 surfaceContext->setContextProperty("FaceTracker", DependencyManager::get<DdeFaceTracker>().data());
@@ -2405,8 +2410,8 @@ void Application::initializeUi() { · 62 unmodified lines
2405}2410}
2406 2411
2407void Application::updateCamera(RenderArgs& renderArgs) {2412void Application::updateCamera(RenderArgs& renderArgs) {
2408 PROFILE_RANGE(render, "/updateCamera");2413 PROFILE_RANGE(render, __FUNCTION__);
2409 PerformanceTimer perfTimer("CameraUpdates");2414 PerformanceTimer perfTimer("updateCamera");
2410 2415
2411 glm::vec3 boomOffset;2416 glm::vec3 boomOffset;
2412 auto myAvatar = getMyAvatar();2417 auto myAvatar = getMyAvatar();
@@ -2622,7 +2627,7 @@ void Application::resizeGL() { · 209 unmodified lines
2622}2627}
2623 2628
2624void Application::handleSandboxStatus(QNetworkReply* reply) {2629void Application::handleSandboxStatus(QNetworkReply* reply) {
2625 PROFILE_RANGE(render, "HandleSandboxStatus");2630 PROFILE_RANGE(render, __FUNCTION__);
2626 2631
2627 bool sandboxIsRunning = SandboxUtils::readStatus(reply->readAll());2632 bool sandboxIsRunning = SandboxUtils::readStatus(reply->readAll());
2628 qDebug() << "HandleSandboxStatus" << sandboxIsRunning;2633 qDebug() << "HandleSandboxStatus" << sandboxIsRunning;
@@ -4651,7 +4656,6 @@ void Application::updateDialogs(float deltaTime) const { · 2022 unmodified lines
4651static bool domainLoadingInProgress = false;4656static bool domainLoadingInProgress = false;
4652 4657
4653void Application::update(float deltaTime) {4658void Application::update(float deltaTime) {
4654
4655 PROFILE_RANGE_EX(app, __FUNCTION__, 0xffff0000, (uint64_t)_renderFrameCount + 1);4659 PROFILE_RANGE_EX(app, __FUNCTION__, 0xffff0000, (uint64_t)_renderFrameCount + 1);
4656 4660
4657 if (!_physicsEnabled) {4661 if (!_physicsEnabled) {
@@ -4846,11 +4850,11 @@ void Application::update(float deltaTime) { · 188 unmodified lines
4846 QSharedPointer<AvatarManager> avatarManager = DependencyManager::get<AvatarManager>();4850 QSharedPointer<AvatarManager> avatarManager = DependencyManager::get<AvatarManager>();
4847 4851
4848 {4852 {
4849 PROFILE_RANGE_EX(simulation_physics, "Physics", 0xffff0000, (uint64_t)getActiveDisplayPlugin()->presentCount());4853 PROFILE_RANGE(simulation_physics, "Physics");
4850 PerformanceTimer perfTimer("physics");4854 PerformanceTimer perfTimer("physics");
4851 if (_physicsEnabled) {4855 if (_physicsEnabled) {
4852 {4856 {
4853 PROFILE_RANGE_EX(simulation_physics, "UpdateStates", 0xffffff00, (uint64_t)getActiveDisplayPlugin()->presentCount());4857 PROFILE_RANGE(simulation_physics, "PreStep");
4854 4858
4855 PerformanceTimer perfTimer("updateStates)");4859 PerformanceTimer perfTimer("updateStates)");
4856 static VectorOfMotionStates motionStates;4860 static VectorOfMotionStates motionStates;
@@ -4884,14 +4888,14 @@ void Application::update(float deltaTime) { · 27 unmodified lines
4884 });4888 });
4885 }4889 }
4886 {4890 {
4887 PROFILE_RANGE_EX(simulation_physics, "StepSimulation", 0xffff8000, (uint64_t)getActiveDisplayPlugin()->presentCount());4891 PROFILE_RANGE(simulation_physics, "Step");
4888 PerformanceTimer perfTimer("stepSimulation");4892 PerformanceTimer perfTimer("stepSimulation");
4889 getEntities()->getTree()->withWriteLock([&] {4893 getEntities()->getTree()->withWriteLock([&] {
4890 _physicsEngine->stepSimulation();4894 _physicsEngine->stepSimulation();
4891 });4895 });
4892 }4896 }
4893 {4897 {
4894 PROFILE_RANGE_EX(simulation_physics, "HarvestChanges", 0xffffff00, (uint64_t)getActiveDisplayPlugin()->presentCount());4898 PROFILE_RANGE(simulation_physics, "PostStep");
4895 PerformanceTimer perfTimer("harvestChanges");4899 PerformanceTimer perfTimer("harvestChanges");
4896 if (_physicsEngine->hasOutgoingChanges()) {4900 if (_physicsEngine->hasOutgoingChanges()) {
4897 // grab the collision events BEFORE handleOutgoingChanges() because at this point4901 // grab the collision events BEFORE handleOutgoingChanges() because at this point
@@ -4899,6 +4903,7 @@ void Application::update(float deltaTime) { · 1 unmodified line
4899 auto& collisionEvents = _physicsEngine->getCollisionEvents();4903 auto& collisionEvents = _physicsEngine->getCollisionEvents();
4900 4904
4901 getEntities()->getTree()->withWriteLock([&] {4905 getEntities()->getTree()->withWriteLock([&] {
4906 PROFILE_RANGE(simulation_physics, "Harvest");
4902 PerformanceTimer perfTimer("handleOutgoingChanges");4907 PerformanceTimer perfTimer("handleOutgoingChanges");
4903 4908
4904 const VectorOfMotionStates& outgoingChanges = _physicsEngine->getChangedMotionStates();4909 const VectorOfMotionStates& outgoingChanges = _physicsEngine->getChangedMotionStates();
@@ -4911,18 +4916,25 @@ void Application::update(float deltaTime) { · 6 unmodified lines
4911 4916
4912 if (!_aboutToQuit) {4917 if (!_aboutToQuit) {
4913 // handleCollisionEvents() AFTER handleOutgoinChanges()4918 // handleCollisionEvents() AFTER handleOutgoinChanges()
4914 PerformanceTimer perfTimer("entities");4919 {
4915 avatarManager->handleCollisionEvents(collisionEvents);4920 PROFILE_RANGE(simulation_physics, "CollisionEvents");
4916 // Collision events (and their scripts) must not be handled when we're locked, above. (That would risk4921 PerformanceTimer perfTimer("entities");
4917 // deadlock.)4922 avatarManager->handleCollisionEvents(collisionEvents);
4918 _entitySimulation->handleCollisionEvents(collisionEvents);4923 // Collision events (and their scripts) must not be handled when we're locked, above. (That would risk
4924 // deadlock.)
4925 _entitySimulation->handleCollisionEvents(collisionEvents);
4926 }
4919 4927
4928 PROFILE_RANGE(simulation_physics, "UpdateEntities");
4920 // NOTE: the getEntities()->update() call below will wait for lock4929 // NOTE: the getEntities()->update() call below will wait for lock
4921 // and will simulate entity motion (the EntityTree has been given an EntitySimulation).4930 // and will simulate entity motion (the EntityTree has been given an EntitySimulation).
4922 getEntities()->update(true); // update the models...4931 getEntities()->update(true); // update the models...
4923 }4932 }
4924 4933
4925 myAvatar->harvestResultsFromPhysicsSimulation(deltaTime);4934 {
4935 PROFILE_RANGE(simulation_physics, "MyAvatar");
4936 myAvatar->harvestResultsFromPhysicsSimulation(deltaTime);
4937 }
4926 4938
4927 if (Menu::getInstance()->isOptionChecked(MenuOption::DisplayDebugTimingDetails) &&4939 if (Menu::getInstance()->isOptionChecked(MenuOption::DisplayDebugTimingDetails) &&
4928 Menu::getInstance()->isOptionChecked(MenuOption::ExpandPhysicsSimulationTiming)) {4940 Menu::getInstance()->isOptionChecked(MenuOption::ExpandPhysicsSimulationTiming)) {
@@ -4941,13 +4953,13 @@ void Application::update(float deltaTime) { · 12 unmodified lines
4941 // AvatarManager update4953 // AvatarManager update
4942 {4954 {
4943 {4955 {
4956 PROFILE_RANGE(simulation, "OtherAvatars");
4944 PerformanceTimer perfTimer("otherAvatars");4957 PerformanceTimer perfTimer("otherAvatars");
4945 PROFILE_RANGE_EX(simulation, "OtherAvatars", 0xffff00ff, (uint64_t)getActiveDisplayPlugin()->presentCount());
4946 avatarManager->updateOtherAvatars(deltaTime);4958 avatarManager->updateOtherAvatars(deltaTime);
4947 }4959 }
4948 4960
4949 {4961 {
4950 PROFILE_RANGE_EX(simulation, "MyAvatar", 0xffff00ff, (uint64_t)getActiveDisplayPlugin()->presentCount());4962 PROFILE_RANGE(simulation, "MyAvatar");
4951 PerformanceTimer perfTimer("MyAvatar");4963 PerformanceTimer perfTimer("MyAvatar");
4952 qApp->updateMyAvatarLookAtPosition();4964 qApp->updateMyAvatarLookAtPosition();
4953 avatarManager->updateMyAvatar(deltaTime);4965 avatarManager->updateMyAvatar(deltaTime);
@@ -5091,6 +5103,7 @@ void Application::update(float deltaTime) { · 137 unmodified lines
5091 }5103 }
5092 5104
5093 this->updateCamera(appRenderArgs._renderArgs);5105 this->updateCamera(appRenderArgs._renderArgs);
5106 appRenderArgs._eyeToWorld = _myCamera.getTransform();
5094 appRenderArgs._isStereo = false;5107 appRenderArgs._isStereo = false;
5095 5108
5096 {5109 {
@@ -5818,6 +5831,8 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEnginePointe · 721 unmodified lines
5818 qScriptRegisterMetaType(scriptEngine.data(), wrapperToScriptValue<TabletProxy>, wrapperFromScriptValue<TabletProxy>);5831 qScriptRegisterMetaType(scriptEngine.data(), wrapperToScriptValue<TabletProxy>, wrapperFromScriptValue<TabletProxy>);
5819 qScriptRegisterMetaType(scriptEngine.data(),5832 qScriptRegisterMetaType(scriptEngine.data(),
5820 wrapperToScriptValue<TabletButtonProxy>, wrapperFromScriptValue<TabletButtonProxy>);5833 wrapperToScriptValue<TabletButtonProxy>, wrapperFromScriptValue<TabletButtonProxy>);
5834 // Tablet inteference with Tablet.qml. Need to avoid this in QML space
5835 scriptEngine->registerGlobalObject("tabletInterface", DependencyManager::get<TabletScriptingInterface>().data());
5821 scriptEngine->registerGlobalObject("Tablet", DependencyManager::get<TabletScriptingInterface>().data());5836 scriptEngine->registerGlobalObject("Tablet", DependencyManager::get<TabletScriptingInterface>().data());
5822 5837
5823 auto toolbarScriptingInterface = DependencyManager::get<ToolbarScriptingInterface>().data();5838 auto toolbarScriptingInterface = DependencyManager::get<ToolbarScriptingInterface>().data();