mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
force full scene send if json parameters changed
This commit is contained in:
parent
bd340f99ce
commit
33378ede5c
4 changed files with 24 additions and 5 deletions
|
@ -316,8 +316,9 @@ int OctreeSendThread::packetDistributor(SharedNodePointer node, OctreeQueryNode*
|
||||||
int truePacketsSent = 0;
|
int truePacketsSent = 0;
|
||||||
int trueBytesSent = 0;
|
int trueBytesSent = 0;
|
||||||
int packetsSentThisInterval = 0;
|
int packetsSentThisInterval = 0;
|
||||||
bool isFullScene = nodeData->getUsesFrustum() &&
|
bool isFullScene = nodeData->haveJSONParametersChanged() ||
|
||||||
((!viewFrustumChanged && nodeData->getViewFrustumJustStoppedChanging()) || nodeData->hasLodChanged());
|
(nodeData->getUsesFrustum()
|
||||||
|
&& ((!viewFrustumChanged && nodeData->getViewFrustumJustStoppedChanging()) || nodeData->hasLodChanged()));
|
||||||
|
|
||||||
bool somethingToSend = true; // assume we have something
|
bool somethingToSend = true; // assume we have something
|
||||||
|
|
||||||
|
|
|
@ -302,14 +302,15 @@ OctreeElement::AppendState EntityTreeElement::appendElementData(OctreePacketData
|
||||||
includeThisEntity = false;
|
includeThisEntity = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!jsonFilters.isEmpty()) {
|
// if this entity has been updated since our last full send and there are json filters, check them
|
||||||
|
if (includeThisEntity && !jsonFilters.isEmpty()) {
|
||||||
|
|
||||||
// if params include JSON filters, check if this entity matches
|
// if params include JSON filters, check if this entity matches
|
||||||
bool entityMatchesFilters = entity->matchesJSONFilters(jsonFilters);
|
bool entityMatchesFilters = entity->matchesJSONFilters(jsonFilters);
|
||||||
|
|
||||||
if (entityMatchesFilters) {
|
if (entityMatchesFilters) {
|
||||||
// we should include this entity unless it has already been excluded
|
// we should include this entity unless it has already been excluded
|
||||||
includeThisEntity = includeThisEntity && true;
|
includeThisEntity = true;
|
||||||
|
|
||||||
// make sure this entity is in the set of entities sent last frame
|
// make sure this entity is in the set of entities sent last frame
|
||||||
entityNodeData->insertEntitySentLastFrame(entity->getID());
|
entityNodeData->insertEntitySentLastFrame(entity->getID());
|
||||||
|
@ -317,7 +318,7 @@ OctreeElement::AppendState EntityTreeElement::appendElementData(OctreePacketData
|
||||||
} else {
|
} else {
|
||||||
// we might include this entity if it matched in the previous frame
|
// we might include this entity if it matched in the previous frame
|
||||||
if (entityNodeData->sentEntityLastFrame(entity->getID())) {
|
if (entityNodeData->sentEntityLastFrame(entity->getID())) {
|
||||||
includeThisEntity = includeThisEntity && true;
|
includeThisEntity = true;
|
||||||
|
|
||||||
entityNodeData->removeEntitySentLastFrame(entity->getID());
|
entityNodeData->removeEntitySentLastFrame(entity->getID());
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -320,3 +320,15 @@ void OctreeQueryNode::parseNackPacket(ReceivedMessage& message) {
|
||||||
_nackedSequenceNumbers.enqueue(sequenceNumber);
|
_nackedSequenceNumbers.enqueue(sequenceNumber);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool OctreeQueryNode::haveJSONParametersChanged() {
|
||||||
|
bool parametersChanged = false;
|
||||||
|
auto currentParameters = getJSONParameters();
|
||||||
|
|
||||||
|
if (_lastCheckJSONParameters != getJSONParameters()) {
|
||||||
|
parametersChanged = true;
|
||||||
|
_lastCheckJSONParameters = currentParameters;
|
||||||
|
}
|
||||||
|
|
||||||
|
return parametersChanged;
|
||||||
|
}
|
||||||
|
|
|
@ -100,6 +100,9 @@ public:
|
||||||
bool hasNextNackedPacket() const;
|
bool hasNextNackedPacket() const;
|
||||||
const NLPacket* getNextNackedPacket();
|
const NLPacket* getNextNackedPacket();
|
||||||
|
|
||||||
|
// call only from OctreeSendThread for the given node
|
||||||
|
bool haveJSONParametersChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
OctreeQueryNode(const OctreeQueryNode &);
|
OctreeQueryNode(const OctreeQueryNode &);
|
||||||
OctreeQueryNode& operator= (const OctreeQueryNode&);
|
OctreeQueryNode& operator= (const OctreeQueryNode&);
|
||||||
|
@ -143,6 +146,8 @@ private:
|
||||||
quint64 _sceneSendStartTime = 0;
|
quint64 _sceneSendStartTime = 0;
|
||||||
|
|
||||||
std::array<char, udt::MAX_PACKET_SIZE> _lastOctreePayload;
|
std::array<char, udt::MAX_PACKET_SIZE> _lastOctreePayload;
|
||||||
|
|
||||||
|
QJsonObject _lastCheckJSONParameters;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_OctreeQueryNode_h
|
#endif // hifi_OctreeQueryNode_h
|
||||||
|
|
Loading…
Reference in a new issue