mirror of
https://github.com/overte-org/overte.git
synced 2025-04-09 13:02:24 +02:00
return entity load priority operator to proper state
This commit is contained in:
parent
a3ec365f6c
commit
4973563c20
3 changed files with 13 additions and 8 deletions
|
@ -19,6 +19,11 @@
|
|||
|
||||
const int SafeLanding::SEQUENCE_MODULO = std::numeric_limits<OCTREE_PACKET_SEQUENCE>::max() + 1;
|
||||
|
||||
CalculateEntityLoadingPriority SafeLanding::entityLoadingOperatorElevateCollidables = [](const EntityItem& entityItem) {
|
||||
const int COLLIDABLE_ENTITY_PRIORITY = 10.0f;
|
||||
return entityItem.getCollisionless() * COLLIDABLE_ENTITY_PRIORITY;
|
||||
};
|
||||
|
||||
namespace {
|
||||
template<typename T> bool lessThanWraparound(int a, int b) {
|
||||
constexpr int MAX_T_VALUE = std::numeric_limits<T>::max();
|
||||
|
@ -52,7 +57,8 @@ void SafeLanding::startTracking(QSharedPointer<EntityTreeRenderer> entityTreeRen
|
|||
connect(std::const_pointer_cast<EntityTree>(entityTree).get(),
|
||||
&EntityTree::deletingEntity, this, &SafeLanding::deleteTrackedEntity);
|
||||
|
||||
EntityTreeRenderer::setEntityLoadingPriorityFunction(&ElevatedPriority);
|
||||
_prevEntityLoadingPriorityOperator = EntityTreeRenderer::getEntityLoadingPriorityOperator();
|
||||
EntityTreeRenderer::setEntityLoadingPriorityFunction(entityLoadingOperatorElevateCollidables);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -162,7 +168,7 @@ void SafeLanding::stopTracking() {
|
|||
&EntityTree::deletingEntity, this, &SafeLanding::deleteTrackedEntity);
|
||||
_entityTreeRenderer.reset();
|
||||
}
|
||||
EntityTreeRenderer::setEntityLoadingPriorityFunction(StandardPriority);
|
||||
EntityTreeRenderer::setEntityLoadingPriorityFunction(_prevEntityLoadingPriorityOperator);
|
||||
}
|
||||
|
||||
bool SafeLanding::trackingIsComplete() const {
|
||||
|
@ -205,10 +211,6 @@ bool SafeLanding::isEntityPhysicsReady(const EntityItemPointer& entity) {
|
|||
return true;
|
||||
}
|
||||
|
||||
float SafeLanding::ElevatedPriority(const EntityItem& entityItem) {
|
||||
return entityItem.getCollisionless() ? 0.0f : 10.0f;
|
||||
}
|
||||
|
||||
void SafeLanding::debugDumpSequenceIDs() const {
|
||||
int p = -1;
|
||||
qCDebug(interfaceapp) << "Sequence set size:" << _sequenceNumbers.size();
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
#include "EntityItem.h"
|
||||
#include "EntityDynamicInterface.h"
|
||||
|
||||
#include "EntityTreeRenderer.h"
|
||||
|
||||
class EntityTreeRenderer;
|
||||
class EntityItemID;
|
||||
|
||||
|
@ -64,8 +66,8 @@ private:
|
|||
|
||||
std::set<int, SequenceLessThan> _sequenceNumbers;
|
||||
|
||||
static float ElevatedPriority(const EntityItem& entityItem);
|
||||
static float StandardPriority(const EntityItem&) { return 0.0f; }
|
||||
static CalculateEntityLoadingPriority entityLoadingOperatorElevateCollidables;
|
||||
CalculateEntityLoadingPriority _prevEntityLoadingPriorityOperator { nullptr };
|
||||
|
||||
static const int SEQUENCE_MODULO;
|
||||
};
|
||||
|
|
|
@ -69,6 +69,7 @@ public:
|
|||
virtual PacketType getExpectedPacketType() const override { return PacketType::EntityData; }
|
||||
|
||||
// Returns the priority at which an entity should be loaded. Higher values indicate higher priority.
|
||||
static CalculateEntityLoadingPriority getEntityLoadingPriorityOperator() { return _calculateEntityLoadingPriorityFunc; }
|
||||
static float getEntityLoadingPriority(const EntityItem& item) { return _calculateEntityLoadingPriorityFunc(item); }
|
||||
static void setEntityLoadingPriorityFunction(CalculateEntityLoadingPriority fn) { _calculateEntityLoadingPriorityFunc = fn; }
|
||||
|
||||
|
|
Loading…
Reference in a new issue