| 1559 | } |
| 1560 | |
| 1561 | void ParticleManagerService::Dispose() |
| 1562 | { |
| 1563 | UpdateList.Clear(); |
| 1564 | #if COMPILE_WITH_GPU_PARTICLES |
| 1565 | GpuUpdateList.Clear(); |
| 1566 | if (GpuRenderTask) |
| 1567 | { |
| 1568 | ScopeLock lock(RenderTask::TasksLocker); |
| 1569 | RenderTask::Tasks.Remove(GpuRenderTask); |
| 1570 | Delete(GpuRenderTask); |
| 1571 | GpuRenderTask = nullptr; |
| 1572 | } |
| 1573 | CleanupGPUParticlesSorting(); |
| 1574 | #endif |
| 1575 | |
| 1576 | PoolLocker.Lock(); |
| 1577 | for (auto i = Pool.Begin(); i.IsNotEnd(); ++i) |
| 1578 | { |
| 1579 | auto& entries = i->Value; |
| 1580 | for (int32 j = 0; j < entries.Count(); j++) |
| 1581 | { |
| 1582 | Delete(entries[j].Buffer); |
| 1583 | } |
| 1584 | entries.Clear(); |
| 1585 | } |
| 1586 | Pool.Clear(); |
| 1587 | PoolLocker.Unlock(); |
| 1588 | |
| 1589 | SpriteRenderer.Dispose(); |
| 1590 | SAFE_DELETE(Particles::System); |
| 1591 | } |
| 1592 | |
| 1593 | void ParticlesSystem::Job(int32 index) |
| 1594 | { |