mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 07:58:59 +02:00
remove optional WANT_COMPRESSION from OctreeQuery
This commit is contained in:
parent
950d020d77
commit
0d9d5375c7
6 changed files with 18 additions and 48 deletions
|
@ -33,8 +33,6 @@ OctreeQueryNode::OctreeQueryNode() :
|
||||||
_lastTimeBagEmpty(0),
|
_lastTimeBagEmpty(0),
|
||||||
_viewFrustumChanging(false),
|
_viewFrustumChanging(false),
|
||||||
_viewFrustumJustStoppedChanging(true),
|
_viewFrustumJustStoppedChanging(true),
|
||||||
_currentPacketIsColor(true),
|
|
||||||
_currentPacketIsCompressed(false),
|
|
||||||
_octreeSendThread(NULL),
|
_octreeSendThread(NULL),
|
||||||
_lastClientBoundaryLevelAdjust(0),
|
_lastClientBoundaryLevelAdjust(0),
|
||||||
_lastClientOctreeSizeScale(DEFAULT_OCTREE_SIZE_SCALE),
|
_lastClientOctreeSizeScale(DEFAULT_OCTREE_SIZE_SCALE),
|
||||||
|
@ -179,14 +177,9 @@ void OctreeQueryNode::resetOctreePacket() {
|
||||||
|
|
||||||
// If we're moving, and the client asked for low res, then we force monochrome, otherwise, use
|
// If we're moving, and the client asked for low res, then we force monochrome, otherwise, use
|
||||||
// the clients requested color state.
|
// the clients requested color state.
|
||||||
_currentPacketIsCompressed = getWantCompression();
|
|
||||||
OCTREE_PACKET_FLAGS flags = 0;
|
OCTREE_PACKET_FLAGS flags = 0;
|
||||||
if (_currentPacketIsColor) {
|
setAtBit(flags, PACKET_IS_COLOR_BIT); // always color
|
||||||
setAtBit(flags, PACKET_IS_COLOR_BIT);
|
setAtBit(flags, PACKET_IS_COMPRESSED_BIT); // always compressed
|
||||||
}
|
|
||||||
if (_currentPacketIsCompressed) {
|
|
||||||
setAtBit(flags, PACKET_IS_COMPRESSED_BIT);
|
|
||||||
}
|
|
||||||
|
|
||||||
_octreePacket->reset();
|
_octreePacket->reset();
|
||||||
|
|
||||||
|
@ -211,10 +204,9 @@ void OctreeQueryNode::writeToPacket(const unsigned char* buffer, unsigned int by
|
||||||
|
|
||||||
// compressed packets include lead bytes which contain compressed size, this allows packing of
|
// compressed packets include lead bytes which contain compressed size, this allows packing of
|
||||||
// multiple compressed portions together
|
// multiple compressed portions together
|
||||||
if (_currentPacketIsCompressed) {
|
OCTREE_PACKET_INTERNAL_SECTION_SIZE sectionSize = bytes;
|
||||||
OCTREE_PACKET_INTERNAL_SECTION_SIZE sectionSize = bytes;
|
_octreePacket->writePrimitive(sectionSize);
|
||||||
_octreePacket->writePrimitive(sectionSize);
|
|
||||||
}
|
|
||||||
if (bytes <= _octreePacket->bytesAvailableForWrite()) {
|
if (bytes <= _octreePacket->bytesAvailableForWrite()) {
|
||||||
_octreePacket->write(reinterpret_cast<const char*>(buffer), bytes);
|
_octreePacket->write(reinterpret_cast<const char*>(buffer), bytes);
|
||||||
_octreePacketWaiting = true;
|
_octreePacketWaiting = true;
|
||||||
|
|
|
@ -75,12 +75,6 @@ public:
|
||||||
quint64 getLastTimeBagEmpty() const { return _lastTimeBagEmpty; }
|
quint64 getLastTimeBagEmpty() const { return _lastTimeBagEmpty; }
|
||||||
void setLastTimeBagEmpty() { _lastTimeBagEmpty = _sceneSendStartTime; }
|
void setLastTimeBagEmpty() { _lastTimeBagEmpty = _sceneSendStartTime; }
|
||||||
|
|
||||||
bool getCurrentPacketIsColor() const { return _currentPacketIsColor; }
|
|
||||||
bool getCurrentPacketIsCompressed() const { return _currentPacketIsCompressed; }
|
|
||||||
bool getCurrentPacketFormatMatches() {
|
|
||||||
return (getCurrentPacketIsCompressed() == getWantCompression());
|
|
||||||
}
|
|
||||||
|
|
||||||
bool hasLodChanged() const { return _lodChanged; }
|
bool hasLodChanged() const { return _lodChanged; }
|
||||||
|
|
||||||
OctreeSceneStats stats;
|
OctreeSceneStats stats;
|
||||||
|
@ -133,8 +127,6 @@ private:
|
||||||
quint64 _lastTimeBagEmpty;
|
quint64 _lastTimeBagEmpty;
|
||||||
bool _viewFrustumChanging;
|
bool _viewFrustumChanging;
|
||||||
bool _viewFrustumJustStoppedChanging;
|
bool _viewFrustumJustStoppedChanging;
|
||||||
bool _currentPacketIsColor;
|
|
||||||
bool _currentPacketIsCompressed;
|
|
||||||
|
|
||||||
OctreeSendThread* _octreeSendThread;
|
OctreeSendThread* _octreeSendThread;
|
||||||
|
|
||||||
|
|
|
@ -321,22 +321,18 @@ int OctreeSendThread::packetDistributor(OctreeQueryNode* nodeData, bool viewFrus
|
||||||
// If we're starting a fresh packet, then...
|
// If we're starting a fresh packet, then...
|
||||||
// If we're moving, and the client asked for low res, then we force monochrome, otherwise, use
|
// If we're moving, and the client asked for low res, then we force monochrome, otherwise, use
|
||||||
// the clients requested color state.
|
// the clients requested color state.
|
||||||
bool wantCompression = nodeData->getWantCompression();
|
|
||||||
|
|
||||||
// If we have a packet waiting, and our desired want color, doesn't match the current waiting packets color
|
// If we have a packet waiting, and our desired want color, doesn't match the current waiting packets color
|
||||||
// then let's just send that waiting packet.
|
// then let's just send that waiting packet.
|
||||||
if (!nodeData->getCurrentPacketFormatMatches()) {
|
if (nodeData->isPacketWaiting()) {
|
||||||
if (nodeData->isPacketWaiting()) {
|
packetsSentThisInterval += handlePacketSend(nodeData, trueBytesSent, truePacketsSent);
|
||||||
packetsSentThisInterval += handlePacketSend(nodeData, trueBytesSent, truePacketsSent);
|
} else {
|
||||||
} else {
|
nodeData->resetOctreePacket();
|
||||||
nodeData->resetOctreePacket();
|
|
||||||
}
|
|
||||||
int targetSize = MAX_OCTREE_PACKET_DATA_SIZE;
|
|
||||||
if (wantCompression) {
|
|
||||||
targetSize = nodeData->getAvailable() - sizeof(OCTREE_PACKET_INTERNAL_SECTION_SIZE);
|
|
||||||
}
|
|
||||||
_packetData.changeSettings(wantCompression, targetSize);
|
|
||||||
}
|
}
|
||||||
|
int targetSize = MAX_OCTREE_PACKET_DATA_SIZE;
|
||||||
|
targetSize = nodeData->getAvailable() - sizeof(OCTREE_PACKET_INTERNAL_SECTION_SIZE);
|
||||||
|
|
||||||
|
_packetData.changeSettings(true, targetSize); // FIXME - eventually support only compressed packets
|
||||||
|
|
||||||
const ViewFrustum* lastViewFrustum = wantDelta ? &nodeData->getLastKnownViewFrustum() : NULL;
|
const ViewFrustum* lastViewFrustum = wantDelta ? &nodeData->getLastKnownViewFrustum() : NULL;
|
||||||
|
|
||||||
|
@ -522,8 +518,7 @@ int OctreeSendThread::packetDistributor(OctreeQueryNode* nodeData, bool viewFrus
|
||||||
// if for some reason the finalized size is greater than our available size, then probably the "compressed"
|
// if for some reason the finalized size is greater than our available size, then probably the "compressed"
|
||||||
// form actually inflated beyond our padding, and in this case we will send the current packet, then
|
// form actually inflated beyond our padding, and in this case we will send the current packet, then
|
||||||
// write to out new packet...
|
// write to out new packet...
|
||||||
unsigned int writtenSize = _packetData.getFinalizedSize()
|
unsigned int writtenSize = _packetData.getFinalizedSize() + sizeof(OCTREE_PACKET_INTERNAL_SECTION_SIZE);
|
||||||
+ (nodeData->getCurrentPacketIsCompressed() ? sizeof(OCTREE_PACKET_INTERNAL_SECTION_SIZE) : 0);
|
|
||||||
|
|
||||||
if (writtenSize > nodeData->getAvailable()) {
|
if (writtenSize > nodeData->getAvailable()) {
|
||||||
packetsSentThisInterval += handlePacketSend(nodeData, trueBytesSent, truePacketsSent);
|
packetsSentThisInterval += handlePacketSend(nodeData, trueBytesSent, truePacketsSent);
|
||||||
|
@ -539,8 +534,7 @@ int OctreeSendThread::packetDistributor(OctreeQueryNode* nodeData, bool viewFrus
|
||||||
// the packet doesn't have enough space to bother attempting to pack more...
|
// the packet doesn't have enough space to bother attempting to pack more...
|
||||||
bool sendNow = true;
|
bool sendNow = true;
|
||||||
|
|
||||||
if (nodeData->getCurrentPacketIsCompressed() &&
|
if (nodeData->getAvailable() >= MINIMUM_ATTEMPT_MORE_PACKING &&
|
||||||
nodeData->getAvailable() >= MINIMUM_ATTEMPT_MORE_PACKING &&
|
|
||||||
extraPackingAttempts <= REASONABLE_NUMBER_OF_PACKING_ATTEMPTS) {
|
extraPackingAttempts <= REASONABLE_NUMBER_OF_PACKING_ATTEMPTS) {
|
||||||
sendNow = false; // try to pack more
|
sendNow = false; // try to pack more
|
||||||
}
|
}
|
||||||
|
@ -552,9 +546,7 @@ int OctreeSendThread::packetDistributor(OctreeQueryNode* nodeData, bool viewFrus
|
||||||
quint64 packetSendingEnd = usecTimestampNow();
|
quint64 packetSendingEnd = usecTimestampNow();
|
||||||
packetSendingElapsedUsec = (float)(packetSendingEnd - packetSendingStart);
|
packetSendingElapsedUsec = (float)(packetSendingEnd - packetSendingStart);
|
||||||
|
|
||||||
if (wantCompression) {
|
targetSize = nodeData->getAvailable() - sizeof(OCTREE_PACKET_INTERNAL_SECTION_SIZE);
|
||||||
targetSize = nodeData->getAvailable() - sizeof(OCTREE_PACKET_INTERNAL_SECTION_SIZE);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// If we're in compressed mode, then we want to see if we have room for more in this wire packet.
|
// If we're in compressed mode, then we want to see if we have room for more in this wire packet.
|
||||||
// but we've finalized the _packetData, so we want to start a new section, we will do that by
|
// but we've finalized the _packetData, so we want to start a new section, we will do that by
|
||||||
|
@ -564,7 +556,7 @@ int OctreeSendThread::packetDistributor(OctreeQueryNode* nodeData, bool viewFrus
|
||||||
// a larger compressed size then uncompressed size
|
// a larger compressed size then uncompressed size
|
||||||
targetSize = nodeData->getAvailable() - sizeof(OCTREE_PACKET_INTERNAL_SECTION_SIZE) - COMPRESS_PADDING;
|
targetSize = nodeData->getAvailable() - sizeof(OCTREE_PACKET_INTERNAL_SECTION_SIZE) - COMPRESS_PADDING;
|
||||||
}
|
}
|
||||||
_packetData.changeSettings(nodeData->getWantCompression(), targetSize); // will do reset
|
_packetData.changeSettings(true, targetSize); // will do reset - NOTE: Always compressed
|
||||||
|
|
||||||
}
|
}
|
||||||
OctreeServer::trackTreeWaitTime(lockWaitElapsedUsec);
|
OctreeServer::trackTreeWaitTime(lockWaitElapsedUsec);
|
||||||
|
|
|
@ -52,7 +52,6 @@ void OctreeHeadlessViewer::queryOctree() {
|
||||||
// These will be the same for all servers, so we can set them up once and then reuse for each server we send to.
|
// These will be the same for all servers, so we can set them up once and then reuse for each server we send to.
|
||||||
_octreeQuery.setWantLowResMoving(true);
|
_octreeQuery.setWantLowResMoving(true);
|
||||||
_octreeQuery.setWantDelta(true);
|
_octreeQuery.setWantDelta(true);
|
||||||
_octreeQuery.setWantCompression(true); // TODO: should be on by default
|
|
||||||
|
|
||||||
_octreeQuery.setCameraPosition(_viewFrustum.getPosition());
|
_octreeQuery.setCameraPosition(_viewFrustum.getPosition());
|
||||||
_octreeQuery.setCameraOrientation(_viewFrustum.getOrientation());
|
_octreeQuery.setCameraOrientation(_viewFrustum.getOrientation());
|
||||||
|
|
|
@ -42,7 +42,6 @@ int OctreeQuery::getBroadcastData(unsigned char* destinationBuffer) {
|
||||||
unsigned char bitItems = 0;
|
unsigned char bitItems = 0;
|
||||||
if (_wantLowResMoving) { setAtBit(bitItems, WANT_LOW_RES_MOVING_BIT); }
|
if (_wantLowResMoving) { setAtBit(bitItems, WANT_LOW_RES_MOVING_BIT); }
|
||||||
if (_wantDelta) { setAtBit(bitItems, WANT_DELTA_AT_BIT); }
|
if (_wantDelta) { setAtBit(bitItems, WANT_DELTA_AT_BIT); }
|
||||||
if (_wantCompression) { setAtBit(bitItems, WANT_COMPRESSION); }
|
|
||||||
|
|
||||||
*destinationBuffer++ = bitItems;
|
*destinationBuffer++ = bitItems;
|
||||||
|
|
||||||
|
@ -83,7 +82,6 @@ int OctreeQuery::parseData(NLPacket& packet) {
|
||||||
bitItems = (unsigned char)*sourceBuffer++;
|
bitItems = (unsigned char)*sourceBuffer++;
|
||||||
_wantLowResMoving = oneAtBit(bitItems, WANT_LOW_RES_MOVING_BIT);
|
_wantLowResMoving = oneAtBit(bitItems, WANT_LOW_RES_MOVING_BIT);
|
||||||
_wantDelta = oneAtBit(bitItems, WANT_DELTA_AT_BIT);
|
_wantDelta = oneAtBit(bitItems, WANT_DELTA_AT_BIT);
|
||||||
_wantCompression = oneAtBit(bitItems, WANT_COMPRESSION);
|
|
||||||
|
|
||||||
// desired Max Octree PPS
|
// desired Max Octree PPS
|
||||||
memcpy(&_maxQueryPPS, sourceBuffer, sizeof(_maxQueryPPS));
|
memcpy(&_maxQueryPPS, sourceBuffer, sizeof(_maxQueryPPS));
|
||||||
|
|
|
@ -38,7 +38,7 @@ const int WANT_LOW_RES_MOVING_BIT = 0;
|
||||||
const int UNUSED_BIT_1 = 1; // unused... available for new feature
|
const int UNUSED_BIT_1 = 1; // unused... available for new feature
|
||||||
const int WANT_DELTA_AT_BIT = 2;
|
const int WANT_DELTA_AT_BIT = 2;
|
||||||
const int UNUSED_BIT_3 = 3; // unused... available for new feature
|
const int UNUSED_BIT_3 = 3; // unused... available for new feature
|
||||||
const int WANT_COMPRESSION = 4; // 5th bit
|
const int UNUSED_BIT_4 = 4; // 5th bit... unused... available for new feature
|
||||||
|
|
||||||
class OctreeQuery : public NodeData {
|
class OctreeQuery : public NodeData {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -73,7 +73,6 @@ public:
|
||||||
// related to Octree Sending strategies
|
// related to Octree Sending strategies
|
||||||
bool getWantDelta() const { return _wantDelta; }
|
bool getWantDelta() const { return _wantDelta; }
|
||||||
bool getWantLowResMoving() const { return _wantLowResMoving; }
|
bool getWantLowResMoving() const { return _wantLowResMoving; }
|
||||||
bool getWantCompression() const { return _wantCompression; }
|
|
||||||
int getMaxQueryPacketsPerSecond() const { return _maxQueryPPS; }
|
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; }
|
||||||
|
@ -81,7 +80,6 @@ public:
|
||||||
public slots:
|
public slots:
|
||||||
void setWantLowResMoving(bool wantLowResMoving) { _wantLowResMoving = wantLowResMoving; }
|
void setWantLowResMoving(bool wantLowResMoving) { _wantLowResMoving = wantLowResMoving; }
|
||||||
void setWantDelta(bool wantDelta) { _wantDelta = wantDelta; }
|
void setWantDelta(bool wantDelta) { _wantDelta = wantDelta; }
|
||||||
void setWantCompression(bool wantCompression) { _wantCompression = wantCompression; }
|
|
||||||
void setMaxQueryPacketsPerSecond(int maxQueryPPS) { _maxQueryPPS = maxQueryPPS; }
|
void setMaxQueryPacketsPerSecond(int maxQueryPPS) { _maxQueryPPS = 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; }
|
||||||
|
@ -99,7 +97,6 @@ protected:
|
||||||
// octree server sending items
|
// octree server sending items
|
||||||
bool _wantDelta = true;
|
bool _wantDelta = true;
|
||||||
bool _wantLowResMoving = true;
|
bool _wantLowResMoving = true;
|
||||||
bool _wantCompression = false;
|
|
||||||
int _maxQueryPPS = 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