@gltf-transform/extensions
Version:
Adds extension support to @gltf-transform/core
55 lines (54 loc) • 2.06 kB
TypeScript
import { Extension, PropertyType, type ReaderContext, type WriterContext } from '@gltf-transform/core';
import { KHR_MATERIALS_SHEEN } from '../constants.js';
import { Sheen } from './sheen.js';
/**
* [`KHR_materials_sheen`](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_sheen/)
* defines a velvet-like sheen layered on a glTF PBR material.
*
* 
*
* > _**Figure:** A cushion, showing high material roughness and low sheen roughness. Soft
* > highlights at edges of the material show backscattering from microfibers. Source: Khronos
* > Group._
*
* A sheen layer is a common technique used in Physically-Based Rendering to represent
* cloth and fabric materials.
*
* Properties:
* - {@link Sheen}
*
* ### Example
*
* The `KHRMaterialsSheen` class provides a single {@link ExtensionProperty} type, `Sheen`,
* which may be attached to any {@link Material} instance. For example:
*
* ```typescript
* import { KHRMaterialsSheen, Sheen } from '@gltf-transform/extensions';
*
* // Create an Extension attached to the Document.
* const sheenExtension = document.createExtension(KHRMaterialsSheen);
*
* // Create a Sheen property.
* const sheen = sheenExtension.createSheen()
* .setSheenColorFactor([1.0, 1.0, 1.0]);
*
* // Attach the property to a Material.
* material.setExtension('KHR_materials_sheen', sheen);
* ```
*/
export declare class KHRMaterialsSheen extends Extension {
static readonly EXTENSION_NAME: typeof KHR_MATERIALS_SHEEN;
readonly extensionName: typeof KHR_MATERIALS_SHEEN;
readonly prereadTypes: PropertyType[];
readonly prewriteTypes: PropertyType[];
/** Creates a new Sheen property for use on a {@link Material}. */
createSheen(): Sheen;
/** @hidden */
read(_context: ReaderContext): this;
/** @hidden */
write(_context: WriterContext): this;
/** @hidden */
preread(context: ReaderContext): this;
/** @hidden */
prewrite(context: WriterContext): this;
}