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
18601860 DependencyManager::get<PickManager>()->setPrecisionPicking(rayPickID, value);
18611861 });
18621862
1863+ // Preload Tablet sounds
1864+ DependencyManager::get<TabletScriptingInterface>()->preloadSounds();
1865+
18631866 qCDebug(interfaceapp) << "Metaverse session ID is" << uuidStringWithoutCurlyBraces(accountManager->getSessionID());
18641867 }
18651868
@@ -2268,7 +2271,7 @@ void Application::initializeUi() { · 402 unmodified lines
22682271 offscreenUi->setBaseUrl(QUrl::fromLocalFile(PathUtils::resourcesPath() + "/qml/"));
22692272 // OffscreenUi is a subclass of OffscreenQmlSurface specifically designed to
22702273 // 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"));
22722275
22732276 // FIXME either expose so that dialogs can set this themselves or
22742277 // do better detection in the offscreen UI of what has focus
@@ -2337,6 +2340,8 @@ void Application::initializeUi() { · 62 unmodified lines
23372340
23382341 surfaceContext->setContextProperty("Account", AccountScriptingInterface::getInstance());
23392342 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());
23402345 surfaceContext->setContextProperty("DialogsManager", _dialogsManagerScriptingInterface);
23412346 surfaceContext->setContextProperty("GlobalServices", GlobalServicesScriptingInterface::getInstance());
23422347 surfaceContext->setContextProperty("FaceTracker", DependencyManager::get<DdeFaceTracker>().data());
@@ -2405,8 +2410,8 @@ void Application::initializeUi() { · 62 unmodified lines
24052410 }
24062411
24072412 void Application::updateCamera(RenderArgs& renderArgs) {
2408− PROFILE_RANGE(render, "/updateCamera");
2409− PerformanceTimer perfTimer("CameraUpdates");
2413+ PROFILE_RANGE(render, __FUNCTION__);
2414+ PerformanceTimer perfTimer("updateCamera");
24102415
24112416 glm::vec3 boomOffset;
24122417 auto myAvatar = getMyAvatar();
@@ -2622,7 +2627,7 @@ void Application::resizeGL() { · 209 unmodified lines
26222627 }
26232628
26242629 void Application::handleSandboxStatus(QNetworkReply* reply) {
2625− PROFILE_RANGE(render, "HandleSandboxStatus");
2630+ PROFILE_RANGE(render, __FUNCTION__);
26262631
26272632 bool sandboxIsRunning = SandboxUtils::readStatus(reply->readAll());
26282633 qDebug() << "HandleSandboxStatus" << sandboxIsRunning;
@@ -4651,7 +4656,6 @@ void Application::updateDialogs(float deltaTime) const { · 2022 unmodified lines
46514656 static bool domainLoadingInProgress = false;
46524657
46534658 void Application::update(float deltaTime) {
4654−
46554659 PROFILE_RANGE_EX(app, __FUNCTION__, 0xffff0000, (uint64_t)_renderFrameCount + 1);
46564660
46574661 if (!_physicsEnabled) {
@@ -4846,11 +4850,11 @@ void Application::update(float deltaTime) { · 188 unmodified lines
48464850 QSharedPointer<AvatarManager> avatarManager = DependencyManager::get<AvatarManager>();
48474851
48484852 {
4849− PROFILE_RANGE_EX(simulation_physics, "Physics", 0xffff0000, (uint64_t)getActiveDisplayPlugin()->presentCount());
4853+ PROFILE_RANGE(simulation_physics, "Physics");
48504854 PerformanceTimer perfTimer("physics");
48514855 if (_physicsEnabled) {
48524856 {
4853− PROFILE_RANGE_EX(simulation_physics, "UpdateStates", 0xffffff00, (uint64_t)getActiveDisplayPlugin()->presentCount());
4857+ PROFILE_RANGE(simulation_physics, "PreStep");
48544858
48554859 PerformanceTimer perfTimer("updateStates)");
48564860 static VectorOfMotionStates motionStates;
@@ -4884,14 +4888,14 @@ void Application::update(float deltaTime) { · 27 unmodified lines
48844888 });
48854889 }
48864890 {
4887− PROFILE_RANGE_EX(simulation_physics, "StepSimulation", 0xffff8000, (uint64_t)getActiveDisplayPlugin()->presentCount());
4891+ PROFILE_RANGE(simulation_physics, "Step");
48884892 PerformanceTimer perfTimer("stepSimulation");
48894893 getEntities()->getTree()->withWriteLock([&] {
48904894 _physicsEngine->stepSimulation();
48914895 });
48924896 }
48934897 {
4894− PROFILE_RANGE_EX(simulation_physics, "HarvestChanges", 0xffffff00, (uint64_t)getActiveDisplayPlugin()->presentCount());
4898+ PROFILE_RANGE(simulation_physics, "PostStep");
48954899 PerformanceTimer perfTimer("harvestChanges");
48964900 if (_physicsEngine->hasOutgoingChanges()) {
48974901 // grab the collision events BEFORE handleOutgoingChanges() because at this point
@@ -4899,6 +4903,7 @@ void Application::update(float deltaTime) { · 1 unmodified line
48994903 auto& collisionEvents = _physicsEngine->getCollisionEvents();
49004904
49014905 getEntities()->getTree()->withWriteLock([&] {
4906+ PROFILE_RANGE(simulation_physics, "Harvest");
49024907 PerformanceTimer perfTimer("handleOutgoingChanges");
49034908
49044909 const VectorOfMotionStates& outgoingChanges = _physicsEngine->getChangedMotionStates();
@@ -4911,18 +4916,25 @@ void Application::update(float deltaTime) { · 6 unmodified lines
49114916
49124917 if (!_aboutToQuit) {
49134918 // handleCollisionEvents() AFTER handleOutgoinChanges()
4914− PerformanceTimer perfTimer("entities");
4915− avatarManager->handleCollisionEvents(collisionEvents);
4916− // Collision events (and their scripts) must not be handled when we're locked, above. (That would risk
4917− // deadlock.)
4918− _entitySimulation->handleCollisionEvents(collisionEvents);
4919+ {
4920+ PROFILE_RANGE(simulation_physics, "CollisionEvents");
4921+ PerformanceTimer perfTimer("entities");
4922+ avatarManager->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+ }
49194927
4928+ PROFILE_RANGE(simulation_physics, "UpdateEntities");
49204929 // NOTE: the getEntities()->update() call below will wait for lock
49214930 // and will simulate entity motion (the EntityTree has been given an EntitySimulation).
49224931 getEntities()->update(true); // update the models...
49234932 }
49244933
4925− myAvatar->harvestResultsFromPhysicsSimulation(deltaTime);
4934+ {
4935+ PROFILE_RANGE(simulation_physics, "MyAvatar");
4936+ myAvatar->harvestResultsFromPhysicsSimulation(deltaTime);
4937+ }
49264938
49274939 if (Menu::getInstance()->isOptionChecked(MenuOption::DisplayDebugTimingDetails) &&
49284940 Menu::getInstance()->isOptionChecked(MenuOption::ExpandPhysicsSimulationTiming)) {
@@ -4941,13 +4953,13 @@ void Application::update(float deltaTime) { · 12 unmodified lines
49414953 // AvatarManager update
49424954 {
49434955 {
4956+ PROFILE_RANGE(simulation, "OtherAvatars");
49444957 PerformanceTimer perfTimer("otherAvatars");
4945− PROFILE_RANGE_EX(simulation, "OtherAvatars", 0xffff00ff, (uint64_t)getActiveDisplayPlugin()->presentCount());
49464958 avatarManager->updateOtherAvatars(deltaTime);
49474959 }
49484960
49494961 {
4950− PROFILE_RANGE_EX(simulation, "MyAvatar", 0xffff00ff, (uint64_t)getActiveDisplayPlugin()->presentCount());
4962+ PROFILE_RANGE(simulation, "MyAvatar");
49514963 PerformanceTimer perfTimer("MyAvatar");
49524964 qApp->updateMyAvatarLookAtPosition();
49534965 avatarManager->updateMyAvatar(deltaTime);
@@ -5091,6 +5103,7 @@ void Application::update(float deltaTime) { · 137 unmodified lines
50915103 }
50925104
50935105 this->updateCamera(appRenderArgs._renderArgs);
5106+ appRenderArgs._eyeToWorld = _myCamera.getTransform();
50945107 appRenderArgs._isStereo = false;
50955108
50965109 {
@@ -5818,6 +5831,8 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEnginePointe · 721 unmodified lines
58185831 qScriptRegisterMetaType(scriptEngine.data(), wrapperToScriptValue<TabletProxy>, wrapperFromScriptValue<TabletProxy>);
58195832 qScriptRegisterMetaType(scriptEngine.data(),
58205833 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());
58215836 scriptEngine->registerGlobalObject("Tablet", DependencyManager::get<TabletScriptingInterface>().data());
58225837
58235838 auto toolbarScriptingInterface = DependencyManager::get<ToolbarScriptingInterface>().data();