set method

  1. @override
void set(
  1. UniformArrayKey key,
  2. ByteBuffer buffer
)
override

Implementation

@override
void set(UniformArrayKey key, ByteBuffer buffer) {
  final storage = _get(key.index);
  final index = slot.indexOf(key.field);

  // Ensure that we are only setting new data if the hash has changed.
  final data = buffer.asFloat32List();
  final hash = Object.hashAll(data);
  if (storage[index]?.hash == hash) {
    return;
  }

  // Store the storage at the given slot index.
  storage[index] = (data: data, hash: hash);

  // Clear the cache.
  recreateResource = true;
}