Documentation
    Preparing search index...

    Class MorphWeights

    Per-node morph-target weights (§54, §14, §17; RFC 0003 §1c) — the storage behind Mesh.morphTargetWeights, placed where the frozen §3.1 matrix lets @fourjs/animation bind it.

    const weights = mesh.addComponent(new MorphWeights(2)); // two targets, at 0
    weights.weights[0] = 0.5; // authored write

    // §17's morph-weight track is a number track over one element (see
    // @fourjs/animation's binding.ts — "weights.0" addresses weights[0]):
    new AnimationTrack({ path: "weights.0", adapter: numberAdapter, ... });

    One per node (§6a). Holds authored state only: which morph target the weights mean is the geometry's business (the GPU morph path — additional vertex streams — is deferred by RFC 0003 §7 and staged in @fourjs/render's Mesh; this component, the binding form, and the render-item snapshot are the plumbing that ships now, so §14's morph-target animation is expressible and a document can carry the weights).

    Weights are not clamped: §17's tracks legitimately overshoot (cubic anticipation), and morph weights outside 0…1 are meaningful (overdrive, negative targets). §85 checks finiteness at construction; in-place writes are the fast path and are not re-validated, exactly as geometry attributes are not.

    Implements

    Index
    • Builds the component with count zero weights, or over weights — a Float32Array is held by reference (the caller may already share it with a loader), any other array-like is copied.

      Parameters

      • weights: number | readonly number[] | Float32Array<ArrayBufferLike>

      Returns MorphWeights

      FourError INVALID_SCENE_GRAPH (§85) for a count that is not a positive integer, an empty array, or a non-finite weight.

    host: ComponentHost | null

    The node this component is attached to, or null. Written by the ComponentRegistry alone (§6a); never assign it.

    weights: Float32Array

    One weight per morph target, index-parallel with the geometry's (future) target streams. Held by reference and written in place — by the application, or by a §17 morph-weight track bound to one element — so the render list can snapshot the array itself onto the render item with no copy.

    typeName: "morph-weights"

    Component key (plan D2) and §79 serialization name.