mirror of
https://github.com/overte-org/overte.git
synced 2025-04-23 04:33:34 +02:00
first cut at fixing the scene not stable bug
This commit is contained in:
parent
247ebb380b
commit
6d211dd4e5
11 changed files with 47 additions and 10 deletions
assignment-client/src/octree
interface/src/ui
libraries
entities/src
octree/src
shared/src
|
@ -124,7 +124,7 @@ AtomicUIntStat OctreeSendThread::_totalSpecialPackets { 0 };
|
|||
|
||||
|
||||
int OctreeSendThread::handlePacketSend(SharedNodePointer node, OctreeQueryNode* nodeData, int& trueBytesSent,
|
||||
int& truePacketsSent) {
|
||||
int& truePacketsSent, bool dontSuppressDuplicate) {
|
||||
OctreeServer::didHandlePacketSend(this);
|
||||
|
||||
// if we're shutting down, then exit early
|
||||
|
@ -141,7 +141,7 @@ int OctreeSendThread::handlePacketSend(SharedNodePointer node, OctreeQueryNode*
|
|||
// Here's where we check to see if this packet is a duplicate of the last packet. If it is, we will silently
|
||||
// obscure the packet and not send it. This allows the callers and upper level logic to not need to know about
|
||||
// this rate control savings.
|
||||
if (nodeData->shouldSuppressDuplicatePacket()) {
|
||||
if (!dontSuppressDuplicate && nodeData->shouldSuppressDuplicatePacket()) {
|
||||
nodeData->resetOctreePacket(); // we still need to reset it though!
|
||||
return packetsSent; // without sending...
|
||||
}
|
||||
|
@ -356,7 +356,7 @@ int OctreeSendThread::packetDistributor(SharedNodePointer node, OctreeQueryNode*
|
|||
//unsigned long encodeTime = nodeData->stats.getTotalEncodeTime();
|
||||
//unsigned long elapsedTime = nodeData->stats.getElapsedTime();
|
||||
|
||||
int packetsJustSent = handlePacketSend(node, nodeData, trueBytesSent, truePacketsSent);
|
||||
int packetsJustSent = handlePacketSend(node, nodeData, trueBytesSent, truePacketsSent, isFullScene);
|
||||
packetsSentThisInterval += packetsJustSent;
|
||||
|
||||
// If we're starting a full scene, then definitely we want to empty the elementBag
|
||||
|
@ -582,6 +582,14 @@ int OctreeSendThread::packetDistributor(SharedNodePointer node, OctreeQueryNode*
|
|||
if (nodeData->elementBag.isEmpty()) {
|
||||
nodeData->updateLastKnownViewFrustum();
|
||||
nodeData->setViewSent(true);
|
||||
|
||||
if (isFullScene) {
|
||||
int thisTrueBytesSent = 0;
|
||||
int thisTruePacketsSent = 0;
|
||||
nodeData->stats.sceneCompleted();
|
||||
// FIXME - are we accounting for packets sent correctly here????
|
||||
int packetsJustSent = handlePacketSend(node, nodeData, thisTrueBytesSent, thisTruePacketsSent, true);
|
||||
}
|
||||
}
|
||||
|
||||
} // end if bag wasn't empty, and so we sent stuff...
|
||||
|
|
|
@ -50,7 +50,7 @@ protected:
|
|||
virtual bool process();
|
||||
|
||||
private:
|
||||
int handlePacketSend(SharedNodePointer node, OctreeQueryNode* nodeData, int& trueBytesSent, int& truePacketsSent);
|
||||
int handlePacketSend(SharedNodePointer node, OctreeQueryNode* nodeData, int& trueBytesSent, int& truePacketsSent, bool dontSuppressDuplicate = false);
|
||||
int packetDistributor(SharedNodePointer node, OctreeQueryNode* nodeData, bool viewFrustumChanged);
|
||||
|
||||
|
||||
|
|
|
@ -220,6 +220,11 @@ void OctreeStatsDialog::paintEvent(QPaintEvent* event) {
|
|||
} else {
|
||||
sendingMode << "S";
|
||||
}
|
||||
if (stats.isFullScene()) {
|
||||
sendingMode << "F";
|
||||
} else {
|
||||
sendingMode << "p";
|
||||
}
|
||||
}
|
||||
});
|
||||
sendingMode << " - " << serverCount << " servers";
|
||||
|
|
|
@ -224,6 +224,12 @@ void Stats::updateStats(bool force) {
|
|||
} else {
|
||||
sendingModeStream << "S";
|
||||
}
|
||||
if (stats.isFullScene()) {
|
||||
sendingModeStream << "F";
|
||||
}
|
||||
else {
|
||||
sendingModeStream << "p";
|
||||
}
|
||||
}
|
||||
|
||||
// calculate server node totals
|
||||
|
|
|
@ -142,6 +142,7 @@ EntityPropertyFlags EntityItem::getEntityProperties(EncodeBitstreamParams& param
|
|||
|
||||
OctreeElement::AppendState EntityItem::appendEntityData(OctreePacketData* packetData, EncodeBitstreamParams& params,
|
||||
EntityTreeElementExtraEncodeData* entityTreeElementExtraEncodeData) const {
|
||||
|
||||
// ALL this fits...
|
||||
// object ID [16 bytes]
|
||||
// ByteCountCoded(type code) [~1 byte]
|
||||
|
|
|
@ -64,6 +64,7 @@ void EntityTreeElement::debugExtraEncodeData(EncodeBitstreamParams& params) cons
|
|||
}
|
||||
|
||||
void EntityTreeElement::initializeExtraEncodeData(EncodeBitstreamParams& params) {
|
||||
|
||||
OctreeElementExtraEncodeData* extraEncodeData = params.extraEncodeData;
|
||||
assert(extraEncodeData); // EntityTrees always require extra encode data on their encoding passes
|
||||
// Check to see if this element yet has encode data... if it doesn't create it
|
||||
|
@ -347,6 +348,12 @@ OctreeElement::AppendState EntityTreeElement::appendElementData(OctreePacketData
|
|||
#endif
|
||||
indexesOfEntitiesToInclude << i;
|
||||
numberOfEntities++;
|
||||
} else {
|
||||
// if the extra data included this entity, and we've decided to not include the entity, then
|
||||
// we can treat it as if it was completed.
|
||||
if (entityTreeElementExtraEncodeData->entities.contains(entity->getEntityItemID())) {
|
||||
entityTreeElementExtraEncodeData->entities.remove(entity->getEntityItemID());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -398,6 +405,9 @@ OctreeElement::AppendState EntityTreeElement::appendElementData(OctreePacketData
|
|||
// After processing, if we are PARTIAL or COMPLETED then we need to re-include our extra data.
|
||||
// Only our parent can remove our extra data in these cases and only after it knows that all of its
|
||||
// children have been encoded.
|
||||
//
|
||||
// FIXME -- this comment seems wrong....
|
||||
//
|
||||
// If we weren't able to encode ANY data about ourselves, then we go ahead and remove our element data
|
||||
// since that will signal that the entire element needs to be encoded on the next attempt
|
||||
if (appendElementState == OctreeElement::NONE) {
|
||||
|
@ -441,9 +451,12 @@ OctreeElement::AppendState EntityTreeElement::appendElementData(OctreePacketData
|
|||
appendElementState = OctreeElement::NONE;
|
||||
} else {
|
||||
if (noEntitiesFit) {
|
||||
appendElementState = OctreeElement::PARTIAL;
|
||||
//appendElementState = OctreeElement::PARTIAL;
|
||||
packetData->discardLevel(elementLevel);
|
||||
appendElementState = OctreeElement::NONE;
|
||||
} else {
|
||||
packetData->endLevel(elementLevel);
|
||||
}
|
||||
packetData->endLevel(elementLevel);
|
||||
}
|
||||
return appendElementState;
|
||||
}
|
||||
|
|
|
@ -942,7 +942,6 @@ int Octree::encodeTreeBitstream(OctreeElementPointer element,
|
|||
int childBytesWritten = encodeTreeBitstreamRecursion(element, packetData, bag, params,
|
||||
currentEncodeLevel, parentLocationThisView);
|
||||
|
||||
|
||||
// if childBytesWritten == 1 then something went wrong... that's not possible
|
||||
assert(childBytesWritten != 1);
|
||||
|
||||
|
@ -1529,7 +1528,6 @@ int Octree::encodeTreeBitstreamRecursion(OctreeElementPointer element,
|
|||
// If we made it this far, then we've written all of our child data... if this element is the root
|
||||
// element, then we also allow the root element to write out it's data...
|
||||
if (continueThisLevel && element == _rootElement && rootElementHasData()) {
|
||||
|
||||
int bytesBeforeChild = packetData->getUncompressedSize();
|
||||
|
||||
// release the bytes we reserved...
|
||||
|
@ -1537,6 +1535,7 @@ int Octree::encodeTreeBitstreamRecursion(OctreeElementPointer element,
|
|||
|
||||
LevelDetails rootDataLevelKey = packetData->startLevel();
|
||||
OctreeElement::AppendState rootAppendState = element->appendElementData(packetData, params);
|
||||
|
||||
bool partOfRootFit = (rootAppendState != OctreeElement::NONE);
|
||||
bool allOfRootFit = (rootAppendState == OctreeElement::COMPLETED);
|
||||
|
||||
|
@ -1571,7 +1570,6 @@ int Octree::encodeTreeBitstreamRecursion(OctreeElementPointer element,
|
|||
qCDebug(octree) << "WARNING UNEXPECTED CASE: Something failed in packing ROOT data";
|
||||
qCDebug(octree) << "This is not expected!!!! -- continueThisLevel=FALSE....";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// if we were unable to fit this level in our packet, then rewind and add it to the element bag for
|
||||
|
|
|
@ -34,6 +34,7 @@ public:
|
|||
/// a single last item will be returned by extract as a null pointer
|
||||
|
||||
void deleteAll();
|
||||
size_t size() const { return _bagElements.size(); }
|
||||
|
||||
private:
|
||||
Bag _bagElements;
|
||||
|
|
|
@ -236,6 +236,8 @@ public:
|
|||
/// the number of bytes in the packet currently reserved
|
||||
int getReservedBytes() { return _bytesReserved; }
|
||||
|
||||
int getBytesAvailable() { return _bytesAvailable; }
|
||||
|
||||
/// displays contents for debugging
|
||||
void debugContent();
|
||||
|
||||
|
|
|
@ -149,6 +149,7 @@ public:
|
|||
const std::vector<unsigned char*>& getJurisdictionEndNodes() const { return _jurisdictionEndNodes; }
|
||||
|
||||
bool isMoving() const { return _isMoving; }
|
||||
bool isFullScene() const { return _isFullScene; }
|
||||
quint64 getTotalElements() const { return _totalElements; }
|
||||
quint64 getTotalInternal() const { return _totalInternal; }
|
||||
quint64 getTotalLeaves() const { return _totalLeaves; }
|
||||
|
|
|
@ -258,9 +258,11 @@ template<typename Enum> inline void PropertyFlags<Enum>::debugDumpBits() {
|
|||
qDebug() << "_minFlag=" << _minFlag;
|
||||
qDebug() << "_maxFlag=" << _maxFlag;
|
||||
qDebug() << "_trailingFlipped=" << _trailingFlipped;
|
||||
QString bits;
|
||||
for(int i = 0; i < _flags.size(); i++) {
|
||||
qDebug() << "bit[" << i << "]=" << _flags.at(i);
|
||||
bits += (_flags.at(i) ? "1" : "0");
|
||||
}
|
||||
qDebug() << "bits:" << bits;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue