Black Trigram (흑괘) - Korean Martial Arts Combat Simulator API - v0.7.9
    Preparing search index...

    ParticlePool Class

    Manages a pool of reusable Three.js Points objects for particle effects. Reduces garbage collection pressure by reusing existing objects.

    const pool = new ParticlePool({ maxSize: 50, particlesPerSystem: 100 });

    // Acquire a particle system
    const material = new THREE.PointsMaterial({ color: 0xff0000, size: 0.1 });
    const points = pool.acquire(100, material);
    scene.add(points);

    // Later, when effect completes
    scene.remove(points);
    pool.release(points);

    // Cleanup when done
    pool.dispose();
    Index

    Constructors

    Methods

    • 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.

      Parameters

      • particleCount: number

        Number of particles needed

      • material: PointsMaterial

        Material to use for the particles

      Returns Points

      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.

      Returns void

    • 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.

      Returns void

    • Get pool statistics

      Returns { active: number; inactive: number; maxSize: number; total: number }

      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.

      Parameters

      • points: Points

        The Points object to release

      Returns void

    • Update all active particle systems

      Call this once per frame to track lifetimes. Useful for debugging and automatic cleanup.

      Parameters

      • delta: number

        Time elapsed since last update (seconds)

      Returns void

    Properties

    debug: boolean
    maxSize: number
    nextId: number = 0
    particlesPerSystem: number
    pool: PooledParticleSystem[] = []