mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 19:04:32 +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;
|
||||
}
|
||||
|
||||
bool success = true;
|
||||
QScriptEngine scriptEngine;
|
||||
entityTree->withWriteLock([&] {
|
||||
AvatarEntityMap avatarEntities = getAvatarEntityData();
|
||||
|
@ -268,17 +267,15 @@ void Avatar::updateAvatarEntities() {
|
|||
|
||||
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 (entityTree->updateEntity(entityID, properties)) {
|
||||
entity->updateLastEditedFromRemote();
|
||||
} else {
|
||||
success = false;
|
||||
}
|
||||
} else {
|
||||
entity = entityTree->addEntity(entityID, properties);
|
||||
if (!entity) {
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -295,9 +292,7 @@ void Avatar::updateAvatarEntities() {
|
|||
}
|
||||
});
|
||||
|
||||
if (success) {
|
||||
setAvatarEntityDataChanged(false);
|
||||
}
|
||||
setAvatarEntityDataChanged(false);
|
||||
}
|
||||
|
||||
bool Avatar::shouldDie() const {
|
||||
|
@ -364,6 +359,9 @@ void Avatar::simulate(float deltaTime, bool inView) {
|
|||
measureMotionDerivatives(deltaTime);
|
||||
simulateAttachments(deltaTime);
|
||||
updatePalms();
|
||||
}
|
||||
{
|
||||
PROFILE_RANGE(simulation, "entities");
|
||||
updateAvatarEntities();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue