three-nebula API
    Preparing search index...

    Class System

    The core of the three-system particle engine. A System instance can contain multiple emitters, each with their own initializers and behaviours.

    Index
    • Parameters

      • preParticles: number = POOL_MAX
      • integrationType: string = INTEGRATION_TYPE_EULER
      • seed: number = ...

      Returns System

    _accumulator: number
    _detached: Emitter[]
    _emitterPoolHits: number
    _emitterPoolMisses: number
    _liveEmitterInstances: number
    _warnedInstanceOverflow: boolean
    canUpdate: boolean
    emitters: Emitter[]
    eventDispatcher: EventDispatcher
    fixedTimeStep: number
    integrationType: string
    maxEmitterDepth: number
    maxEmitterInstances: number
    maxSubSteps: number
    pool: Pool
    preParticles: number
    renderers: BaseRenderer[]
    seed: number
    type: string
    • Detaches a child instance from its (dead or absent) parent: it keeps updating so its already-emitted particles live out their lives, then is released once drained (see _updateDetached). Used by the detach orphan policy (stopEmitting true) and by death-trigger event bursts, which stay emitting so their one-shot burst fires after detachment (stopEmitting false — their own totalEmitTimes/life then bounds emission).

      Parameters

      • inst: Emitter
      • stopEmitting: boolean = true

      Returns void

    • Kills a child instance with its parent (the kill policy): recursively kills its own descendants, expires its particles (dispatching PARTICLE_DEAD so renderers free them), then releases it immediately.

      Parameters

      Returns void

    • Advances detached instances (parents already dead) and releases each once it has fully drained. Runs after the emitter walk so freshly-detached instances still tick this frame. Flushes SYSTEM_UPDATE if any still hold particles so renderer buffers pick up their movement.

      Parameters

      • time: number

      Returns void

    • Adds an emitter to the System instance. Dispatches the EMITTER_ADDED event.

      Parameters

      Returns this

    • Adds a renderer to the System instance and initializes it.

      Parameters

      • renderer: BaseRenderer

      Returns this

    • Destroys all emitters, renderers and the Nebula pool.

      Returns void

    • Proxy method for the internal event dispatcher's dispatchEvent method.

      Parameters

      • event: string
      • target: unknown = ...

      Returns void

    • Wires up life cycle methods and causes a system's emitters to emit particles.

      Parameters

      • __namedParameters: LifeCycleHooks

      Returns Promise<unknown[]> | undefined

    • Gets a count of the total number of particles in the system.

      Returns number

    • Releases a child emitter instance back to its node's free-list and updates the live count. The caller guarantees the instance has drained its particles.

      Parameters

      Returns void

    • Removes an emitter from the System instance. Dispatches the EMITTER_REMOVED event.

      Parameters

      Returns this

    • Removes a renderer from the System instance.

      Parameters

      • renderer: BaseRenderer

      Returns this

    • Sets the system seed and re-derives every attached emitter's stream, so the whole system becomes reproducible from this seed. Call before emitting for fully deterministic output.

      Parameters

      • seed: number

      Returns this

    • Acquires a child emitter instance of node bound to parentParticle, honouring the global live-instance cap. On overflow the newest spawn is dropped (the right default for FX) and a one-time warning is logged so the cap is never hit silently. Returns the instance, or null when dropped.

      Parameters

      Returns Emitter | null

    • Advances the simulation by the real elapsed time realDt (seconds), consuming it in fixed fixedTimeStep increments (Stage 3 — the fixed-timestep accumulator). Drive this from a requestAnimationFrame loop for playback that is independent of the display's refresh rate; calling update() once per frame instead ties simulation speed to how often it's called (2x on a 120Hz display). Sub-steps are clamped to maxSubSteps per call so a long stall (e.g. a backgrounded tab) can't spiral — excess time is dropped.

      This is the real-time driver, not a replacement for update: deterministic stepping (headless render, seek, tests) should keep calling update(), which remains the single-fixed-step primitive.

      Parameters

      • realDt: number

      Returns Promise<void>

    • Updates the particle system based on the delta passed.

      Parameters

      • delta: number = DEFAULT_SYSTEM_DELTA

      Returns Promise<void>

    • Creates a System instance from a JSON object.

      Parameters

      • json: SystemJSON
      • THREE: __module

      Returns System

      use fromJSONAsync instead

    • Loads a System instance from JSON asynchronously. Ensures all textures are fully loaded before resolving with the instantiated System instance.

      Parameters

      • json: SystemJSON
      • THREE: __module
      • Optionaloptions: FromJSONAsyncOptions

      Returns Promise<System>