History

Merge branch 'master' of github.com:highfidelity/hifi into interstitial-final-page

Dante Ruiz committed 8 years ago

Commit 683b42e2 parents b9cfbfb 2013f1b100 files · +4579 −1714Browse files

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

Unified · Split

interface/src/Application.cpp+51−16
@@ -63,6 +63,7 @@ · 62 unmodified lines
6363 #include <AddressManager.h>
6464 #include <AnimDebugDraw.h>
6565 #include <BuildInfo.h>
66+#include <AnimationCacheScriptingInterface.h>
6667 #include <AssetClient.h>
6768 #include <AssetUpload.h>
6869 #include <AutoUpdater.h>
@@ -98,6 +99,8 @@ · 29 unmodified lines
9899 #include <MainWindow.h>
99100 #include <MappingRequest.h>
100101 #include <MessagesClient.h>
102+#include <model-networking/ModelCacheScriptingInterface.h>
103+#include <model-networking/TextureCacheScriptingInterface.h>
101104 #include <ModelEntityItem.h>
102105 #include <NetworkAccessManager.h>
103106 #include <NetworkingConstants.h>
@@ -127,7 +130,7 @@ · 23 unmodified lines
127130 #include <ScriptEngines.h>
128131 #include <ScriptCache.h>
129132 #include <ShapeEntityItem.h>
130−#include <SoundCache.h>
133+#include <SoundCacheScriptingInterface.h>
131134 #include <ui/TabletScriptingInterface.h>
132135 #include <ui/ToolbarScriptingInterface.h>
133136 #include <InteractiveWindow.h>
@@ -143,6 +146,7 @@ · 9 unmodified lines
143146 #include <QmlFragmentClass.h>
144147 #include <Preferences.h>
145148 #include <display-plugins/CompositorHelper.h>
149+#include <display-plugins/hmd/HmdDisplayPlugin.h>
146150 #include <trackers/EyeTracker.h>
147151 #include <avatars-renderer/ScriptAvatar.h>
148152 #include <RenderableEntityItem.h>
@@ -374,6 +378,7 @@ static const int THROTTLED_SIM_FRAME_PERIOD_MS = MSECS_PER_SECOND / THROTTLED_SI · 225 unmodified lines
374378 static const uint32_t INVALID_FRAME = UINT32_MAX;
375379
376380 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
377382
378383 static const QString DESKTOP_LOCATION = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
379384
@@ -866,16 +871,20 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) { · 486 unmodified lines
866871 DependencyManager::set<recording::ClipCache>();
867872 DependencyManager::set<GeometryCache>();
868873 DependencyManager::set<ModelCache>();
874+ DependencyManager::set<ModelCacheScriptingInterface>();
869875 DependencyManager::set<ScriptCache>();
870876 DependencyManager::set<SoundCache>();
877+ DependencyManager::set<SoundCacheScriptingInterface>();
871878 DependencyManager::set<DdeFaceTracker>();
872879 DependencyManager::set<EyeTracker>();
873880 DependencyManager::set<AudioClient>();
874881 DependencyManager::set<AudioScope>();
875882 DependencyManager::set<DeferredLightingEffect>();
876883 DependencyManager::set<TextureCache>();
884+ DependencyManager::set<TextureCacheScriptingInterface>();
877885 DependencyManager::set<FramebufferCache>();
878886 DependencyManager::set<AnimationCache>();
887+ DependencyManager::set<AnimationCacheScriptingInterface>();
879888 DependencyManager::set<ModelBlender>();
880889 DependencyManager::set<UsersScriptingInterface>();
881890 DependencyManager::set<AvatarManager>();
@@ -2582,12 +2591,18 @@ Application::~Application() { · 1700 unmodified lines
25822591
25832592 DependencyManager::destroy<CompositorHelper>(); // must be destroyed before the FramebufferCache
25842593
2594+ DependencyManager::destroy<SoundCacheScriptingInterface>();
2595+
25852596 DependencyManager::destroy<AvatarManager>();
2597+ DependencyManager::destroy<AnimationCacheScriptingInterface>();
25862598 DependencyManager::destroy<AnimationCache>();
25872599 DependencyManager::destroy<FramebufferCache>();
2600+ DependencyManager::destroy<TextureCacheScriptingInterface>();
25882601 DependencyManager::destroy<TextureCache>();
2602+ DependencyManager::destroy<ModelCacheScriptingInterface>();
25892603 DependencyManager::destroy<ModelCache>();
25902604 DependencyManager::destroy<ScriptCache>();
2605+ DependencyManager::destroy<SoundCacheScriptingInterface>();
25912606 DependencyManager::destroy<SoundCache>();
25922607 DependencyManager::destroy<OctreeStatsProvider>();
25932608 DependencyManager::destroy<GeometryCache>();
@@ -2737,6 +2752,10 @@ void Application::initializeDisplayPlugins() { · 143 unmodified lines
27372752 QObject::connect(displayPlugin.get(), &DisplayPlugin::recommendedFramebufferSizeChanged,
27382753 [this](const QSize& size) { resizeGL(); });
27392754 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+ }
27402759 }
27412760
27422761 // 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
30093028 surfaceContext->setContextProperty("LocationBookmarks", DependencyManager::get<LocationBookmarks>().data());
30103029
30113030 // 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+
30163036 surfaceContext->setContextProperty("InputConfiguration", DependencyManager::get<InputConfiguration>().data());
30173037
30183038 surfaceContext->setContextProperty("Account", AccountServicesScriptingInterface::getInstance()); // DEPRECATED - TO BE REMOVED
@@ -5511,12 +5531,14 @@ void Application::update(float deltaTime) { · 2492 unmodified lines
55115531 // we haven't yet enabled physics. we wait until we think we have all the collision information
55125532 // for nearby entities before starting bullet up.
55135533 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()) )) {
55175538 // we've received a new full-scene octree stats packet, or it's been long enough to try again anyway
55185539 _lastPhysicsCheckTime = now;
55195540 _fullSceneCounterAtLastPhysicsCheck = _fullSceneReceivedCounter;
5541+ _lastQueriedViews.clear(); // Force new view.
55205542
55215543 // process octree stats packets are sent in between full sends of a scene (this isn't currently true).
55225544 // 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
61686190 return; // bail early if settings are not loaded
61696191 }
61706192
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);
61726209
6173− auto lodManager = DependencyManager::get<LODManager>();
6174− _octreeQuery.setOctreeSizeScale(lodManager->getOctreeSizeScale());
6175− _octreeQuery.setBoundaryLevelAdjust(lodManager->getBoundaryLevelAdjust());
61766210
61776211 auto nodeList = DependencyManager::get<NodeList>();
61786212
@@ -6321,6 +6355,7 @@ void Application::clearDomainOctreeDetails() { · 142 unmodified lines
63216355 _octreeServerSceneStats.clear();
63226356 });
63236357
6358+ _octreeProcessor.resetCompletionSequenceNumber();
63246359 // reset the model renderer
63256360 getEntities()->clear();
63266361
@@ -6641,10 +6676,10 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEnginePointe · 314 unmodified lines
66416676 scriptEngine->registerGlobalObject("Pointers", DependencyManager::get<PointerScriptingInterface>().data());
66426677
66436678 // 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());
66486683
66496684 scriptEngine->registerGlobalObject("DialogsManager", _dialogsManagerScriptingInterface);
66506685

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