resource property
The resource data.
Implementation
@override
ByteBuffer? get resource {
if (super.resource == null) {
var previousIndex = -1;
final entries = _storage.entries.toList()
..sort(Comparing.on((c) => c.key));
final data = entries.fold<List<double>>([], (p, e) {
if (previousIndex + 1 != e.key) {
final field =
slot.fields.indexed.firstWhere((e) => e.$1 == previousIndex + 1);
throw StateError('Uniform ${slot.name}.${field.$2} was not set');
}
previousIndex = e.key;
return p..addAll(e.value.data);
});
super.resource = Float32List.fromList(data).buffer;
}
return super.resource;
}
Implementation
@protected
set resource(R resource) => _resource = resource;