mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 10:37:35 +02:00
max pps for an octree-query is a per-query thing, not an application-wide thing. move the settings-related max-octree-pps stuff into the entity tree
This commit is contained in:
parent
5160eb5b94
commit
83748096ef
9 changed files with 41 additions and 26 deletions
|
@ -290,7 +290,7 @@ int OctreeSendThread::packetDistributor(OctreeQueryNode* nodeData, bool viewFrus
|
||||||
}
|
}
|
||||||
|
|
||||||
// calculate max number of packets that can be sent during this interval
|
// calculate max number of packets that can be sent during this interval
|
||||||
int clientMaxPacketsPerInterval = std::max(1, (nodeData->getMaxOctreePacketsPerSecond() / INTERVALS_PER_SECOND));
|
int clientMaxPacketsPerInterval = std::max(1, (nodeData->getMaxQueryPacketsPerSecond() / INTERVALS_PER_SECOND));
|
||||||
int maxPacketsPerInterval = std::min(clientMaxPacketsPerInterval, _myServer->getPacketsPerClientPerInterval());
|
int maxPacketsPerInterval = std::min(clientMaxPacketsPerInterval, _myServer->getPacketsPerClientPerInterval());
|
||||||
|
|
||||||
int truePacketsSent = 0;
|
int truePacketsSent = 0;
|
||||||
|
|
|
@ -2683,7 +2683,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 = _octreeQuery.getMaxOctreePacketsPerSecond();
|
int totalPPS = getEntityTree()->getMaxOctreePacketsPerSecond();
|
||||||
|
|
||||||
// determine PPS based on number of servers
|
// determine PPS based on number of servers
|
||||||
if (inViewServers >= 1) {
|
if (inViewServers >= 1) {
|
||||||
|
@ -2746,7 +2746,7 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inView) {
|
if (inView) {
|
||||||
_octreeQuery.setMaxOctreePacketsPerSecond(perServerPPS);
|
_octreeQuery.setMaxQueryPacketsPerSecond(perServerPPS);
|
||||||
} else if (unknownView) {
|
} else if (unknownView) {
|
||||||
if (wantExtraDebugging) {
|
if (wantExtraDebugging) {
|
||||||
qCDebug(interfaceapp) << "no known jurisdiction for node " << *node << ", give it budget of "
|
qCDebug(interfaceapp) << "no known jurisdiction for node " << *node << ", give it budget of "
|
||||||
|
@ -2770,9 +2770,9 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node
|
||||||
qCDebug(interfaceapp) << "Using regular camera position for node" << *node;
|
qCDebug(interfaceapp) << "Using regular camera position for node" << *node;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_octreeQuery.setMaxOctreePacketsPerSecond(perUnknownServer);
|
_octreeQuery.setMaxQueryPacketsPerSecond(perUnknownServer);
|
||||||
} else {
|
} else {
|
||||||
_octreeQuery.setMaxOctreePacketsPerSecond(0);
|
_octreeQuery.setMaxQueryPacketsPerSecond(0);
|
||||||
}
|
}
|
||||||
// set up the packet for sending...
|
// set up the packet for sending...
|
||||||
unsigned char* endOfQueryPacket = queryPacket;
|
unsigned char* endOfQueryPacket = queryPacket;
|
||||||
|
|
|
@ -208,6 +208,7 @@ public:
|
||||||
ViewFrustum* getShadowViewFrustum() { return &_shadowViewFrustum; }
|
ViewFrustum* getShadowViewFrustum() { return &_shadowViewFrustum; }
|
||||||
const OctreePacketProcessor& getOctreePacketProcessor() const { return _octreeProcessor; }
|
const OctreePacketProcessor& getOctreePacketProcessor() const { return _octreeProcessor; }
|
||||||
EntityTreeRenderer* getEntities() { return &_entities; }
|
EntityTreeRenderer* getEntities() { return &_entities; }
|
||||||
|
EntityTree* getEntityTree() { return _entities.getTree(); }
|
||||||
Environment* getEnvironment() { return &_environment; }
|
Environment* getEnvironment() { return &_environment; }
|
||||||
QUndoStack* getUndoStack() { return &_undoStack; }
|
QUndoStack* getUndoStack() { return &_undoStack; }
|
||||||
MainWindow* getWindow() { return _window; }
|
MainWindow* getWindow() { return _window; }
|
||||||
|
|
|
@ -168,7 +168,7 @@ void PreferencesDialog::loadPreferences() {
|
||||||
|
|
||||||
ui.avatarScaleSpin->setValue(myAvatar->getScale());
|
ui.avatarScaleSpin->setValue(myAvatar->getScale());
|
||||||
|
|
||||||
ui.maxOctreePPSSpin->setValue(qApp->getOctreeQuery().getMaxOctreePacketsPerSecond());
|
ui.maxOctreePPSSpin->setValue(qApp->getEntityTree()->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->getOctreeQuery().setMaxOctreePacketsPerSecond(ui.maxOctreePPSSpin->value());
|
qApp->getEntityTree()->setMaxOctreePacketsPerSecond(ui.maxOctreePPSSpin->value());
|
||||||
|
|
||||||
qApp->getApplicationOverlay().setHmdUIAngularSize(ui.oculusUIAngularSizeSpin->value());
|
qApp->getApplicationOverlay().setHmdUIAngularSize(ui.oculusUIAngularSizeSpin->value());
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#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"
|
||||||
|
@ -50,6 +51,7 @@
|
||||||
|
|
||||||
|
|
||||||
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);
|
||||||
|
@ -62,7 +64,8 @@ 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())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2201,3 +2204,14 @@ 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -370,6 +370,9 @@ 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);
|
||||||
|
@ -403,6 +406,8 @@ 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);
|
||||||
|
|
|
@ -186,7 +186,7 @@ void OctreeHeadlessViewer::queryOctree() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inView) {
|
if (inView) {
|
||||||
_octreeQuery.setMaxOctreePacketsPerSecond(perServerPPS);
|
_octreeQuery.setMaxQueryPacketsPerSecond(perServerPPS);
|
||||||
if (wantExtraDebugging) {
|
if (wantExtraDebugging) {
|
||||||
qCDebug(octree) << "inView for node " << *node << ", give it budget of " << perServerPPS;
|
qCDebug(octree) << "inView for node " << *node << ", give it budget of " << perServerPPS;
|
||||||
}
|
}
|
||||||
|
@ -213,9 +213,9 @@ void OctreeHeadlessViewer::queryOctree() {
|
||||||
qCDebug(octree) << "Using regular camera position for node" << *node;
|
qCDebug(octree) << "Using regular camera position for node" << *node;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_octreeQuery.setMaxOctreePacketsPerSecond(perUnknownServer);
|
_octreeQuery.setMaxQueryPacketsPerSecond(perUnknownServer);
|
||||||
} else {
|
} else {
|
||||||
_octreeQuery.setMaxOctreePacketsPerSecond(0);
|
_octreeQuery.setMaxQueryPacketsPerSecond(0);
|
||||||
}
|
}
|
||||||
// set up the packet for sending...
|
// set up the packet for sending...
|
||||||
unsigned char* endOfQueryPacket = queryPacket;
|
unsigned char* endOfQueryPacket = queryPacket;
|
||||||
|
|
|
@ -11,22 +11,17 @@
|
||||||
|
|
||||||
#include <GLMHelpers.h>
|
#include <GLMHelpers.h>
|
||||||
#include <PacketHeaders.h>
|
#include <PacketHeaders.h>
|
||||||
#include <SettingHandle.h>
|
|
||||||
|
|
||||||
#include "OctreeConstants.h"
|
#include "OctreeConstants.h"
|
||||||
#include "OctreeQuery.h"
|
#include "OctreeQuery.h"
|
||||||
|
|
||||||
Setting::Handle<int> maxOctreePacketsPerSecond("maxOctreePPS", DEFAULT_MAX_OCTREE_PPS);
|
|
||||||
|
|
||||||
OctreeQuery::OctreeQuery() {
|
OctreeQuery::OctreeQuery() {
|
||||||
_maxOctreePPS = maxOctreePacketsPerSecond.get();
|
_maxQueryPPS = DEFAULT_MAX_OCTREE_PPS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OctreeQuery::setMaxOctreePacketsPerSecond(int maxOctreePPS) {
|
void OctreeQuery::setMaxQueryPacketsPerSecond(int maxQueryPPS) {
|
||||||
if (maxOctreePPS != _maxOctreePPS) {
|
_maxQueryPPS = maxQueryPPS;
|
||||||
_maxOctreePPS = maxOctreePPS;
|
|
||||||
maxOctreePacketsPerSecond.set(_maxOctreePPS);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -59,8 +54,8 @@ int OctreeQuery::getBroadcastData(unsigned char* destinationBuffer) {
|
||||||
*destinationBuffer++ = bitItems;
|
*destinationBuffer++ = bitItems;
|
||||||
|
|
||||||
// desired Max Octree PPS
|
// desired Max Octree PPS
|
||||||
memcpy(destinationBuffer, &_maxOctreePPS, sizeof(_maxOctreePPS));
|
memcpy(destinationBuffer, &_maxQueryPPS, sizeof(_maxQueryPPS));
|
||||||
destinationBuffer += sizeof(_maxOctreePPS);
|
destinationBuffer += sizeof(_maxQueryPPS);
|
||||||
|
|
||||||
// desired voxelSizeScale
|
// desired voxelSizeScale
|
||||||
memcpy(destinationBuffer, &_octreeElementSizeScale, sizeof(_octreeElementSizeScale));
|
memcpy(destinationBuffer, &_octreeElementSizeScale, sizeof(_octreeElementSizeScale));
|
||||||
|
@ -103,8 +98,8 @@ int OctreeQuery::parseData(const QByteArray& packet) {
|
||||||
_wantCompression = oneAtBit(bitItems, WANT_COMPRESSION);
|
_wantCompression = oneAtBit(bitItems, WANT_COMPRESSION);
|
||||||
|
|
||||||
// desired Max Octree PPS
|
// desired Max Octree PPS
|
||||||
memcpy(&_maxOctreePPS, sourceBuffer, sizeof(_maxOctreePPS));
|
memcpy(&_maxQueryPPS, sourceBuffer, sizeof(_maxQueryPPS));
|
||||||
sourceBuffer += sizeof(_maxOctreePPS);
|
sourceBuffer += sizeof(_maxQueryPPS);
|
||||||
|
|
||||||
// desired _octreeElementSizeScale
|
// desired _octreeElementSizeScale
|
||||||
memcpy(&_octreeElementSizeScale, sourceBuffer, sizeof(_octreeElementSizeScale));
|
memcpy(&_octreeElementSizeScale, sourceBuffer, sizeof(_octreeElementSizeScale));
|
||||||
|
|
|
@ -76,7 +76,7 @@ public:
|
||||||
bool getWantLowResMoving() const { return _wantLowResMoving; }
|
bool getWantLowResMoving() const { return _wantLowResMoving; }
|
||||||
bool getWantOcclusionCulling() const { return _wantOcclusionCulling; }
|
bool getWantOcclusionCulling() const { return _wantOcclusionCulling; }
|
||||||
bool getWantCompression() const { return _wantCompression; }
|
bool getWantCompression() const { return _wantCompression; }
|
||||||
int getMaxOctreePacketsPerSecond() const { return _maxOctreePPS; }
|
int getMaxQueryPacketsPerSecond() const { return _maxQueryPPS; }
|
||||||
float getOctreeSizeScale() const { return _octreeElementSizeScale; }
|
float getOctreeSizeScale() const { return _octreeElementSizeScale; }
|
||||||
int getBoundaryLevelAdjust() const { return _boundaryLevelAdjust; }
|
int getBoundaryLevelAdjust() const { return _boundaryLevelAdjust; }
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ public slots:
|
||||||
void setWantDelta(bool wantDelta) { _wantDelta = wantDelta; }
|
void setWantDelta(bool wantDelta) { _wantDelta = wantDelta; }
|
||||||
void setWantOcclusionCulling(bool wantOcclusionCulling) { _wantOcclusionCulling = wantOcclusionCulling; }
|
void setWantOcclusionCulling(bool wantOcclusionCulling) { _wantOcclusionCulling = wantOcclusionCulling; }
|
||||||
void setWantCompression(bool wantCompression) { _wantCompression = wantCompression; }
|
void setWantCompression(bool wantCompression) { _wantCompression = wantCompression; }
|
||||||
void setMaxOctreePacketsPerSecond(int maxOctreePPS);
|
void setMaxQueryPacketsPerSecond(int maxQueryPPS);
|
||||||
void setOctreeSizeScale(float octreeSizeScale) { _octreeElementSizeScale = octreeSizeScale; }
|
void setOctreeSizeScale(float octreeSizeScale) { _octreeElementSizeScale = octreeSizeScale; }
|
||||||
void setBoundaryLevelAdjust(int boundaryLevelAdjust) { _boundaryLevelAdjust = boundaryLevelAdjust; }
|
void setBoundaryLevelAdjust(int boundaryLevelAdjust) { _boundaryLevelAdjust = boundaryLevelAdjust; }
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ protected:
|
||||||
bool _wantLowResMoving = true;
|
bool _wantLowResMoving = true;
|
||||||
bool _wantOcclusionCulling = false;
|
bool _wantOcclusionCulling = false;
|
||||||
bool _wantCompression = false;
|
bool _wantCompression = false;
|
||||||
int _maxOctreePPS = DEFAULT_MAX_OCTREE_PPS;
|
int _maxQueryPPS = DEFAULT_MAX_OCTREE_PPS;
|
||||||
float _octreeElementSizeScale = DEFAULT_OCTREE_SIZE_SCALE; /// used for LOD calculations
|
float _octreeElementSizeScale = DEFAULT_OCTREE_SIZE_SCALE; /// used for LOD calculations
|
||||||
int _boundaryLevelAdjust = 0; /// used for LOD calculations
|
int _boundaryLevelAdjust = 0; /// used for LOD calculations
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue