mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-10 05:13:02 +02:00
Push down OctreeQueryNode lock to OctreeQuery and use for conical views
Possibly related to https://highfidelity.manuscript.com/f/cases/14165/entity-server-doesn-t-always-relay-added-entities-to-clients
This commit is contained in:
parent
cf917514b4
commit
9bb966dd1d
4 changed files with 19 additions and 13 deletions
|
@ -34,13 +34,16 @@ int OctreeQuery::getBroadcastData(unsigned char* destinationBuffer) {
|
|||
memcpy(destinationBuffer, &_connectionID, sizeof(_connectionID));
|
||||
destinationBuffer += sizeof(_connectionID);
|
||||
|
||||
// Number of frustums
|
||||
uint8_t numFrustums = (uint8_t)_conicalViews.size();
|
||||
memcpy(destinationBuffer, &numFrustums, sizeof(numFrustums));
|
||||
destinationBuffer += sizeof(numFrustums);
|
||||
{
|
||||
QMutexLocker lock(&_conicalViewsLock);
|
||||
// Number of frustums
|
||||
uint8_t numFrustums = (uint8_t)_conicalViews.size();
|
||||
memcpy(destinationBuffer, &numFrustums, sizeof(numFrustums));
|
||||
destinationBuffer += sizeof(numFrustums);
|
||||
|
||||
for (const auto& view : _conicalViews) {
|
||||
destinationBuffer += view.serialize(destinationBuffer);
|
||||
for (const auto& view : _conicalViews) {
|
||||
destinationBuffer += view.serialize(destinationBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
// desired Max Octree PPS
|
||||
|
@ -108,11 +111,14 @@ int OctreeQuery::parseData(ReceivedMessage& message) {
|
|||
memcpy(&numFrustums, sourceBuffer, sizeof(numFrustums));
|
||||
sourceBuffer += sizeof(numFrustums);
|
||||
|
||||
_conicalViews.clear();
|
||||
for (int i = 0; i < numFrustums; ++i) {
|
||||
ConicalViewFrustum view;
|
||||
sourceBuffer += view.deserialize(sourceBuffer);
|
||||
_conicalViews.push_back(view);
|
||||
{
|
||||
QMutexLocker lock(&_conicalViewsLock);
|
||||
_conicalViews.clear();
|
||||
for (int i = 0; i < numFrustums; ++i) {
|
||||
ConicalViewFrustum view;
|
||||
sourceBuffer += view.deserialize(sourceBuffer);
|
||||
_conicalViews.push_back(view);
|
||||
}
|
||||
}
|
||||
|
||||
// desired Max Octree PPS
|
||||
|
|
|
@ -60,6 +60,7 @@ public slots:
|
|||
void setBoundaryLevelAdjust(int boundaryLevelAdjust) { _boundaryLevelAdjust = boundaryLevelAdjust; }
|
||||
|
||||
protected:
|
||||
QMutex _conicalViewsLock;
|
||||
ConicalViewFrustums _conicalViews;
|
||||
|
||||
// octree server sending items
|
||||
|
|
|
@ -153,7 +153,7 @@ bool OctreeQueryNode::updateCurrentViewFrustum() {
|
|||
bool currentViewFrustumChanged = false;
|
||||
|
||||
{ // if there has been a change, then recalculate
|
||||
QMutexLocker viewLocker(&_viewMutex);
|
||||
QMutexLocker lock(&_conicalViewsLock);
|
||||
|
||||
if (_conicalViews.size() == _currentConicalViews.size()) {
|
||||
for (size_t i = 0; i < _conicalViews.size(); ++i) {
|
||||
|
|
|
@ -95,7 +95,6 @@ private:
|
|||
int _duplicatePacketCount { 0 };
|
||||
quint64 _firstSuppressedPacket { usecTimestampNow() };
|
||||
|
||||
mutable QMutex _viewMutex { QMutex::Recursive };
|
||||
ConicalViewFrustums _currentConicalViews;
|
||||
bool _viewFrustumChanging { false };
|
||||
bool _viewFrustumJustStoppedChanging { true };
|
||||
|
|
Loading…
Reference in a new issue