mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 07:37:20 +02:00
CR
This commit is contained in:
parent
30d14dcd45
commit
d47ddbd6e4
3 changed files with 8 additions and 10 deletions
|
@ -22,7 +22,7 @@
|
||||||
const float SQRT_TWO_OVER_TWO = 0.7071067811865f;
|
const float SQRT_TWO_OVER_TWO = 0.7071067811865f;
|
||||||
const float DEFAULT_VIEW_RADIUS = 10.0f;
|
const float DEFAULT_VIEW_RADIUS = 10.0f;
|
||||||
|
|
||||||
// ConicalView is an approximation of a ViewFrustum for fast calculation of sort priority.
|
// ConicalViewFrustum is an approximation of a ViewFrustum for fast calculation of sort priority.
|
||||||
class ConicalViewFrustum {
|
class ConicalViewFrustum {
|
||||||
public:
|
public:
|
||||||
ConicalViewFrustum() {}
|
ConicalViewFrustum() {}
|
||||||
|
@ -37,6 +37,7 @@ private:
|
||||||
float _radius { DEFAULT_VIEW_RADIUS };
|
float _radius { DEFAULT_VIEW_RADIUS };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Simple wrapper around a set of conical view frustums
|
||||||
class ConicalView {
|
class ConicalView {
|
||||||
public:
|
public:
|
||||||
ConicalView() {}
|
ConicalView() {}
|
||||||
|
@ -113,7 +114,7 @@ private:
|
||||||
PrioritizedEntity::Compare>;
|
PrioritizedEntity::Compare>;
|
||||||
|
|
||||||
PriorityQueue _queue;
|
PriorityQueue _queue;
|
||||||
// Keep dictionary of al the entities in the queue for fast contain checks.
|
// Keep dictionary of all the entities in the queue for fast contain checks.
|
||||||
std::unordered_set<const EntityItem*> _entities;
|
std::unordered_set<const EntityItem*> _entities;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -138,7 +138,6 @@ void EntityTreeSendThread::traverseTreeAndSendContents(SharedNodePointer node, O
|
||||||
if (entity) {
|
if (entity) {
|
||||||
float priority = PrioritizedEntity::DO_NOT_SEND;
|
float priority = PrioritizedEntity::DO_NOT_SEND;
|
||||||
|
|
||||||
|
|
||||||
if (forceRemove) {
|
if (forceRemove) {
|
||||||
priority = PrioritizedEntity::FORCE_REMOVE;
|
priority = PrioritizedEntity::FORCE_REMOVE;
|
||||||
} else {
|
} else {
|
||||||
|
@ -154,7 +153,6 @@ void EntityTreeSendThread::traverseTreeAndSendContents(SharedNodePointer node, O
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (priority != PrioritizedEntity::DO_NOT_SEND) {
|
if (priority != PrioritizedEntity::DO_NOT_SEND) {
|
||||||
_sendQueue.emplace(entity, priority, forceRemove);
|
_sendQueue.emplace(entity, priority, forceRemove);
|
||||||
}
|
}
|
||||||
|
@ -305,7 +303,8 @@ void EntityTreeSendThread::startNewTraversal(const DiffTraversal::View& view, En
|
||||||
} else {
|
} else {
|
||||||
priority = PrioritizedEntity::WHEN_IN_DOUBT_PRIORITY;
|
priority = PrioritizedEntity::WHEN_IN_DOUBT_PRIORITY;
|
||||||
}
|
}
|
||||||
} else if (entity->getLastEdited() > knownTimestamp->second) {
|
} else if (entity->getLastEdited() > knownTimestamp->second ||
|
||||||
|
entity->getLastChangedOnServer() > knownTimestamp->second) {
|
||||||
// it is known and it changed --> put it on the queue with any priority
|
// it is known and it changed --> put it on the queue with any priority
|
||||||
// TODO: sort these correctly
|
// TODO: sort these correctly
|
||||||
priority = PrioritizedEntity::WHEN_IN_DOUBT_PRIORITY;
|
priority = PrioritizedEntity::WHEN_IN_DOUBT_PRIORITY;
|
||||||
|
@ -339,15 +338,13 @@ void EntityTreeSendThread::startNewTraversal(const DiffTraversal::View& view, En
|
||||||
// See the DiffTraversal::First case for an explanation of the "entity is too small" check
|
// See the DiffTraversal::First case for an explanation of the "entity is too small" check
|
||||||
if ((next.intersection == ViewFrustum::INSIDE || view.intersects(cube)) &&
|
if ((next.intersection == ViewFrustum::INSIDE || view.intersects(cube)) &&
|
||||||
view.isBigEnough(cube)) {
|
view.isBigEnough(cube)) {
|
||||||
// If this entity wasn't in the last view or
|
|
||||||
// If this entity was skipped last time because it was too small, we still need to send it
|
|
||||||
priority = _conicalView.computePriority(cube);
|
priority = _conicalView.computePriority(cube);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
priority = PrioritizedEntity::WHEN_IN_DOUBT_PRIORITY;
|
priority = PrioritizedEntity::WHEN_IN_DOUBT_PRIORITY;
|
||||||
}
|
}
|
||||||
} else if (entity->getLastEdited() > knownTimestamp->second
|
} else if (entity->getLastEdited() > knownTimestamp->second ||
|
||||||
|| entity->getLastChangedOnServer() > knownTimestamp->second) {
|
entity->getLastChangedOnServer() > knownTimestamp->second) {
|
||||||
// it is known and it changed --> put it on the queue with any priority
|
// it is known and it changed --> put it on the queue with any priority
|
||||||
// TODO: sort these correctly
|
// TODO: sort these correctly
|
||||||
priority = PrioritizedEntity::WHEN_IN_DOUBT_PRIORITY;
|
priority = PrioritizedEntity::WHEN_IN_DOUBT_PRIORITY;
|
||||||
|
|
|
@ -221,7 +221,7 @@ DiffTraversal::Type DiffTraversal::prepareNewTraversal(const DiffTraversal::View
|
||||||
//
|
//
|
||||||
// _getNextVisibleElementCallback = identifies elements that need to be traversed,
|
// _getNextVisibleElementCallback = identifies elements that need to be traversed,
|
||||||
// updates VisibleElement ref argument with pointer-to-element and view-intersection
|
// updates VisibleElement ref argument with pointer-to-element and view-intersection
|
||||||
// (INSIDE, INTERSECtT, or OUTSIDE)
|
// (INSIDE, INTERSECT, or OUTSIDE)
|
||||||
//
|
//
|
||||||
// external code should update the _scanElementCallback after calling prepareNewTraversal
|
// external code should update the _scanElementCallback after calling prepareNewTraversal
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in a new issue