setTexture method

void setTexture(
  1. String key,
  2. Texture texture
)

Set a Texture at the given key.

Implementation

void setTexture(String key, Texture texture) {
  final binding = switch (_bindings.putIfAbsent(
    key,
    () => _TextureBinding(_slots[key]!, texture),
  )) {
    final _TextureBinding binding => binding,
    _ => throw StateError('Slot "$key" is a uniform block, not a sampler'),
  };

  binding.resource = texture;
}