AdvancedReadonlyfieldsEach field's first float within a slot's row
ReadonlyoffsetFloat index of slot 0's row in data
ReadonlystrideFloats from one slot's row to the next in data
The instance data as floats; it stays valid across unload(), but not past destroy()
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.
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.
The first slot that changed
How many slots changed; defaults to every slot from first on
The instance data of a BatchedMesh3D as one float array, for rewriting many slots a frame
Field
nameof slotiis the four numbers fromoffset + i * stride + fields[name]. Call update once you're done, or the writes may never be uploaded:Write
vec4<u32>andvec4<i32>fields through u32Data, which views the same memory at the same indices. The matrices are a separate array, BatchedMesh3D.matrices, with their ownstrideandoffset, andupdate()here uploads none of them. Readstride,offsetandfieldsrather than hard-coding them, since the layout can change between releases.