setTexture method
Assign a texture to a sampler uniform by name.
texture accepts a raw gpu.Texture (the low-level custom-shader path),
a Texture2D, or a RenderTexture (sampled live; an explicit sampler
overrides the source'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);
return;
}
if (texture is! gpu.Texture && texture is! TextureSource) {
throw ArgumentError.value(
texture,
'texture',
'Expected a gpu.Texture, a Texture2D, or a RenderTexture',
);
}
_textures[name] = _BoundTexture(texture, sampler);
}