UNPKG

@gltf-transform/functions

Version:

Functions for common glTF modifications, written using the core API

35 lines (34 loc) 1.23 kB
import { Texture } from '@gltf-transform/core'; import { TextureChannel } from '@gltf-transform/core'; /** * Returns a list of {@link TextureChannel TextureChannels} used by the given * texture. Determination is based only on the _role_ of the textures, e.g. * a texture used for the `occlusionTexture` will have (at least) a red channel * in use. See {@link getTextureChannelMask} for bitmask alternative. * * Example: * * ```js * const channels = listTextureChannels(texture); * if (channels.includes(TextureChannel.R)) { * console.log('texture red channel used'); * } * ``` */ export declare function listTextureChannels(texture: Texture): TextureChannel[]; /** * Returns bitmask of all {@link TextureChannel TextureChannels} used by the * given texture. Determination is based only on the _role_ of the textures, e.g. * a texture used for the `occlusionTexture` will have (at least) a red channel. * See {@link listTextureChannels} for an array alternative. * * Example: * * ```js * const mask = getTextureChannelMask(texture); * if (mask & TextureChannel.R) { * console.log('texture red channel used'); * } * ``` */ export declare function getTextureChannelMask(texture: Texture): number;