mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01: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 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 {
|
||||
public:
|
||||
ConicalViewFrustum() {}
|
||||
|
@ -37,6 +37,7 @@ private:
|
|||
float _radius { DEFAULT_VIEW_RADIUS };
|
||||
};
|
||||
|
||||
// Simple wrapper around a set of conical view frustums
|
||||
class ConicalView {
|
||||
public:
|
||||
ConicalView() {}
|
||||
|
@ -113,7 +114,7 @@ private:
|
|||
PrioritizedEntity::Compare>;
|
||||
|
||||
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;
|
||||
|
||||
};
|
||||
|
|
|
@ -138,7 +138,6 @@ void EntityTreeSendThread::traverseTreeAndSendContents(SharedNodePointer node, O
|
|||
if (entity) {
|
||||
float priority = PrioritizedEntity::DO_NOT_SEND;
|
||||
|
||||
|
||||
if (forceRemove) {
|
||||
priority = PrioritizedEntity::FORCE_REMOVE;
|
||||
} else {
|
||||
|
@ -154,7 +153,6 @@ void EntityTreeSendThread::traverseTreeAndSendContents(SharedNodePointer node, O
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
if (priority != PrioritizedEntity::DO_NOT_SEND) {
|
||||
_sendQueue.emplace(entity, priority, forceRemove);
|
||||
}
|
||||
|
@ -305,7 +303,8 @@ void EntityTreeSendThread::startNewTraversal(const DiffTraversal::View& view, En
|
|||
} else {
|
||||
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
|
||||
// TODO: sort these correctly
|
||||
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
|
||||
if ((next.intersection == ViewFrustum::INSIDE || view.intersects(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);
|
||||
}
|
||||
} else {
|
||||
priority = PrioritizedEntity::WHEN_IN_DOUBT_PRIORITY;
|
||||
}
|
||||
} else if (entity->getLastEdited() > knownTimestamp->second
|
||||
|| entity->getLastChangedOnServer() > 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
|
||||
// TODO: sort these correctly
|
||||
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,
|
||||
// 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
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue