Showing the changes to interface/src/Application.cpp (1 of 100 files). Show all
Unified · Split
| @@ -63,6 +63,7 @@ · 62 unmodified lines | ||
| 63 | 63 | #include <AddressManager.h> |
| 64 | 64 | #include <AnimDebugDraw.h> |
| 65 | 65 | #include <BuildInfo.h> |
| 66 | +#include <AnimationCacheScriptingInterface.h> | |
| 66 | 67 | #include <AssetClient.h> |
| 67 | 68 | #include <AssetUpload.h> |
| 68 | 69 | #include <AutoUpdater.h> |
| @@ -98,6 +99,8 @@ · 29 unmodified lines | ||
| 98 | 99 | #include <MainWindow.h> |
| 99 | 100 | #include <MappingRequest.h> |
| 100 | 101 | #include <MessagesClient.h> |
| 102 | +#include <model-networking/ModelCacheScriptingInterface.h> | |
| 103 | +#include <model-networking/TextureCacheScriptingInterface.h> | |
| 101 | 104 | #include <ModelEntityItem.h> |
| 102 | 105 | #include <NetworkAccessManager.h> |
| 103 | 106 | #include <NetworkingConstants.h> |
| @@ -127,7 +130,7 @@ · 23 unmodified lines | ||
| 127 | 130 | #include <ScriptEngines.h> |
| 128 | 131 | #include <ScriptCache.h> |
| 129 | 132 | #include <ShapeEntityItem.h> |
| 130 | −#include <SoundCache.h> | |
| 133 | +#include <SoundCacheScriptingInterface.h> | |
| 131 | 134 | #include <ui/TabletScriptingInterface.h> |
| 132 | 135 | #include <ui/ToolbarScriptingInterface.h> |
| 133 | 136 | #include <InteractiveWindow.h> |
| @@ -143,6 +146,7 @@ · 9 unmodified lines | ||
| 143 | 146 | #include <QmlFragmentClass.h> |
| 144 | 147 | #include <Preferences.h> |
| 145 | 148 | #include <display-plugins/CompositorHelper.h> |
| 149 | +#include <display-plugins/hmd/HmdDisplayPlugin.h> | |
| 146 | 150 | #include <trackers/EyeTracker.h> |
| 147 | 151 | #include <avatars-renderer/ScriptAvatar.h> |
| 148 | 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 | 378 | static const uint32_t INVALID_FRAME = UINT32_MAX; |
| 375 | 379 | |
| 376 | 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 | 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 | 871 | DependencyManager::set<recording::ClipCache>(); |
| 867 | 872 | DependencyManager::set<GeometryCache>(); |
| 868 | 873 | DependencyManager::set<ModelCache>(); |
| 874 | + DependencyManager::set<ModelCacheScriptingInterface>(); | |
| 869 | 875 | DependencyManager::set<ScriptCache>(); |
| 870 | 876 | DependencyManager::set<SoundCache>(); |
| 877 | + DependencyManager::set<SoundCacheScriptingInterface>(); | |
| 871 | 878 | DependencyManager::set<DdeFaceTracker>(); |
| 872 | 879 | DependencyManager::set<EyeTracker>(); |
| 873 | 880 | DependencyManager::set<AudioClient>(); |
| 874 | 881 | DependencyManager::set<AudioScope>(); |
| 875 | 882 | DependencyManager::set<DeferredLightingEffect>(); |
| 876 | 883 | DependencyManager::set<TextureCache>(); |
| 884 | + DependencyManager::set<TextureCacheScriptingInterface>(); | |
| 877 | 885 | DependencyManager::set<FramebufferCache>(); |
| 878 | 886 | DependencyManager::set<AnimationCache>(); |
| 887 | + DependencyManager::set<AnimationCacheScriptingInterface>(); | |
| 879 | 888 | DependencyManager::set<ModelBlender>(); |
| 880 | 889 | DependencyManager::set<UsersScriptingInterface>(); |
| 881 | 890 | DependencyManager::set<AvatarManager>(); |
| @@ -2582,12 +2591,18 @@ Application::~Application() { · 1700 unmodified lines | ||
| 2582 | 2591 | |
| 2583 | 2592 | DependencyManager::destroy<CompositorHelper>(); // must be destroyed before the FramebufferCache |
| 2584 | 2593 | |
| 2594 | + DependencyManager::destroy<SoundCacheScriptingInterface>(); | |
| 2595 | + | |
| 2585 | 2596 | DependencyManager::destroy<AvatarManager>(); |
| 2597 | + DependencyManager::destroy<AnimationCacheScriptingInterface>(); | |
| 2586 | 2598 | DependencyManager::destroy<AnimationCache>(); |
| 2587 | 2599 | DependencyManager::destroy<FramebufferCache>(); |
| 2600 | + DependencyManager::destroy<TextureCacheScriptingInterface>(); | |
| 2588 | 2601 | DependencyManager::destroy<TextureCache>(); |
| 2602 | + DependencyManager::destroy<ModelCacheScriptingInterface>(); | |
| 2589 | 2603 | DependencyManager::destroy<ModelCache>(); |
| 2590 | 2604 | DependencyManager::destroy<ScriptCache>(); |
| 2605 | + DependencyManager::destroy<SoundCacheScriptingInterface>(); | |
| 2591 | 2606 | DependencyManager::destroy<SoundCache>(); |
| 2592 | 2607 | DependencyManager::destroy<OctreeStatsProvider>(); |
| 2593 | 2608 | DependencyManager::destroy<GeometryCache>(); |
| @@ -2737,6 +2752,10 @@ void Application::initializeDisplayPlugins() { · 143 unmodified lines | ||
| 2737 | 2752 | QObject::connect(displayPlugin.get(), &DisplayPlugin::recommendedFramebufferSizeChanged, |
| 2738 | 2753 | [this](const QSize& size) { resizeGL(); }); |
| 2739 | 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 | 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 | 3028 | surfaceContext->setContextProperty("LocationBookmarks", DependencyManager::get<LocationBookmarks>().data()); |
| 3010 | 3029 | |
| 3011 | 3030 | // Caches |
| 3012 | − surfaceContext->setContextProperty("AnimationCache", DependencyManager::get<AnimationCache>().data()); | |
| 3013 | − surfaceContext->setContextProperty("TextureCache", DependencyManager::get<TextureCache>().data()); | |
| 3014 | − surfaceContext->setContextProperty("ModelCache", DependencyManager::get<ModelCache>().data()); | |
| 3015 | − surfaceContext->setContextProperty("SoundCache", DependencyManager::get<SoundCache>().data()); | |
| 3031 | + surfaceContext->setContextProperty("AnimationCache", DependencyManager::get<AnimationCacheScriptingInterface>().data()); | |
| 3032 | + surfaceContext->setContextProperty("TextureCache", DependencyManager::get<TextureCacheScriptingInterface>().data()); | |
| 3033 | + surfaceContext->setContextProperty("ModelCache", DependencyManager::get<ModelCacheScriptingInterface>().data()); | |
| 3034 | + surfaceContext->setContextProperty("SoundCache", DependencyManager::get<SoundCacheScriptingInterface>().data()); | |
| 3035 | + | |
| 3016 | 3036 | surfaceContext->setContextProperty("InputConfiguration", DependencyManager::get<InputConfiguration>().data()); |
| 3017 | 3037 | |
| 3018 | 3038 | surfaceContext->setContextProperty("Account", AccountServicesScriptingInterface::getInstance()); // DEPRECATED - TO BE REMOVED |
| @@ -5511,12 +5531,14 @@ void Application::update(float deltaTime) { · 2492 unmodified lines | ||
| 5511 | 5531 | // we haven't yet enabled physics. we wait until we think we have all the collision information |
| 5512 | 5532 | // for nearby entities before starting bullet up. |
| 5513 | 5533 | quint64 now = usecTimestampNow(); |
| 5514 | − const int PHYSICS_CHECK_TIMEOUT = 2 * USECS_PER_SECOND; | |
| 5515 | − | |
| 5516 | − if (now - _lastPhysicsCheckTime > PHYSICS_CHECK_TIMEOUT || _fullSceneReceivedCounter > _fullSceneCounterAtLastPhysicsCheck) { | |
| 5534 | + // Check for flagged EntityData having arrived. | |
| 5535 | + auto entityTreeRenderer = getEntities(); | |
| 5536 | + if (isServerlessMode() || | |
| 5537 | + (entityTreeRenderer && _octreeProcessor.octreeSequenceIsComplete(entityTreeRenderer->getLastOctreeMessageSequence()) )) { | |
| 5517 | 5538 | // we've received a new full-scene octree stats packet, or it's been long enough to try again anyway |
| 5518 | 5539 | _lastPhysicsCheckTime = now; |
| 5519 | 5540 | _fullSceneCounterAtLastPhysicsCheck = _fullSceneReceivedCounter; |
| 5541 | + _lastQueriedViews.clear(); // Force new view. | |
| 5520 | 5542 | |
| 5521 | 5543 | // process octree stats packets are sent in between full sends of a scene (this isn't currently true). |
| 5522 | 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 | 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 | 6211 | auto nodeList = DependencyManager::get<NodeList>(); |
| 6178 | 6212 | |
| @@ -6321,6 +6355,7 @@ void Application::clearDomainOctreeDetails() { · 142 unmodified lines | ||
| 6321 | 6355 | _octreeServerSceneStats.clear(); |
| 6322 | 6356 | }); |
| 6323 | 6357 | |
| 6358 | + _octreeProcessor.resetCompletionSequenceNumber(); | |
| 6324 | 6359 | // reset the model renderer |
| 6325 | 6360 | getEntities()->clear(); |
| 6326 | 6361 | |
| @@ -6641,10 +6676,10 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEnginePointe · 314 unmodified lines | ||
| 6641 | 6676 | scriptEngine->registerGlobalObject("Pointers", DependencyManager::get<PointerScriptingInterface>().data()); |
| 6642 | 6677 | |
| 6643 | 6678 | // Caches |
| 6644 | − scriptEngine->registerGlobalObject("AnimationCache", DependencyManager::get<AnimationCache>().data()); | |
| 6645 | − scriptEngine->registerGlobalObject("TextureCache", DependencyManager::get<TextureCache>().data()); | |
| 6646 | − scriptEngine->registerGlobalObject("ModelCache", DependencyManager::get<ModelCache>().data()); | |
| 6647 | − scriptEngine->registerGlobalObject("SoundCache", DependencyManager::get<SoundCache>().data()); | |
| 6679 | + scriptEngine->registerGlobalObject("AnimationCache", DependencyManager::get<AnimationCacheScriptingInterface>().data()); | |
| 6680 | + scriptEngine->registerGlobalObject("TextureCache", DependencyManager::get<TextureCacheScriptingInterface>().data()); | |
| 6681 | + scriptEngine->registerGlobalObject("ModelCache", DependencyManager::get<ModelCacheScriptingInterface>().data()); | |
| 6682 | + scriptEngine->registerGlobalObject("SoundCache", DependencyManager::get<SoundCacheScriptingInterface>().data()); | |
| 6648 | 6683 | |
| 6649 | 6684 | scriptEngine->registerGlobalObject("DialogsManager", _dialogsManagerScriptingInterface); |
| 6650 | 6685 | |