mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 07:23:39 +02:00
fix bug: performance problem for avatarEntities
This commit is contained in:
parent
ee702f945f
commit
563bf65e89
1 changed files with 7 additions and 9 deletions
|
@ -228,7 +228,6 @@ void Avatar::updateAvatarEntities() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool success = true;
|
|
||||||
QScriptEngine scriptEngine;
|
QScriptEngine scriptEngine;
|
||||||
entityTree->withWriteLock([&] {
|
entityTree->withWriteLock([&] {
|
||||||
AvatarEntityMap avatarEntities = getAvatarEntityData();
|
AvatarEntityMap avatarEntities = getAvatarEntityData();
|
||||||
|
@ -268,17 +267,15 @@ void Avatar::updateAvatarEntities() {
|
||||||
|
|
||||||
EntityItemPointer entity = entityTree->findEntityByEntityItemID(EntityItemID(entityID));
|
EntityItemPointer entity = entityTree->findEntityByEntityItemID(EntityItemID(entityID));
|
||||||
|
|
||||||
|
// NOTE: we don't bother checking whether updateEntity or addEntity succeed here:
|
||||||
|
// if not we'll try again next time the data is changed. This is to close a performance DOS vector
|
||||||
|
// whereby invalid entity data is given to the AvatarMixer and constant retries kill performance.
|
||||||
if (entity) {
|
if (entity) {
|
||||||
if (entityTree->updateEntity(entityID, properties)) {
|
if (entityTree->updateEntity(entityID, properties)) {
|
||||||
entity->updateLastEditedFromRemote();
|
entity->updateLastEditedFromRemote();
|
||||||
} else {
|
|
||||||
success = false;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
entity = entityTree->addEntity(entityID, properties);
|
entity = entityTree->addEntity(entityID, properties);
|
||||||
if (!entity) {
|
|
||||||
success = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -295,10 +292,8 @@ void Avatar::updateAvatarEntities() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (success) {
|
|
||||||
setAvatarEntityDataChanged(false);
|
setAvatarEntityDataChanged(false);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
bool Avatar::shouldDie() const {
|
bool Avatar::shouldDie() const {
|
||||||
const qint64 AVATAR_SILENCE_THRESHOLD_USECS = 5 * USECS_PER_SECOND;
|
const qint64 AVATAR_SILENCE_THRESHOLD_USECS = 5 * USECS_PER_SECOND;
|
||||||
|
@ -364,6 +359,9 @@ void Avatar::simulate(float deltaTime, bool inView) {
|
||||||
measureMotionDerivatives(deltaTime);
|
measureMotionDerivatives(deltaTime);
|
||||||
simulateAttachments(deltaTime);
|
simulateAttachments(deltaTime);
|
||||||
updatePalms();
|
updatePalms();
|
||||||
|
}
|
||||||
|
{
|
||||||
|
PROFILE_RANGE(simulation, "entities");
|
||||||
updateAvatarEntities();
|
updateAvatarEntities();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue