From e8a396b08b68264b4f4e9193d395d43b94dad4b3 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Sat, 17 Jan 2015 23:30:45 -0800 Subject: [PATCH] Moved Octree max pps out of Menu Moved it to OctreeQuery --- interface/src/Application.cpp | 2 +- interface/src/Application.h | 1 + interface/src/Menu.cpp | 2 -- interface/src/Menu.h | 6 ----- interface/src/ui/PreferencesDialog.cpp | 4 +-- libraries/octree/src/OctreeQuery.cpp | 24 ------------------ libraries/octree/src/OctreeQuery.h | 34 +++++++++++++------------- 7 files changed, 21 insertions(+), 52 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index d7ed5c14d9..63537daaf2 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -2304,7 +2304,7 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node int perServerPPS = 0; const int SMALL_BUDGET = 10; int perUnknownServer = SMALL_BUDGET; - int totalPPS = Menu::getInstance()->getMaxOctreePacketsPerSecond(); + int totalPPS = _octreeQuery.getMaxOctreePacketsPerSecond(); // determine PPS based on number of servers if (inViewServers >= 1) { diff --git a/interface/src/Application.h b/interface/src/Application.h index 7b86236ffa..b8099471c9 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -186,6 +186,7 @@ public: PrioVR* getPrioVR() { return &_prioVR; } QUndoStack* getUndoStack() { return &_undoStack; } MainWindow* getWindow() { return _window; } + OctreeQuery& getOctreeQuery() { return _octreeQuery; } EntityTree* getEntityClipboard() { return &_entityClipboard; } EntityTreeRenderer* getEntityClipboardRenderer() { return &_entityClipboardRenderer; } diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index 7bc903d398..cf3afce5b4 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -592,7 +592,6 @@ void Menu::loadSettings(QSettings* settings) { int bufferSize = settings->value("audioOutputBufferSize", DEFAULT_AUDIO_OUTPUT_BUFFER_SIZE_FRAMES).toInt(); QMetaObject::invokeMethod(audio.data(), "setOutputBufferSize", Q_ARG(int, bufferSize)); - _maxOctreePacketsPerSecond = loadSetting(settings, "maxOctreePPS", DEFAULT_MAX_OCTREE_PPS); _snapshotsLocation = settings->value("snapshotsLocation", QStandardPaths::writableLocation(QStandardPaths::DesktopLocation)).toString(); setScriptsLocation(settings->value("scriptsLocation", QString()).toString()); @@ -636,7 +635,6 @@ void Menu::saveSettings(QSettings* settings) { settings->setValue("audioOutputStarveDetectionPeriod", audio->getOutputStarveDetectionPeriod()); settings->setValue("audioOutputBufferSize", audio->getOutputBufferSize()); - settings->setValue("maxOctreePPS", _maxOctreePacketsPerSecond); settings->setValue("snapshotsLocation", _snapshotsLocation); settings->setValue("scriptsLocation", _scriptsLocation); #if defined(Q_OS_MAC) || defined(Q_OS_WIN) diff --git a/interface/src/Menu.h b/interface/src/Menu.h index 16b6b4ea27..cd10ae0518 100644 --- a/interface/src/Menu.h +++ b/interface/src/Menu.h @@ -146,10 +146,6 @@ public: #if defined(Q_OS_MAC) || defined(Q_OS_WIN) SpeechRecognizer* getSpeechRecognizer() { return &_speechRecognizer; } #endif - - // User Tweakable PPS from Voxel Server - int getMaxOctreePacketsPerSecond() const { return _maxOctreePacketsPerSecond; } - void setMaxOctreePacketsPerSecond(int value) { _maxOctreePacketsPerSecond = value; bumpSettings(); } const QByteArray& getWalletPrivateKey() const { return _walletPrivateKey; } @@ -201,8 +197,6 @@ private: bool _hasLoginDialogDisplayed = false; - int _maxOctreePacketsPerSecond = DEFAULT_MAX_OCTREE_PPS; - QPointer _addressBarDialog; QPointer _animationsDialog; QPointer _attachmentsDialog; diff --git a/interface/src/ui/PreferencesDialog.cpp b/interface/src/ui/PreferencesDialog.cpp index ecf8617967..8654be3dab 100644 --- a/interface/src/ui/PreferencesDialog.cpp +++ b/interface/src/ui/PreferencesDialog.cpp @@ -160,7 +160,7 @@ void PreferencesDialog::loadPreferences() { ui.avatarScaleSpin->setValue(myAvatar->getScale()); - ui.maxOctreePPSSpin->setValue(menuInstance->getMaxOctreePacketsPerSecond()); + ui.maxOctreePPSSpin->setValue(qApp->getOctreeQuery().getMaxOctreePacketsPerSecond()); ui.oculusUIAngularSizeSpin->setValue(qApp->getApplicationOverlay().getOculusUIAngularSize()); @@ -242,7 +242,7 @@ void PreferencesDialog::savePreferences() { faceshift->setHostname(ui.faceshiftHostnameEdit->text()); - Menu::getInstance()->setMaxOctreePacketsPerSecond(ui.maxOctreePPSSpin->value()); + qApp->getOctreeQuery().setMaxOctreePacketsPerSecond(ui.maxOctreePPSSpin->value()); qApp->getApplicationOverlay().setOculusUIAngularSize(ui.oculusUIAngularSizeSpin->value()); diff --git a/libraries/octree/src/OctreeQuery.cpp b/libraries/octree/src/OctreeQuery.cpp index f40276952b..00c1a4a62d 100644 --- a/libraries/octree/src/OctreeQuery.cpp +++ b/libraries/octree/src/OctreeQuery.cpp @@ -10,35 +10,11 @@ // #include -//#include #include #include "OctreeConstants.h" #include "OctreeQuery.h" -OctreeQuery::OctreeQuery() : - NodeData(), - _cameraPosition(0,0,0), - _cameraOrientation(), - _cameraFov(0.0f), - _cameraAspectRatio(0.0f), - _cameraNearClip(0.0f), - _cameraFarClip(0.0f), - _wantColor(true), - _wantDelta(true), - _wantLowResMoving(true), - _wantOcclusionCulling(false), // disabled by default - _wantCompression(false), // disabled by default - _maxOctreePPS(DEFAULT_MAX_OCTREE_PPS), - _octreeElementSizeScale(DEFAULT_OCTREE_SIZE_SCALE) -{ - -} - -OctreeQuery::~OctreeQuery() { - // nothing to do -} - int OctreeQuery::getBroadcastData(unsigned char* destinationBuffer) { unsigned char* bufferStart = destinationBuffer; diff --git a/libraries/octree/src/OctreeQuery.h b/libraries/octree/src/OctreeQuery.h index 8c4460bc73..3d76857acc 100644 --- a/libraries/octree/src/OctreeQuery.h +++ b/libraries/octree/src/OctreeQuery.h @@ -44,8 +44,8 @@ class OctreeQuery : public NodeData { Q_OBJECT public: - OctreeQuery(); - virtual ~OctreeQuery(); + OctreeQuery() {} + virtual ~OctreeQuery() {} int getBroadcastData(unsigned char* destinationBuffer); int parseData(const QByteArray& packet); @@ -92,23 +92,23 @@ public slots: protected: // camera details for the avatar - glm::vec3 _cameraPosition; - glm::quat _cameraOrientation; - float _cameraFov; - float _cameraAspectRatio; - float _cameraNearClip; - float _cameraFarClip; - glm::vec3 _cameraEyeOffsetPosition; + glm::vec3 _cameraPosition = glm::vec3(0.0f); + glm::quat _cameraOrientation = glm::quat(); + float _cameraFov = 0.0f; + float _cameraAspectRatio = 0.0f; + float _cameraNearClip = 0.0f; + float _cameraFarClip = 0.0f; + glm::vec3 _cameraEyeOffsetPosition = glm::vec3(0.0f); // octree server sending items - bool _wantColor; - bool _wantDelta; - bool _wantLowResMoving; - bool _wantOcclusionCulling; - bool _wantCompression; - int _maxOctreePPS; - float _octreeElementSizeScale; /// used for LOD calculations - int _boundaryLevelAdjust; /// used for LOD calculations + bool _wantColor = true; + bool _wantDelta = true; + bool _wantLowResMoving = true; + bool _wantOcclusionCulling = false; + bool _wantCompression = false; + int _maxOctreePPS = DEFAULT_MAX_OCTREE_PPS; + float _octreeElementSizeScale = DEFAULT_OCTREE_SIZE_SCALE; /// used for LOD calculations + int _boundaryLevelAdjust = 0; /// used for LOD calculations private: // privatize the copy constructor and assignment operator so they cannot be called