withMaterialValues method
This model with its materials' values replaced by values (one per
material, in order), sharing its buffers and textures: what a
material preview shows while the values change, uploading nothing.
Implementation
GpuModel withMaterialValues(List<MaterialData> values) {
if (values.length != materials.length) {
throw ArgumentError.value(
values.length,
'values',
'expected ${materials.length} materials',
);
}
return GpuModel._(data, meshes, [
for (var i = 0; i < values.length; i++)
GpuMaterial._(values[i], materials[i].textures),
], fallbackMaterial);
}