setInstanceAttributes method
Writes every declared per-instance attribute of the instance at index
from packed, in declaration order.
This is the raw path for hot loops. packed is the instance's slice of
the instance-rate record, so its length is the material's packed
attribute width including the pad float a vec3 carries; the throw names
the expected length.
Implementation
void setInstanceAttributes(int index, Float32List packed) {
RangeError.checkValidIndex(index, _instances, 'index');
final schema = _requireSchema(null);
if (packed.length != schema.floatCount) {
throw ArgumentError(
'This material packs ${schema.floatCount} instance attribute float(s) '
'per instance, but ${packed.length} were supplied.',
);
}
_attributeData.setAll(index * schema.floatCount, packed);
_revision++;
}