History

CR

Clement committed 8 years ago

Commit b04c5bd1 parent 487a6303 files · +16 −12Browse files

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

Unified · Split

interface/src/Application.cpp+8−8
@@ -967,7 +967,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 966 unmodified lines
967 _entitySimulation(new PhysicalEntitySimulation()),967 _entitySimulation(new PhysicalEntitySimulation()),
968 _physicsEngine(new PhysicsEngine(Vectors::ZERO)),968 _physicsEngine(new PhysicsEngine(Vectors::ZERO)),
969 _entityClipboard(new EntityTree()),969 _entityClipboard(new EntityTree()),
970 _lastQueriedTime(usecTimestampNow()),
971 _previousScriptLocation("LastScriptLocation", DESKTOP_LOCATION),970 _previousScriptLocation("LastScriptLocation", DESKTOP_LOCATION),
972 _fieldOfView("fieldOfView", DEFAULT_FIELD_OF_VIEW_DEGREES),971 _fieldOfView("fieldOfView", DEFAULT_FIELD_OF_VIEW_DEGREES),
973 _hmdTabletScale("hmdTabletScale", DEFAULT_HMD_TABLET_SCALE_PERCENT),972 _hmdTabletScale("hmdTabletScale", DEFAULT_HMD_TABLET_SCALE_PERCENT),
@@ -5084,7 +5083,7 @@ void Application::reloadResourceCaches() { · 4110 unmodified lines
5084 resetPhysicsReadyInformation();5083 resetPhysicsReadyInformation();
5085 5084
5086 // Query the octree to refresh everything in view5085 // Query the octree to refresh everything in view
5087 _lastQueriedTime = 0;5086 _queryExpiry = SteadyClock::now();
5088 _octreeQuery.incrementConnectionID();5087 _octreeQuery.incrementConnectionID();
5089 5088
5090 queryOctree(NodeType::EntityServer, PacketType::EntityQuery);5089 queryOctree(NodeType::EntityServer, PacketType::EntityQuery);
@@ -5660,9 +5659,6 @@ void Application::update(float deltaTime) { · 569 unmodified lines
5660 PROFILE_RANGE_EX(app, "QueryOctree", 0xffff0000, (uint64_t)getActiveDisplayPlugin()->presentCount());5659 PROFILE_RANGE_EX(app, "QueryOctree", 0xffff0000, (uint64_t)getActiveDisplayPlugin()->presentCount());
5661 PerformanceTimer perfTimer("queryOctree");5660 PerformanceTimer perfTimer("queryOctree");
5662 QMutexLocker viewLocker(&_viewMutex);5661 QMutexLocker viewLocker(&_viewMutex);
5663 quint64 sinceLastQuery = now - _lastQueriedTime;
5664 const quint64 TOO_LONG_SINCE_LAST_QUERY = 3 * USECS_PER_SECOND;
5665 bool queryIsDue = sinceLastQuery > TOO_LONG_SINCE_LAST_QUERY;
5666 5662
5667 bool viewIsDifferentEnough = false;5663 bool viewIsDifferentEnough = false;
5668 if (_conicalViews.size() == _lastQueriedViews.size()) {5664 if (_conicalViews.size() == _lastQueriedViews.size()) {
@@ -5678,14 +5674,16 @@ void Application::update(float deltaTime) { · 9 unmodified lines
5678 5674
5679 5675
5680 // if it's been a while since our last query or the view has significantly changed then send a query, otherwise suppress it5676 // if it's been a while since our last query or the view has significantly changed then send a query, otherwise suppress it
5681 if (queryIsDue || viewIsDifferentEnough) {5677 static const std::chrono::seconds MIN_PERIOD_BETWEEN_QUERIES { 3 };
5678 auto now = SteadyClock::now();
5679 if (now > _queryExpiry || viewIsDifferentEnough) {
5682 if (DependencyManager::get<SceneScriptingInterface>()->shouldRenderEntities()) {5680 if (DependencyManager::get<SceneScriptingInterface>()->shouldRenderEntities()) {
5683 queryOctree(NodeType::EntityServer, PacketType::EntityQuery);5681 queryOctree(NodeType::EntityServer, PacketType::EntityQuery);
5684 }5682 }
5685 queryAvatars();5683 queryAvatars();
5686 5684
5687 _lastQueriedViews = _conicalViews;5685 _lastQueriedViews = _conicalViews;
5688 _lastQueriedTime = now;5686 _queryExpiry = now + MIN_PERIOD_BETWEEN_QUERIES;
5689 }5687 }
5690 }5688 }
5691 5689
@@ -6142,7 +6140,7 @@ void Application::nodeActivated(SharedNodePointer node) { · 450 unmodified lines
6142 // If we get a new EntityServer activated, reset lastQueried time6140 // If we get a new EntityServer activated, reset lastQueried time
6143 // so we will do a proper query during update6141 // so we will do a proper query during update
6144 if (node->getType() == NodeType::EntityServer) {6142 if (node->getType() == NodeType::EntityServer) {
6145 _lastQueriedTime = 0;6143 _queryExpiry = SteadyClock::now();
6146 _octreeQuery.incrementConnectionID();6144 _octreeQuery.incrementConnectionID();
6147 }6145 }
6148 6146
@@ -6151,6 +6149,8 @@ void Application::nodeActivated(SharedNodePointer node) { · 2 unmodified lines
6151 }6149 }
6152 6150
6153 if (node->getType() == NodeType::AvatarMixer) {6151 if (node->getType() == NodeType::AvatarMixer) {
6152 _queryExpiry = SteadyClock::now();
6153
6154 // new avatar mixer, send off our identity packet on next update loop6154 // new avatar mixer, send off our identity packet on next update loop
6155 // Reset skeletonModelUrl if the last server modified our choice.6155 // Reset skeletonModelUrl if the last server modified our choice.
6156 // Override the avatar url (but not model name) here too.6156 // Override the avatar url (but not model name) here too.