mirror of
https://github.com/lubosz/overte.git
synced 2025-08-13 02:05:16 +02:00
Reset SafeLanding in all cases
Also remove unused data member, elevate load priority only for entities with collisions, handle case of no nearby entities.
This commit is contained in:
parent
829b83c61d
commit
a891b74fac
3 changed files with 29 additions and 22 deletions
|
@ -5272,6 +5272,7 @@ void Application::resetPhysicsReadyInformation() {
|
||||||
_nearbyEntitiesCountAtLastPhysicsCheck = 0;
|
_nearbyEntitiesCountAtLastPhysicsCheck = 0;
|
||||||
_nearbyEntitiesStabilityCount = 0;
|
_nearbyEntitiesStabilityCount = 0;
|
||||||
_physicsEnabled = false;
|
_physicsEnabled = false;
|
||||||
|
_octreeProcessor.startEntitySequence();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -6324,8 +6325,6 @@ void Application::clearDomainOctreeDetails() {
|
||||||
// reset the model renderer
|
// reset the model renderer
|
||||||
getEntities()->clear();
|
getEntities()->clear();
|
||||||
|
|
||||||
_octreeProcessor.startEntitySequence();
|
|
||||||
|
|
||||||
auto skyStage = DependencyManager::get<SceneScriptingInterface>()->getSkyStage();
|
auto skyStage = DependencyManager::get<SceneScriptingInterface>()->getSkyStage();
|
||||||
|
|
||||||
skyStage->setBackgroundMode(graphics::SunSkyStage::SKY_DEFAULT);
|
skyStage->setBackgroundMode(graphics::SunSkyStage::SKY_DEFAULT);
|
||||||
|
|
|
@ -31,22 +31,22 @@ bool SafeLanding::SequenceLessThan::operator()(const int& a, const int& b) const
|
||||||
}
|
}
|
||||||
|
|
||||||
void SafeLanding::startEntitySequence(QSharedPointer<EntityTreeRenderer> entityTreeRenderer) {
|
void SafeLanding::startEntitySequence(QSharedPointer<EntityTreeRenderer> entityTreeRenderer) {
|
||||||
if (!_trackingEntities) {
|
auto entityTree = entityTreeRenderer->getTree();
|
||||||
auto entityTree = entityTreeRenderer->getTree();
|
|
||||||
|
|
||||||
if (entityTree) {
|
if (entityTree) {
|
||||||
Locker lock(_lock);
|
Locker lock(_lock);
|
||||||
_entityTree = entityTree;
|
_entityTree = entityTree;
|
||||||
_trackingEntities = true;
|
_trackedEntities.clear();
|
||||||
connect(std::const_pointer_cast<EntityTree>(_entityTree).get(),
|
_trackingEntities = true;
|
||||||
&EntityTree::addingEntity, this, &SafeLanding::addTrackedEntity);
|
connect(std::const_pointer_cast<EntityTree>(_entityTree).get(),
|
||||||
connect(std::const_pointer_cast<EntityTree>(_entityTree).get(),
|
&EntityTree::addingEntity, this, &SafeLanding::addTrackedEntity);
|
||||||
&EntityTree::deletingEntity, this, &SafeLanding::deleteTrackedEntity);
|
connect(std::const_pointer_cast<EntityTree>(_entityTree).get(),
|
||||||
_sequenceNumbers.clear();
|
&EntityTree::deletingEntity, this, &SafeLanding::deleteTrackedEntity);
|
||||||
_initialStart = INVALID_SEQUENCE;
|
|
||||||
_initialEnd = INVALID_SEQUENCE;
|
_sequenceNumbers.clear();
|
||||||
EntityTreeRenderer::setEntityLoadingPriorityFunction(&ElevatedPriority);
|
_initialStart = INVALID_SEQUENCE;
|
||||||
}
|
_initialEnd = INVALID_SEQUENCE;
|
||||||
|
EntityTreeRenderer::setEntityLoadingPriorityFunction(&ElevatedPriority);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,7 +70,9 @@ void SafeLanding::addTrackedEntity(const EntityItemID& entityID) {
|
||||||
ModelEntityItem * modelEntity = std::dynamic_pointer_cast<ModelEntityItem>(entity).get();
|
ModelEntityItem * modelEntity = std::dynamic_pointer_cast<ModelEntityItem>(entity).get();
|
||||||
static const std::set<ShapeType> downloadedCollisionTypes
|
static const std::set<ShapeType> downloadedCollisionTypes
|
||||||
{ SHAPE_TYPE_COMPOUND, SHAPE_TYPE_SIMPLE_COMPOUND, SHAPE_TYPE_STATIC_MESH, SHAPE_TYPE_SIMPLE_HULL };
|
{ SHAPE_TYPE_COMPOUND, SHAPE_TYPE_SIMPLE_COMPOUND, SHAPE_TYPE_STATIC_MESH, SHAPE_TYPE_SIMPLE_HULL };
|
||||||
if (downloadedCollisionTypes.count(modelEntity->getShapeType()) != 0) {
|
bool hasAABox;
|
||||||
|
entity->getAABox(hasAABox);
|
||||||
|
if (hasAABox && downloadedCollisionTypes.count(modelEntity->getShapeType()) != 0) {
|
||||||
// Only track entities with downloaded collision bodies.
|
// Only track entities with downloaded collision bodies.
|
||||||
_trackedEntities.emplace(entityID, entity);
|
_trackedEntities.emplace(entityID, entity);
|
||||||
qCDebug(interfaceapp) << "Safe Landing: Tracking entity " << entity->getItemName();
|
qCDebug(interfaceapp) << "Safe Landing: Tracking entity " << entity->getItemName();
|
||||||
|
@ -117,11 +119,14 @@ bool SafeLanding::isLoadSequenceComplete() {
|
||||||
bool SafeLanding::sequenceNumbersComplete() {
|
bool SafeLanding::sequenceNumbersComplete() {
|
||||||
if (_initialStart != INVALID_SEQUENCE) {
|
if (_initialStart != INVALID_SEQUENCE) {
|
||||||
Locker lock(_lock);
|
Locker lock(_lock);
|
||||||
int sequenceSize = _initialStart < _initialEnd ? _initialEnd - _initialStart:
|
int sequenceSize = _initialStart <= _initialEnd ? _initialEnd - _initialStart:
|
||||||
_initialEnd + SEQUENCE_MODULO - _initialStart;
|
_initialEnd + SEQUENCE_MODULO - _initialStart;
|
||||||
auto startIter = _sequenceNumbers.find(_initialStart);
|
auto startIter = _sequenceNumbers.find(_initialStart);
|
||||||
auto endIter = _sequenceNumbers.find(_initialEnd);
|
auto endIter = _sequenceNumbers.find(_initialEnd);
|
||||||
if (startIter != _sequenceNumbers.end() && endIter != _sequenceNumbers.end() && distance(startIter, endIter) == sequenceSize) {
|
if (sequenceSize == 0 ||
|
||||||
|
(startIter != _sequenceNumbers.end()
|
||||||
|
&& endIter != _sequenceNumbers.end()
|
||||||
|
&& distance(startIter, endIter) == sequenceSize) ) {
|
||||||
_trackingEntities = false; // Don't track anything else that comes in.
|
_trackingEntities = false; // Don't track anything else that comes in.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -143,6 +148,10 @@ bool SafeLanding::entityPhysicsComplete() {
|
||||||
return _trackedEntities.empty();
|
return _trackedEntities.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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();
|
||||||
|
|
|
@ -55,9 +55,8 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
std::set<int, SequenceLessThan> _sequenceNumbers;
|
std::set<int, SequenceLessThan> _sequenceNumbers;
|
||||||
std::set<QString> _trackedURLs;
|
|
||||||
|
|
||||||
static float ElevatedPriority(const EntityItem&) { return 10.0f; }
|
static float ElevatedPriority(const EntityItem& entityItem);
|
||||||
static float StandardPriority(const EntityItem&) { return 0.0f; }
|
static float StandardPriority(const EntityItem&) { return 0.0f; }
|
||||||
|
|
||||||
static const int SEQUENCE_MODULO;
|
static const int SEQUENCE_MODULO;
|
||||||
|
|
Loading…
Reference in a new issue