put max-octree-pps in Application rather than in the Octree

This commit is contained in:
Seth Alves 2015-05-11 12:01:13 -07:00
parent 83748096ef
commit de9e74a725
5 changed files with 25 additions and 25 deletions

View file

@ -87,6 +87,7 @@
#include <MessageDialog.h> #include <MessageDialog.h>
#include <InfoView.h> #include <InfoView.h>
#include <SceneScriptingInterface.h> #include <SceneScriptingInterface.h>
#include <SettingHandle.h>
#include "Application.h" #include "Application.h"
#include "AudioClient.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 SKIP_FILENAME = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/hifi.skipversion";
const QString DEFAULT_SCRIPTS_JS_URL = "http://s3.amazonaws.com/hifi-public/scripts/defaultScripts.js"; const QString DEFAULT_SCRIPTS_JS_URL = "http://s3.amazonaws.com/hifi-public/scripts/defaultScripts.js";
Setting::Handle<int> maxOctreePacketsPerSecond("maxOctreePPS", DEFAULT_MAX_OCTREE_PPS);
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
class MyNativeEventFilter : public QAbstractNativeEventFilter { class MyNativeEventFilter : public QAbstractNativeEventFilter {
@ -333,7 +336,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
_isVSyncOn(true), _isVSyncOn(true),
_aboutToQuit(false), _aboutToQuit(false),
_notifiedPacketVersionMismatchThisDomain(false), _notifiedPacketVersionMismatchThisDomain(false),
_domainConnectionRefusals(QList<QString>()) _domainConnectionRefusals(QList<QString>()),
_maxOctreePPS(maxOctreePacketsPerSecond.get())
{ {
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
installNativeEventFilter(&MyNativeEventFilter::getInstance()); installNativeEventFilter(&MyNativeEventFilter::getInstance());
@ -2683,7 +2687,7 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node
int perServerPPS = 0; int perServerPPS = 0;
const int SMALL_BUDGET = 10; const int SMALL_BUDGET = 10;
int perUnknownServer = SMALL_BUDGET; int perUnknownServer = SMALL_BUDGET;
int totalPPS = getEntityTree()->getMaxOctreePacketsPerSecond(); int totalPPS = getMaxOctreePacketsPerSecond();
// determine PPS based on number of servers // determine PPS based on number of servers
if (inViewServers >= 1) { if (inViewServers >= 1) {
@ -4648,3 +4652,14 @@ PickRay Application::computePickRay() const {
bool Application::hasFocus() const { bool Application::hasFocus() const {
return _glWidget->hasFocus(); return _glWidget->hasFocus();
} }
void Application::setMaxOctreePacketsPerSecond(int maxOctreePPS) {
if (maxOctreePPS != _maxOctreePPS) {
_maxOctreePPS = maxOctreePPS;
maxOctreePacketsPerSecond.set(_maxOctreePPS);
}
}
int Application::getMaxOctreePacketsPerSecond() {
return _maxOctreePPS;
}

View file

@ -345,6 +345,9 @@ public:
bool canAcceptURL(const QString& url); bool canAcceptURL(const QString& url);
bool acceptURL(const QString& url); bool acceptURL(const QString& url);
void setMaxOctreePacketsPerSecond(int maxOctreePPS);
int getMaxOctreePacketsPerSecond();
signals: signals:
/// Fired when we're simulating; allows external parties to hook in. /// Fired when we're simulating; allows external parties to hook in.
@ -663,6 +666,8 @@ private:
QList<QString> _domainConnectionRefusals; QList<QString> _domainConnectionRefusals;
glm::uvec2 _renderResolution; glm::uvec2 _renderResolution;
int _maxOctreePPS = DEFAULT_MAX_OCTREE_PPS;
}; };
#endif // hifi_Application_h #endif // hifi_Application_h

View file

@ -168,7 +168,7 @@ void PreferencesDialog::loadPreferences() {
ui.avatarScaleSpin->setValue(myAvatar->getScale()); ui.avatarScaleSpin->setValue(myAvatar->getScale());
ui.maxOctreePPSSpin->setValue(qApp->getEntityTree()->getMaxOctreePacketsPerSecond()); ui.maxOctreePPSSpin->setValue(qApp->getMaxOctreePacketsPerSecond());
ui.oculusUIAngularSizeSpin->setValue(qApp->getApplicationOverlay().getHmdUIAngularSize()); ui.oculusUIAngularSizeSpin->setValue(qApp->getApplicationOverlay().getHmdUIAngularSize());
@ -228,7 +228,7 @@ void PreferencesDialog::savePreferences() {
faceshift->setHostname(ui.faceshiftHostnameEdit->text()); faceshift->setHostname(ui.faceshiftHostnameEdit->text());
qApp->getEntityTree()->setMaxOctreePacketsPerSecond(ui.maxOctreePPSSpin->value()); qApp->setMaxOctreePacketsPerSecond(ui.maxOctreePPSSpin->value());
qApp->getApplicationOverlay().setHmdUIAngularSize(ui.oculusUIAngularSizeSpin->value()); qApp->getApplicationOverlay().setHmdUIAngularSize(ui.oculusUIAngularSizeSpin->value());

View file

@ -40,7 +40,6 @@
#include <SharedUtil.h> #include <SharedUtil.h>
#include <Shape.h> #include <Shape.h>
#include <PathUtils.h> #include <PathUtils.h>
#include <SettingHandle.h>
#include "CoverageMap.h" #include "CoverageMap.h"
#include "OctreeConstants.h" #include "OctreeConstants.h"
@ -51,7 +50,6 @@
QVector<QString> PERSIST_EXTENSIONS = {"svo", "json"}; QVector<QString> PERSIST_EXTENSIONS = {"svo", "json"};
Setting::Handle<int> maxOctreePacketsPerSecond("maxOctreePPS", DEFAULT_MAX_OCTREE_PPS);
float boundaryDistanceForRenderLevel(unsigned int renderLevel, float voxelSizeScale) { float boundaryDistanceForRenderLevel(unsigned int renderLevel, float voxelSizeScale) {
return voxelSizeScale / powf(2, renderLevel); return voxelSizeScale / powf(2, renderLevel);
@ -64,8 +62,7 @@ Octree::Octree(bool shouldReaverage) :
_stopImport(false), _stopImport(false),
_lock(QReadWriteLock::Recursive), _lock(QReadWriteLock::Recursive),
_isViewing(false), _isViewing(false),
_isServer(false), _isServer(false)
_maxOctreePPS(maxOctreePacketsPerSecond.get())
{ {
} }
@ -2203,15 +2200,3 @@ bool Octree::countOctreeElementsOperation(OctreeElement* element, void* extraDat
void Octree::cancelImport() { void Octree::cancelImport() {
_stopImport = true; _stopImport = true;
} }
void Octree::setMaxOctreePacketsPerSecond(int maxOctreePPS) {
if (maxOctreePPS != _maxOctreePPS) {
_maxOctreePPS = maxOctreePPS;
maxOctreePacketsPerSecond.set(_maxOctreePPS);
}
}
int Octree::getMaxOctreePacketsPerSecond() {
return _maxOctreePPS;
}

View file

@ -370,9 +370,6 @@ public:
virtual void dumpTree() { }; virtual void dumpTree() { };
virtual void pruneTree() { }; virtual void pruneTree() { };
void setMaxOctreePacketsPerSecond(int maxOctreePPS);
int getMaxOctreePacketsPerSecond();
signals: signals:
void importSize(float x, float y, float z); void importSize(float x, float y, float z);
void importProgress(int progress); void importProgress(int progress);
@ -406,8 +403,6 @@ protected:
bool _isViewing; bool _isViewing;
bool _isServer; bool _isServer;
int _maxOctreePPS = DEFAULT_MAX_OCTREE_PPS;
}; };
float boundaryDistanceForRenderLevel(unsigned int renderLevel, float voxelSizeScale); float boundaryDistanceForRenderLevel(unsigned int renderLevel, float voxelSizeScale);