Showing the changes to interface/src/Application.cpp (1 of 100 files). Show all
Unified · Split
| @@ -63,6 +63,7 @@ · 62 unmodified lines | |||
| 63 | #include <AddressManager.h> | 63 | #include <AddressManager.h> |
| 64 | #include <AnimDebugDraw.h> | 64 | #include <AnimDebugDraw.h> |
| 65 | #include <BuildInfo.h> | 65 | #include <BuildInfo.h> |
| 66 | #include <AnimationCacheScriptingInterface.h> | ||
| 66 | #include <AssetClient.h> | 67 | #include <AssetClient.h> |
| 67 | #include <AssetUpload.h> | 68 | #include <AssetUpload.h> |
| 68 | #include <AutoUpdater.h> | 69 | #include <AutoUpdater.h> |
| @@ -98,6 +99,8 @@ · 29 unmodified lines | |||
| 98 | #include <MainWindow.h> | 99 | #include <MainWindow.h> |
| 99 | #include <MappingRequest.h> | 100 | #include <MappingRequest.h> |
| 100 | #include <MessagesClient.h> | 101 | #include <MessagesClient.h> |
| 102 | #include <model-networking/ModelCacheScriptingInterface.h> | ||
| 103 | #include <model-networking/TextureCacheScriptingInterface.h> | ||
| 101 | #include <ModelEntityItem.h> | 104 | #include <ModelEntityItem.h> |
| 102 | #include <NetworkAccessManager.h> | 105 | #include <NetworkAccessManager.h> |
| 103 | #include <NetworkingConstants.h> | 106 | #include <NetworkingConstants.h> |
| @@ -127,7 +130,7 @@ · 23 unmodified lines | |||
| 127 | #include <ScriptEngines.h> | 130 | #include <ScriptEngines.h> |
| 128 | #include <ScriptCache.h> | 131 | #include <ScriptCache.h> |
| 129 | #include <ShapeEntityItem.h> | 132 | #include <ShapeEntityItem.h> |
| 130 | #include <SoundCache.h> | 133 | #include <SoundCacheScriptingInterface.h> |
| 131 | #include <ui/TabletScriptingInterface.h> | 134 | #include <ui/TabletScriptingInterface.h> |
| 132 | #include <ui/ToolbarScriptingInterface.h> | 135 | #include <ui/ToolbarScriptingInterface.h> |
| 133 | #include <InteractiveWindow.h> | 136 | #include <InteractiveWindow.h> |
| @@ -143,6 +146,7 @@ · 9 unmodified lines | |||
| 143 | #include <QmlFragmentClass.h> | 146 | #include <QmlFragmentClass.h> |
| 144 | #include <Preferences.h> | 147 | #include <Preferences.h> |
| 145 | #include <display-plugins/CompositorHelper.h> | 148 | #include <display-plugins/CompositorHelper.h> |
| 149 | #include <display-plugins/hmd/HmdDisplayPlugin.h> | ||
| 146 | #include <trackers/EyeTracker.h> | 150 | #include <trackers/EyeTracker.h> |
| 147 | #include <avatars-renderer/ScriptAvatar.h> | 151 | #include <avatars-renderer/ScriptAvatar.h> |
| 148 | #include <RenderableEntityItem.h> | 152 | #include <RenderableEntityItem.h> |
| @@ -374,6 +378,7 @@ static const int THROTTLED_SIM_FRAME_PERIOD_MS = MSECS_PER_SECOND / THROTTLED_SI · 225 unmodified lines | |||
| 374 | static const uint32_t INVALID_FRAME = UINT32_MAX; | 378 | static const uint32_t INVALID_FRAME = UINT32_MAX; |
| 375 | 379 | ||
| 376 | static const float PHYSICS_READY_RANGE = 3.0f; // how far from avatar to check for entities that aren't ready for simulation | 380 | static const float PHYSICS_READY_RANGE = 3.0f; // how far from avatar to check for entities that aren't ready for simulation |
| 381 | static const float INITIAL_QUERY_RADIUS = 10.0f; // priority radius for entities before physics enabled | ||
| 377 | 382 | ||
| 378 | static const QString DESKTOP_LOCATION = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation); | 383 | static const QString DESKTOP_LOCATION = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation); |
| 379 | 384 | ||
| @@ -866,16 +871,20 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) { · 486 unmodified lines | |||
| 866 | DependencyManager::set<recording::ClipCache>(); | 871 | DependencyManager::set<recording::ClipCache>(); |
| 867 | DependencyManager::set<GeometryCache>(); | 872 | DependencyManager::set<GeometryCache>(); |
| 868 | DependencyManager::set<ModelCache>(); | 873 | DependencyManager::set<ModelCache>(); |
| 874 | DependencyManager::set<ModelCacheScriptingInterface>(); | ||
| 869 | DependencyManager::set<ScriptCache>(); | 875 | DependencyManager::set<ScriptCache>(); |
| 870 | DependencyManager::set<SoundCache>(); | 876 | DependencyManager::set<SoundCache>(); |
| 877 | DependencyManager::set<SoundCacheScriptingInterface>(); | ||
| 871 | DependencyManager::set<DdeFaceTracker>(); | 878 | DependencyManager::set<DdeFaceTracker>(); |
| 872 | DependencyManager::set<EyeTracker>(); | 879 | DependencyManager::set<EyeTracker>(); |
| 873 | DependencyManager::set<AudioClient>(); | 880 | DependencyManager::set<AudioClient>(); |
| 874 | DependencyManager::set<AudioScope>(); | 881 | DependencyManager::set<AudioScope>(); |
| 875 | DependencyManager::set<DeferredLightingEffect>(); | 882 | DependencyManager::set<DeferredLightingEffect>(); |
| 876 | DependencyManager::set<TextureCache>(); | 883 | DependencyManager::set<TextureCache>(); |
| 884 | DependencyManager::set<TextureCacheScriptingInterface>(); | ||
| 877 | DependencyManager::set<FramebufferCache>(); | 885 | DependencyManager::set<FramebufferCache>(); |
| 878 | DependencyManager::set<AnimationCache>(); | 886 | DependencyManager::set<AnimationCache>(); |
| 887 | DependencyManager::set<AnimationCacheScriptingInterface>(); | ||
| 879 | DependencyManager::set<ModelBlender>(); | 888 | DependencyManager::set<ModelBlender>(); |
| 880 | DependencyManager::set<UsersScriptingInterface>(); | 889 | DependencyManager::set<UsersScriptingInterface>(); |
| 881 | DependencyManager::set<AvatarManager>(); | 890 | DependencyManager::set<AvatarManager>(); |
| @@ -2582,12 +2591,18 @@ Application::~Application() { · 1700 unmodified lines | |||
| 2582 | 2591 | ||
| 2583 | DependencyManager::destroy<CompositorHelper>(); // must be destroyed before the FramebufferCache | 2592 | DependencyManager::destroy<CompositorHelper>(); // must be destroyed before the FramebufferCache |
| 2584 | 2593 | ||
| 2594 | DependencyManager::destroy<SoundCacheScriptingInterface>(); | ||
| 2595 | |||
| 2585 | DependencyManager::destroy<AvatarManager>(); | 2596 | DependencyManager::destroy<AvatarManager>(); |
| 2597 | DependencyManager::destroy<AnimationCacheScriptingInterface>(); | ||
| 2586 | DependencyManager::destroy<AnimationCache>(); | 2598 | DependencyManager::destroy<AnimationCache>(); |
| 2587 | DependencyManager::destroy<FramebufferCache>(); | 2599 | DependencyManager::destroy<FramebufferCache>(); |
| 2600 | DependencyManager::destroy<TextureCacheScriptingInterface>(); | ||
| 2588 | DependencyManager::destroy<TextureCache>(); | 2601 | DependencyManager::destroy<TextureCache>(); |
| 2602 | DependencyManager::destroy<ModelCacheScriptingInterface>(); | ||
| 2589 | DependencyManager::destroy<ModelCache>(); | 2603 | DependencyManager::destroy<ModelCache>(); |
| 2590 | DependencyManager::destroy<ScriptCache>(); | 2604 | DependencyManager::destroy<ScriptCache>(); |
| 2605 | DependencyManager::destroy<SoundCacheScriptingInterface>(); | ||
| 2591 | DependencyManager::destroy<SoundCache>(); | 2606 | DependencyManager::destroy<SoundCache>(); |
| 2592 | DependencyManager::destroy<OctreeStatsProvider>(); | 2607 | DependencyManager::destroy<OctreeStatsProvider>(); |
| 2593 | DependencyManager::destroy<GeometryCache>(); | 2608 | DependencyManager::destroy<GeometryCache>(); |
| @@ -2737,6 +2752,10 @@ void Application::initializeDisplayPlugins() { · 143 unmodified lines | |||
| 2737 | QObject::connect(displayPlugin.get(), &DisplayPlugin::recommendedFramebufferSizeChanged, | 2752 | QObject::connect(displayPlugin.get(), &DisplayPlugin::recommendedFramebufferSizeChanged, |
| 2738 | [this](const QSize& size) { resizeGL(); }); | 2753 | [this](const QSize& size) { resizeGL(); }); |
| 2739 | QObject::connect(displayPlugin.get(), &DisplayPlugin::resetSensorsRequested, this, &Application::requestReset); | 2754 | QObject::connect(displayPlugin.get(), &DisplayPlugin::resetSensorsRequested, this, &Application::requestReset); |
| 2755 | if (displayPlugin->isHmd()) { | ||
| 2756 | QObject::connect(dynamic_cast<HmdDisplayPlugin*>(displayPlugin.get()), &HmdDisplayPlugin::hmdMountedChanged, | ||
| 2757 | DependencyManager::get<HMDScriptingInterface>().data(), &HMDScriptingInterface::mountedChanged); | ||
| 2758 | } | ||
| 2740 | } | 2759 | } |
| 2741 | 2760 | ||
| 2742 | // The default display plugin needs to be activated first, otherwise the display plugin thread | 2761 | // The default display plugin needs to be activated first, otherwise the display plugin thread |
| @@ -3009,10 +3028,11 @@ void Application::onDesktopRootContextCreated(QQmlContext* surfaceContext) { · 266 unmodified lines | |||
| 3009 | surfaceContext->setContextProperty("LocationBookmarks", DependencyManager::get<LocationBookmarks>().data()); | 3028 | surfaceContext->setContextProperty("LocationBookmarks", DependencyManager::get<LocationBookmarks>().data()); |
| 3010 | 3029 | ||
| 3011 | // Caches | 3030 | // Caches |
| 3012 | surfaceContext->setContextProperty("AnimationCache", DependencyManager::get<AnimationCache>().data()); | 3031 | surfaceContext->setContextProperty("AnimationCache", DependencyManager::get<AnimationCacheScriptingInterface>().data()); |
| 3013 | surfaceContext->setContextProperty("TextureCache", DependencyManager::get<TextureCache>().data()); | 3032 | surfaceContext->setContextProperty("TextureCache", DependencyManager::get<TextureCacheScriptingInterface>().data()); |
| 3014 | surfaceContext->setContextProperty("ModelCache", DependencyManager::get<ModelCache>().data()); | 3033 | surfaceContext->setContextProperty("ModelCache", DependencyManager::get<ModelCacheScriptingInterface>().data()); |
| 3015 | surfaceContext->setContextProperty("SoundCache", DependencyManager::get<SoundCache>().data()); | 3034 | surfaceContext->setContextProperty("SoundCache", DependencyManager::get<SoundCacheScriptingInterface>().data()); |
| 3035 | |||
| 3016 | surfaceContext->setContextProperty("InputConfiguration", DependencyManager::get<InputConfiguration>().data()); | 3036 | surfaceContext->setContextProperty("InputConfiguration", DependencyManager::get<InputConfiguration>().data()); |
| 3017 | 3037 | ||
| 3018 | surfaceContext->setContextProperty("Account", AccountServicesScriptingInterface::getInstance()); // DEPRECATED - TO BE REMOVED | 3038 | surfaceContext->setContextProperty("Account", AccountServicesScriptingInterface::getInstance()); // DEPRECATED - TO BE REMOVED |
| @@ -5511,12 +5531,14 @@ void Application::update(float deltaTime) { · 2492 unmodified lines | |||
| 5511 | // we haven't yet enabled physics. we wait until we think we have all the collision information | 5531 | // we haven't yet enabled physics. we wait until we think we have all the collision information |
| 5512 | // for nearby entities before starting bullet up. | 5532 | // for nearby entities before starting bullet up. |
| 5513 | quint64 now = usecTimestampNow(); | 5533 | quint64 now = usecTimestampNow(); |
| 5514 | const int PHYSICS_CHECK_TIMEOUT = 2 * USECS_PER_SECOND; | 5534 | // Check for flagged EntityData having arrived. |
| 5515 | 5535 | auto entityTreeRenderer = getEntities(); | |
| 5516 | if (now - _lastPhysicsCheckTime > PHYSICS_CHECK_TIMEOUT || _fullSceneReceivedCounter > _fullSceneCounterAtLastPhysicsCheck) { | 5536 | if (isServerlessMode() || |
| 5537 | (entityTreeRenderer && _octreeProcessor.octreeSequenceIsComplete(entityTreeRenderer->getLastOctreeMessageSequence()) )) { | ||
| 5517 | // we've received a new full-scene octree stats packet, or it's been long enough to try again anyway | 5538 | // we've received a new full-scene octree stats packet, or it's been long enough to try again anyway |
| 5518 | _lastPhysicsCheckTime = now; | 5539 | _lastPhysicsCheckTime = now; |
| 5519 | _fullSceneCounterAtLastPhysicsCheck = _fullSceneReceivedCounter; | 5540 | _fullSceneCounterAtLastPhysicsCheck = _fullSceneReceivedCounter; |
| 5541 | _lastQueriedViews.clear(); // Force new view. | ||
| 5520 | 5542 | ||
| 5521 | // process octree stats packets are sent in between full sends of a scene (this isn't currently true). | 5543 | // process octree stats packets are sent in between full sends of a scene (this isn't currently true). |
| 5522 | // We keep physics disabled until we've received a full scene and everything near the avatar in that | 5544 | // We keep physics disabled until we've received a full scene and everything near the avatar in that |
| @@ -6168,11 +6190,23 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType) { · 645 unmodified lines | |||
| 6168 | return; // bail early if settings are not loaded | 6190 | return; // bail early if settings are not loaded |
| 6169 | } | 6191 | } |
| 6170 | 6192 | ||
| 6171 | _octreeQuery.setConicalViews(_conicalViews); | 6193 | const bool isModifiedQuery = !_physicsEnabled; |
| 6194 | if (isModifiedQuery) { | ||
| 6195 | // Create modified view that is a simple sphere. | ||
| 6196 | ConicalViewFrustum sphericalView; | ||
| 6197 | sphericalView.setSimpleRadius(INITIAL_QUERY_RADIUS); | ||
| 6198 | _octreeQuery.setConicalViews({ sphericalView }); | ||
| 6199 | _octreeQuery.setOctreeSizeScale(DEFAULT_OCTREE_SIZE_SCALE); | ||
| 6200 | static constexpr float MIN_LOD_ADJUST = -20.0f; | ||
| 6201 | _octreeQuery.setBoundaryLevelAdjust(MIN_LOD_ADJUST); | ||
| 6202 | } else { | ||
| 6203 | _octreeQuery.setConicalViews(_conicalViews); | ||
| 6204 | auto lodManager = DependencyManager::get<LODManager>(); | ||
| 6205 | _octreeQuery.setOctreeSizeScale(lodManager->getOctreeSizeScale()); | ||
| 6206 | _octreeQuery.setBoundaryLevelAdjust(lodManager->getBoundaryLevelAdjust()); | ||
| 6207 | } | ||
| 6208 | _octreeQuery.setReportInitialCompletion(isModifiedQuery); | ||
| 6172 | 6209 | ||
| 6173 | auto lodManager = DependencyManager::get<LODManager>(); | ||
| 6174 | _octreeQuery.setOctreeSizeScale(lodManager->getOctreeSizeScale()); | ||
| 6175 | _octreeQuery.setBoundaryLevelAdjust(lodManager->getBoundaryLevelAdjust()); | ||
| 6176 | 6210 | ||
| 6177 | auto nodeList = DependencyManager::get<NodeList>(); | 6211 | auto nodeList = DependencyManager::get<NodeList>(); |
| 6178 | 6212 | ||
| @@ -6321,6 +6355,7 @@ void Application::clearDomainOctreeDetails() { · 142 unmodified lines | |||
| 6321 | _octreeServerSceneStats.clear(); | 6355 | _octreeServerSceneStats.clear(); |
| 6322 | }); | 6356 | }); |
| 6323 | 6357 | ||
| 6358 | _octreeProcessor.resetCompletionSequenceNumber(); | ||
| 6324 | // reset the model renderer | 6359 | // reset the model renderer |
| 6325 | getEntities()->clear(); | 6360 | getEntities()->clear(); |
| 6326 | 6361 | ||
| @@ -6641,10 +6676,10 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEnginePointe · 314 unmodified lines | |||
| 6641 | scriptEngine->registerGlobalObject("Pointers", DependencyManager::get<PointerScriptingInterface>().data()); | 6676 | scriptEngine->registerGlobalObject("Pointers", DependencyManager::get<PointerScriptingInterface>().data()); |
| 6642 | 6677 | ||
| 6643 | // Caches | 6678 | // Caches |
| 6644 | scriptEngine->registerGlobalObject("AnimationCache", DependencyManager::get<AnimationCache>().data()); | 6679 | scriptEngine->registerGlobalObject("AnimationCache", DependencyManager::get<AnimationCacheScriptingInterface>().data()); |
| 6645 | scriptEngine->registerGlobalObject("TextureCache", DependencyManager::get<TextureCache>().data()); | 6680 | scriptEngine->registerGlobalObject("TextureCache", DependencyManager::get<TextureCacheScriptingInterface>().data()); |
| 6646 | scriptEngine->registerGlobalObject("ModelCache", DependencyManager::get<ModelCache>().data()); | 6681 | scriptEngine->registerGlobalObject("ModelCache", DependencyManager::get<ModelCacheScriptingInterface>().data()); |
| 6647 | scriptEngine->registerGlobalObject("SoundCache", DependencyManager::get<SoundCache>().data()); | 6682 | scriptEngine->registerGlobalObject("SoundCache", DependencyManager::get<SoundCacheScriptingInterface>().data()); |
| 6648 | 6683 | ||
| 6649 | scriptEngine->registerGlobalObject("DialogsManager", _dialogsManagerScriptingInterface); | 6684 | scriptEngine->registerGlobalObject("DialogsManager", _dialogsManagerScriptingInterface); |
| 6650 | 6685 | ||