mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 12:08:54 +02:00
Merge branch 'nova' of github.com:AndrewMeadows/hifi into dice-on-table-1
This commit is contained in:
commit
f75eef4295
2 changed files with 18 additions and 0 deletions
|
@ -77,6 +77,8 @@ void EntitySimulation::expireMortalEntities(const quint64& now) {
|
||||||
_entitiesToSort.remove(entity);
|
_entitiesToSort.remove(entity);
|
||||||
_simpleKinematicEntities.remove(entity);
|
_simpleKinematicEntities.remove(entity);
|
||||||
removeEntityInternal(entity);
|
removeEntityInternal(entity);
|
||||||
|
|
||||||
|
_allEntities.remove(entity);
|
||||||
entity->_simulated = false;
|
entity->_simulated = false;
|
||||||
} else {
|
} else {
|
||||||
if (expiry < _nextExpiry) {
|
if (expiry < _nextExpiry) {
|
||||||
|
@ -125,7 +127,10 @@ void EntitySimulation::sortEntitiesThatMoved() {
|
||||||
_entitiesToUpdate.remove(entity);
|
_entitiesToUpdate.remove(entity);
|
||||||
_simpleKinematicEntities.remove(entity);
|
_simpleKinematicEntities.remove(entity);
|
||||||
removeEntityInternal(entity);
|
removeEntityInternal(entity);
|
||||||
|
|
||||||
|
_allEntities.remove(entity);
|
||||||
entity->_simulated = false;
|
entity->_simulated = false;
|
||||||
|
|
||||||
itemItr = _entitiesToSort.erase(itemItr);
|
itemItr = _entitiesToSort.erase(itemItr);
|
||||||
} else {
|
} else {
|
||||||
moveOperator.addEntityToMoveList(entity, newCube);
|
moveOperator.addEntityToMoveList(entity, newCube);
|
||||||
|
@ -153,6 +158,8 @@ void EntitySimulation::addEntity(EntityItem* entity) {
|
||||||
_entitiesToUpdate.insert(entity);
|
_entitiesToUpdate.insert(entity);
|
||||||
}
|
}
|
||||||
addEntityInternal(entity);
|
addEntityInternal(entity);
|
||||||
|
|
||||||
|
_allEntities.insert(entity);
|
||||||
entity->_simulated = true;
|
entity->_simulated = true;
|
||||||
|
|
||||||
// DirtyFlags are used to signal changes to entities that have already been added,
|
// DirtyFlags are used to signal changes to entities that have already been added,
|
||||||
|
@ -166,7 +173,10 @@ void EntitySimulation::removeEntity(EntityItem* entity) {
|
||||||
_mortalEntities.remove(entity);
|
_mortalEntities.remove(entity);
|
||||||
_entitiesToSort.remove(entity);
|
_entitiesToSort.remove(entity);
|
||||||
_simpleKinematicEntities.remove(entity);
|
_simpleKinematicEntities.remove(entity);
|
||||||
|
_entitiesToDelete.remove(entity);
|
||||||
removeEntityInternal(entity);
|
removeEntityInternal(entity);
|
||||||
|
|
||||||
|
_allEntities.remove(entity);
|
||||||
entity->_simulated = false;
|
entity->_simulated = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,7 +237,14 @@ void EntitySimulation::clearEntities() {
|
||||||
_entitiesToUpdate.clear();
|
_entitiesToUpdate.clear();
|
||||||
_entitiesToSort.clear();
|
_entitiesToSort.clear();
|
||||||
_simpleKinematicEntities.clear();
|
_simpleKinematicEntities.clear();
|
||||||
|
_entitiesToDelete.clear();
|
||||||
|
|
||||||
clearEntitiesInternal();
|
clearEntitiesInternal();
|
||||||
|
|
||||||
|
for (auto entityItr : _allEntities) {
|
||||||
|
entityItr->_simulated = false;
|
||||||
|
}
|
||||||
|
_allEntities.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntitySimulation::moveSimpleKinematics(const quint64& now) {
|
void EntitySimulation::moveSimpleKinematics(const quint64& now) {
|
||||||
|
|
|
@ -103,6 +103,7 @@ protected:
|
||||||
|
|
||||||
// We maintain multiple lists, each for its distinct purpose.
|
// We maintain multiple lists, each for its distinct purpose.
|
||||||
// An entity may be in more than one list.
|
// An entity may be in more than one list.
|
||||||
|
SetOfEntities _allEntities; // tracks all entities added the simulation
|
||||||
SetOfEntities _mortalEntities; // entities that have an expiry
|
SetOfEntities _mortalEntities; // entities that have an expiry
|
||||||
quint64 _nextExpiry;
|
quint64 _nextExpiry;
|
||||||
SetOfEntities _entitiesToUpdate; // entities that need to call EntityItem::update()
|
SetOfEntities _entitiesToUpdate; // entities that need to call EntityItem::update()
|
||||||
|
|
Loading…
Reference in a new issue