setTexture method

void setTexture(
  1. String name,
  2. Object? texture, {
  3. SamplerOptions? sampler,
})

Assign a texture to a sampler uniform by name.

texture accepts a gpu.Texture or a RenderTexture (sampled live; an explicit sampler overrides the render texture's own sampling). Pass null to clear the binding.

Implementation

void setTexture(String name, Object? texture, {gpu.SamplerOptions? sampler}) {
  if (texture == null) {
    _textures.remove(name);
  } else {
    _textures[name] = _BoundTexture(
      checkTextureSource(texture, 'texture')!,
      sampler,
    );
  }
}