| 1523 | } |
| 1524 | |
| 1525 | void Particles::OnEmitterUnload(ParticleEmitter* emitter) |
| 1526 | { |
| 1527 | PROFILE_CPU(); |
| 1528 | PoolLocker.Lock(); |
| 1529 | const auto entries = Pool.TryGet(emitter); |
| 1530 | if (entries) |
| 1531 | { |
| 1532 | for (int32 i = 0; i < entries->Count(); i++) |
| 1533 | { |
| 1534 | Delete(entries->At(i).Buffer); |
| 1535 | } |
| 1536 | entries->Clear(); |
| 1537 | Pool.Remove(emitter); |
| 1538 | } |
| 1539 | PoolLocker.Unlock(); |
| 1540 | |
| 1541 | #if COMPILE_WITH_GPU_PARTICLES |
| 1542 | GpuUpdateListLocker.Lock(); |
| 1543 | for (int32 i = GpuUpdateList.Count() - 1; i >= 0; i--) |
| 1544 | { |
| 1545 | if (GpuUpdateList[i]->Instance.ContainsEmitter(emitter)) |
| 1546 | GpuUpdateList.RemoveAt(i); |
| 1547 | } |
| 1548 | GpuUpdateListLocker.Unlock(); |
| 1549 | #endif |
| 1550 | } |
| 1551 | |
| 1552 | bool ParticleManagerService::Init() |
| 1553 | { |