@gltf-transform/functions
Version:
Functions for common glTF modifications, written using the core API
24 lines (23 loc) • 863 B
TypeScript
import { Texture } from '@gltf-transform/core';
/**
* Returns the color space (if any) implied by the {@link Material} slots to
* which a texture is assigned, or null for non-color textures. If the texture
* is not connected to any {@link Material}, this function will also return
* null — any metadata in the image file will be ignored.
*
* Under current glTF specifications, only 'srgb' and non-color (null) textures
* are used.
*
* Example:
*
* ```typescript
* import { getTextureColorSpace } from '@gltf-transform/functions';
*
* const baseColorTexture = material.getBaseColorTexture();
* const normalTexture = material.getNormalTexture();
*
* getTextureColorSpace(baseColorTexture); // → 'srgb'
* getTextureColorSpace(normalTexture); // → null
* ```
*/
export declare function getTextureColorSpace(texture: Texture): string | null;