Documentation
    Preparing search index...

    Interface ParticleDrawable

    A scene node that draws a particle system (§36, §49's ParticleSystem).

    Implemented structurally — see the module header for why there is no base class. A node satisfying this shape is picked up by buildRenderList and turned into exactly one ParticleRenderItem.

    // in @fourjs/particles, with no import from @fourjs/render:
    class ParticleRenderable extends Node {
    readonly isParticleDrawable = true;
    renderLayer = 0;
    renderOrder = 0;
    get particleCount(): number { … }
    get particleInstances(): Float32Array { … }
    updateParticleInstances(): void { … }
    }
    interface ParticleDrawable {
        hasTrail?: boolean;
        id: string;
        isParticleDrawable: true;
        particleCount: number;
        particleInstanceFloats?: number;
        particleInstances: Float32Array;
        particleTexture?: true | object;
        renderLayer: number;
        renderOrder: number;
        trailVertexCount?: number;
        trailVertices?: Float32Array<ArrayBufferLike>;
        computeBounds?(outMin: Vector3, outMax: Vector3): boolean;
        updateParticleInstances(): void;
    }
    Index
    hasTrail?: boolean

    Whether this node produces an optional trail ribbon mesh. When true, ParticleDrawable.trailVertexCount and ParticleDrawable.trailVertices are valid after ParticleDrawable.updateParticleInstances.

    id: string

    Stable identity of the emitting node (§6 Node.id), used by a backend as the cache key for this system's GPU buffers — the role BufferGeometry.id plays for geometry (§53).

    isParticleDrawable: true

    The brand buildRenderList recognises. A literal true, not a method, so the check is one property load per node per frame.

    particleCount: number

    Live particle count for the frame — valid only after ParticleDrawable.updateParticleInstances.

    particleInstanceFloats?: number

    Instance stride in floats — 8 by default, 10 when R-32 appearance is opted in. Absent means PARTICLE_INSTANCE_FLOATS.

    particleInstances: Float32Array

    The interleaved upload array described in the module header. Owned by the node, reused every frame, and valid for particleCount × particleInstanceFloats floats.

    Read it, upload it, do not mutate it and do not retain it past the frame: the next updateParticleInstances rewrites it in place.

    particleTexture?: true | object

    Texture-like handle or true. Truthy means the backend should sample map like an unlit sprite.

    renderLayer: number

    Symbolic drawing group (§46, §66 sort key 1), as on Renderable.

    renderOrder: number

    Explicit ordering within a layer (§66 sort key 5), as on Renderable.

    trailVertexCount?: number

    Trail ribbon vertex count for the frame. 0 when hasTrail is false or no segment has ≥ 2 samples yet.

    trailVertices?: Float32Array<ArrayBufferLike>

    Interleaved trail vertices (TRAIL_VERTEX_FLOATS stride). Valid for trailVertexCount × TRAIL_VERTEX_FLOATS floats after repack.

    • Optional live-particle AABB in the node's local space (R-8 follow-up b). @fourjs/particles' ParticleRenderable already publishes this; buildRenderList probes it structurally, converts the box to a world sphere, and sets frustumCulled so §87 can hide an emitter whose particles are all off screen. Absent or false keeps the item un-culled — the shared instance quad is not an honest bound.

      Parameters

      Returns boolean

    • Refreshes ParticleDrawable.particleCount and ParticleDrawable.particleInstances from the current simulation state.

      Called by buildRenderList once per node per build — so a two-viewport frame that builds two lists repacks twice, which is the price of not caching state that a mid-frame step() could invalidate. Must not allocate (plan D7) and must not touch the scene (§42).

      Returns void