mirror of
https://github.com/overte-org/overte.git
synced 2025-07-23 12:44:03 +02:00
Merge pull request #15875 from SamGondelman/load
BUGZ-910: Return entity load priority operator to proper state after safe landing
This commit is contained in:
commit
00441f1899
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;
|
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 {
|
namespace {
|
||||||
template<typename T> bool lessThanWraparound(int a, int b) {
|
template<typename T> bool lessThanWraparound(int a, int b) {
|
||||||
constexpr int MAX_T_VALUE = std::numeric_limits<T>::max();
|
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(),
|
connect(std::const_pointer_cast<EntityTree>(entityTree).get(),
|
||||||
&EntityTree::deletingEntity, this, &SafeLanding::deleteTrackedEntity);
|
&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);
|
&EntityTree::deletingEntity, this, &SafeLanding::deleteTrackedEntity);
|
||||||
_entityTreeRenderer.reset();
|
_entityTreeRenderer.reset();
|
||||||
}
|
}
|
||||||
EntityTreeRenderer::setEntityLoadingPriorityFunction(StandardPriority);
|
EntityTreeRenderer::setEntityLoadingPriorityFunction(_prevEntityLoadingPriorityOperator);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SafeLanding::trackingIsComplete() const {
|
bool SafeLanding::trackingIsComplete() const {
|
||||||
|
@ -205,10 +211,6 @@ bool SafeLanding::isEntityPhysicsReady(const EntityItemPointer& entity) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
float SafeLanding::ElevatedPriority(const EntityItem& entityItem) {
|
|
||||||
return entityItem.getCollisionless() ? 0.0f : 10.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SafeLanding::debugDumpSequenceIDs() const {
|
void SafeLanding::debugDumpSequenceIDs() const {
|
||||||
int p = -1;
|
int p = -1;
|
||||||
qCDebug(interfaceapp) << "Sequence set size:" << _sequenceNumbers.size();
|
qCDebug(interfaceapp) << "Sequence set size:" << _sequenceNumbers.size();
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
#include "EntityItem.h"
|
#include "EntityItem.h"
|
||||||
#include "EntityDynamicInterface.h"
|
#include "EntityDynamicInterface.h"
|
||||||
|
|
||||||
|
#include "EntityTreeRenderer.h"
|
||||||
|
|
||||||
class EntityTreeRenderer;
|
class EntityTreeRenderer;
|
||||||
class EntityItemID;
|
class EntityItemID;
|
||||||
|
|
||||||
|
@ -64,8 +66,8 @@ private:
|
||||||
|
|
||||||
std::set<int, SequenceLessThan> _sequenceNumbers;
|
std::set<int, SequenceLessThan> _sequenceNumbers;
|
||||||
|
|
||||||
static float ElevatedPriority(const EntityItem& entityItem);
|
static CalculateEntityLoadingPriority entityLoadingOperatorElevateCollidables;
|
||||||
static float StandardPriority(const EntityItem&) { return 0.0f; }
|
CalculateEntityLoadingPriority _prevEntityLoadingPriorityOperator { nullptr };
|
||||||
|
|
||||||
static const int SEQUENCE_MODULO;
|
static const int SEQUENCE_MODULO;
|
||||||
};
|
};
|
||||||
|
|
|
@ -69,6 +69,7 @@ public:
|
||||||
virtual PacketType getExpectedPacketType() const override { return PacketType::EntityData; }
|
virtual PacketType getExpectedPacketType() const override { return PacketType::EntityData; }
|
||||||
|
|
||||||
// Returns the priority at which an entity should be loaded. Higher values indicate higher priority.
|
// 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 float getEntityLoadingPriority(const EntityItem& item) { return _calculateEntityLoadingPriorityFunc(item); }
|
||||||
static void setEntityLoadingPriorityFunction(CalculateEntityLoadingPriority fn) { _calculateEntityLoadingPriorityFunc = fn; }
|
static void setEntityLoadingPriorityFunction(CalculateEntityLoadingPriority fn) { _calculateEntityLoadingPriorityFunc = fn; }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue