void EntitySimulation::getEntitiesToDelete(VectorOfEntities& entitiesToDelete) { for (auto entity : _entitiesToDelete) { // this entity is still in its tree, so we insert into the external list entitiesToDelete.push_back(entity); } _entitiesToDelete.clear(); }
void EntitySimulation::takeEntitiesToDelete(VectorOfEntities& entitiesToDelete) { QMutexLocker lock(&_mutex); for (auto entity : _entitiesToDelete) { // push this entity onto the external list entitiesToDelete.push_back(entity); } _entitiesToDelete.clear(); }
void PhysicalEntitySimulation::takeEntitiesToDelete(VectorOfEntities& entitiesToDelete) { QMutexLocker lock(&_mutex); for (auto entity : _entitiesToDelete) { // this entity is still in its tree, so we insert into the external list entitiesToDelete.push_back(entity); // Someday when we invert the entities/physics lib dependencies we can let EntityItem delete its own PhysicsInfo // rather than do it here EntityMotionState* motionState = static_cast<EntityMotionState*>(entity->getPhysicsInfo()); if (motionState) { _entitiesToRemoveFromPhysics.insert(entity); } } _entitiesToDelete.clear(); }