KHRTextureTransform

KHR_texture_transform adds offset, rotation, and scale to TextureInfo properties.

Affine UV transforms are useful for reducing the number of textures the GPU must load, improving performance when used in techniques like texture atlases. UV transforms cannot be animated at this time.

Properties:

Example

The KHRTextureTransform class provides a single ExtensionProperty type, Transform, which may be attached to any TextureInfo instance. For example:

import { KHRTextureTransform } from '@gltf-transform/extensions';

// Create an Extension attached to the Document.
const transformExtension = document.createExtension(KHRTextureTransform)
    .setRequired(true);

// Create a reusable Transform.
const transform = transformExtension.createTransform()
    .setScale([100, 100]);

// Apply the Transform to a Material's baseColorTexture.
document.createMaterial()
    .setBaseColorTexture(myTexture)
    .getBaseColorTextureInfo()
    .setExtension('KHR_texture_transform', transform);

Hierarchy

Static properties

EXTENSION_NAME: "KHR_texture_transform"

Properties

extensionName: "KHR_texture_transform"

Methods

  • dispose(): void
  • isRequired(): boolean
  • Indicates to the client whether it is OK to load the asset when this extension is not recognized. Optional extensions are generally preferred, if there is not a good reason to require a client to completely fail when an extension isn't known.

  • listProperties(): ExtensionProperty[]
  • Indicates to the client whether it is OK to load the asset when this extension is not recognized. Optional extensions are generally preferred, if there is not a good reason to require a client to completely fail when an extension isn't known.

Function symbol, where the argument and output are a box labeled 'glTF'.

Made by Don McCurdy. Documentation built with greendoc and published under Creative Commons Attribution 3.0.