diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 14742e18f6..e17846bfda 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -87,6 +87,7 @@ #include #include #include +#include #include "Application.h" #include "AudioClient.h" @@ -183,6 +184,8 @@ const QString CHECK_VERSION_URL = "https://highfidelity.com/latestVersion.xml"; const QString SKIP_FILENAME = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/hifi.skipversion"; const QString DEFAULT_SCRIPTS_JS_URL = "http://s3.amazonaws.com/hifi-public/scripts/defaultScripts.js"; +Setting::Handle maxOctreePacketsPerSecond("maxOctreePPS", DEFAULT_MAX_OCTREE_PPS); + #ifdef Q_OS_WIN class MyNativeEventFilter : public QAbstractNativeEventFilter { @@ -333,7 +336,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : _isVSyncOn(true), _aboutToQuit(false), _notifiedPacketVersionMismatchThisDomain(false), - _domainConnectionRefusals(QList()) + _domainConnectionRefusals(QList()), + _maxOctreePPS(maxOctreePacketsPerSecond.get()) { #ifdef Q_OS_WIN installNativeEventFilter(&MyNativeEventFilter::getInstance()); @@ -2683,7 +2687,7 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node int perServerPPS = 0; const int SMALL_BUDGET = 10; int perUnknownServer = SMALL_BUDGET; - int totalPPS = getEntityTree()->getMaxOctreePacketsPerSecond(); + int totalPPS = getMaxOctreePacketsPerSecond(); // determine PPS based on number of servers if (inViewServers >= 1) { @@ -4648,3 +4652,14 @@ PickRay Application::computePickRay() const { bool Application::hasFocus() const { return _glWidget->hasFocus(); } + +void Application::setMaxOctreePacketsPerSecond(int maxOctreePPS) { + if (maxOctreePPS != _maxOctreePPS) { + _maxOctreePPS = maxOctreePPS; + maxOctreePacketsPerSecond.set(_maxOctreePPS); + } +} + +int Application::getMaxOctreePacketsPerSecond() { + return _maxOctreePPS; +} diff --git a/interface/src/Application.h b/interface/src/Application.h index a86512ec17..da4a61649e 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -345,6 +345,9 @@ public: bool canAcceptURL(const QString& url); bool acceptURL(const QString& url); + void setMaxOctreePacketsPerSecond(int maxOctreePPS); + int getMaxOctreePacketsPerSecond(); + signals: /// Fired when we're simulating; allows external parties to hook in. @@ -663,6 +666,8 @@ private: QList _domainConnectionRefusals; glm::uvec2 _renderResolution; + + int _maxOctreePPS = DEFAULT_MAX_OCTREE_PPS; }; #endif // hifi_Application_h diff --git a/interface/src/ui/PreferencesDialog.cpp b/interface/src/ui/PreferencesDialog.cpp index 96b8bd8056..4622ffd7ed 100644 --- a/interface/src/ui/PreferencesDialog.cpp +++ b/interface/src/ui/PreferencesDialog.cpp @@ -168,7 +168,7 @@ void PreferencesDialog::loadPreferences() { ui.avatarScaleSpin->setValue(myAvatar->getScale()); - ui.maxOctreePPSSpin->setValue(qApp->getEntityTree()->getMaxOctreePacketsPerSecond()); + ui.maxOctreePPSSpin->setValue(qApp->getMaxOctreePacketsPerSecond()); ui.oculusUIAngularSizeSpin->setValue(qApp->getApplicationOverlay().getHmdUIAngularSize()); @@ -228,7 +228,7 @@ void PreferencesDialog::savePreferences() { faceshift->setHostname(ui.faceshiftHostnameEdit->text()); - qApp->getEntityTree()->setMaxOctreePacketsPerSecond(ui.maxOctreePPSSpin->value()); + qApp->setMaxOctreePacketsPerSecond(ui.maxOctreePPSSpin->value()); qApp->getApplicationOverlay().setHmdUIAngularSize(ui.oculusUIAngularSizeSpin->value()); diff --git a/libraries/octree/src/Octree.cpp b/libraries/octree/src/Octree.cpp index 77f5be4805..1a2bc89820 100644 --- a/libraries/octree/src/Octree.cpp +++ b/libraries/octree/src/Octree.cpp @@ -40,7 +40,6 @@ #include #include #include -#include #include "CoverageMap.h" #include "OctreeConstants.h" @@ -51,7 +50,6 @@ QVector PERSIST_EXTENSIONS = {"svo", "json"}; -Setting::Handle maxOctreePacketsPerSecond("maxOctreePPS", DEFAULT_MAX_OCTREE_PPS); float boundaryDistanceForRenderLevel(unsigned int renderLevel, float voxelSizeScale) { return voxelSizeScale / powf(2, renderLevel); @@ -64,8 +62,7 @@ Octree::Octree(bool shouldReaverage) : _stopImport(false), _lock(QReadWriteLock::Recursive), _isViewing(false), - _isServer(false), - _maxOctreePPS(maxOctreePacketsPerSecond.get()) + _isServer(false) { } @@ -2203,15 +2200,3 @@ bool Octree::countOctreeElementsOperation(OctreeElement* element, void* extraDat void Octree::cancelImport() { _stopImport = true; } - -void Octree::setMaxOctreePacketsPerSecond(int maxOctreePPS) { - if (maxOctreePPS != _maxOctreePPS) { - _maxOctreePPS = maxOctreePPS; - maxOctreePacketsPerSecond.set(_maxOctreePPS); - } -} - -int Octree::getMaxOctreePacketsPerSecond() { - return _maxOctreePPS; -} - diff --git a/libraries/octree/src/Octree.h b/libraries/octree/src/Octree.h index 408271dc36..d7fc58699f 100644 --- a/libraries/octree/src/Octree.h +++ b/libraries/octree/src/Octree.h @@ -370,9 +370,6 @@ public: virtual void dumpTree() { }; virtual void pruneTree() { }; - void setMaxOctreePacketsPerSecond(int maxOctreePPS); - int getMaxOctreePacketsPerSecond(); - signals: void importSize(float x, float y, float z); void importProgress(int progress); @@ -406,8 +403,6 @@ protected: bool _isViewing; bool _isServer; - - int _maxOctreePPS = DEFAULT_MAX_OCTREE_PPS; }; float boundaryDistanceForRenderLevel(unsigned int renderLevel, float voxelSizeScale);