@pixi/3d
    Preparing search index...

    Class BatchInstanceDataAdvanced

    The instance data of a BatchedMesh3D as one float array, for rewriting many slots a frame

    Field name of slot i is the four numbers from offset + i * stride + fields[name]. Call update once you're done, or the writes may never be uploaded:

    const { data, stride, offset, fields } = batched.instanceData;

    for (let i = 0, o = offset + fields.look; i < batched.size; i++, o += stride) {
    data[o + 3] = glow[i];
    }

    batched.instanceData.update();

    Write vec4<u32> and vec4<i32> fields through u32Data, which views the same memory at the same indices. The matrices are a separate array, BatchedMesh3D.matrices, with their own stride and offset, and update() here uploads none of them. Read stride, offset and fields rather than hard-coding them, since the layout can change between releases.

    Index
    fields: Readonly<Record<string, number>>

    Each field's first float within a slot's row

    offset: number = 0

    Float index of slot 0's row in data

    stride: number = 0

    Floats from one slot's row to the next in data

    • get data(): Float32Array

      The instance data as floats; it stays valid across unload(), but not past destroy()

      Returns Float32Array

    • get u32Data(): Uint32Array

      The same memory as data, as unsigned integers

      A negative number written here keeps its bits, so it reads back negative from a vec4<i32> field.

      Returns Uint32Array

    • Uploads the instance data written in place on the next render

      Pass the range that changed to upload only those slots. Throws a RangeError for a range outside the batch. Once it's called, every slot marked before the next render uploads as one span, from the lowest to the highest, so for a few scattered slots use setInstanceDataAt alone.

      Parameters

      • first: number = 0

        The first slot that changed

      • count: number = ...

        How many slots changed; defaults to every slot from first on

      Returns void