Editor.Assets.Sampler
ClassTexture sampling configuration for filtering, mipmapping, and wrapping modes.
Index
Example
const model = this.pluginSystem.findInterface(Editor.Model.IModel) as Editor.Model.IModel;
const assetManager = model.project.assetManager;
const textures = assetManager.assets.filter(
a => a.isOfType(Editor.Assets.Texture.getTypeName())
) as Editor.Assets.Texture[];
if (textures.length === 0) {
console.log('No textures found in project');
return;
}
const textureParam = new Editor.Assets.TextureParameter(textures[0].id);
const sampler = textureParam.sampler;
// Configure sampler: bilinear filtering with mipmaps, repeating U/V, clamped W
sampler.filteringMode = Editor.Assets.FilteringMode.Bilinear;
sampler.mipmapsEnabled = true;
sampler.wrapModeU = Editor.Assets.WrapMode.Repeat;
sampler.wrapModeV = Editor.Assets.WrapMode.Repeat;
sampler.wrapModeW = Editor.Assets.WrapMode.ClampToEdge;
console.log(`Configured sampler for "${textures[0].name}"`);
Properties
filteringMode
filteringMode:
FilteringMode
Texture filtering method applied during sampling.
mipmapsEnabled
mipmapsEnabled:
boolean
Whether mipmaps are used for texture sampling.
wrapModeU
wrapModeU:
WrapMode
Wrapping behavior for U texture coordinates.
wrapModeV
wrapModeV:
WrapMode
Wrapping behavior for V texture coordinates.
wrapModeW
wrapModeW:
WrapMode
Wrapping behavior for W texture coordinates.