Create a new particle pool
Pool configuration
Acquire a particle system from the pool
Returns an existing inactive system if available, otherwise creates a new one. If pool is full, reuses the oldest active system.
Number of particles needed
Material to use for the particles
A Three.js Points object ready to use
Clear inactive particle systems
Removes inactive systems from the pool to free memory. Useful for managing memory in long-running sessions.
Dispose all pooled particle systems
Cleans up all geometries and materials. Call this when the pool is no longer needed.
⚠️ Warning: Materials are disposed! If materials are shared between multiple particle systems outside the pool, dispose them separately.
Get pool statistics
Object containing pool stats
Release a particle system back to the pool
Marks the system as inactive so it can be reused. The material is NOT disposed as it may be shared or reused.
The Points object to release
Update all active particle systems
Call this once per frame to track lifetimes. Useful for debugging and automatic cleanup.
Time elapsed since last update (seconds)
ParticlePool Class
Manages a pool of reusable Three.js Points objects for particle effects. Reduces garbage collection pressure by reusing existing objects.
Example