@gltf-transform/extensions
Version:
Adds extension support to @gltf-transform/core
52 lines (51 loc) • 2.27 kB
TypeScript
import { Extension, PropertyType, type ReaderContext, type WriterContext } from '@gltf-transform/core';
import { KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS } from '../constants.js';
import { PBRSpecularGlossiness } from './pbr-specular-glossiness.js';
/**
* [`KHR_materials_pbrSpecularGlossiness`](https://github.com/KhronosGroup/gltf/blob/main/extensions/2.0/Khronos/KHR_materials_pbrSpecularGlossiness/)
* converts a PBR material from the default metal/rough workflow to a spec/gloss workflow.
*
* > _**NOTICE:** The spec/gloss workflow does _not_ support other PBR extensions such as clearcoat,
* > transmission, IOR, etc. For the complete PBR feature set and specular data, use the
* > {@link KHRMaterialsSpecular} extension instead, which provides specular data within a metal/rough
* > workflow._
*
* 
*
* > _**Figure:** Components of a PBR spec/gloss material. Source: Khronos Group._
*
* Properties:
* - {@link PBRSpecularGlossiness}
*
* ### Example
*
* ```typescript
* import { KHRMaterialsPBRSpecularGlossiness } from '@gltf-transform/extensions';
*
* // Create an Extension attached to the Document.
* const specGlossExtension = document.createExtension(KHRMaterialsPBRSpecularGlossiness);
*
* // Create a PBRSpecularGlossiness property.
* const specGloss = specGlossExtension.createPBRSpecularGlossiness()
* .setSpecularFactor(1.0);
*
* // // Assign to a Material.
* material.setExtension('KHR_materials_pbrSpecularGlossiness', specGloss);
* ```
*/
export declare class KHRMaterialsPBRSpecularGlossiness extends Extension {
static readonly EXTENSION_NAME: typeof KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS;
readonly extensionName: typeof KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS;
readonly prereadTypes: PropertyType[];
readonly prewriteTypes: PropertyType[];
/** Creates a new PBRSpecularGlossiness property for use on a {@link Material}. */
createPBRSpecularGlossiness(): PBRSpecularGlossiness;
/** @hidden */
read(_context: ReaderContext): this;
/** @hidden */
write(_context: WriterContext): this;
/** @hidden */
preread(context: ReaderContext): this;
/** @hidden */
prewrite(context: WriterContext): this;
}