UNPKG

@gltf-transform/extensions

Version:

Adds extension support to @gltf-transform/core

47 lines (46 loc) 1.74 kB
import { Extension, PropertyType, type ReaderContext, type WriterContext } from '@gltf-transform/core'; import { KHR_MATERIALS_IOR } from '../constants.js'; import { IOR } from './ior.js'; /** * [KHR_materials_ior](https://github.com/KhronosGroup/gltf/blob/main/extensions/2.0/Khronos/KHR_materials_ior/) * defines index of refraction on a glTF PBR material. * * The dielectric BRDF of the metallic-roughness material in glTF uses a fixed value of 1.5 for the * index of refraction. This is a good fit for many plastics and glass, but not for other materials * like water or asphalt, sapphire or diamond. `KHR_materials_ior` allows users to set the index of * refraction to a certain value. * * Properties: * - {@link IOR} * * ### Example * * ```typescript * import { KHRMaterialsIOR, IOR } from '@gltf-transform/extensions'; * * // Create an Extension attached to the Document. * const iorExtension = document.createExtension(KHRMaterialsIOR); * * // Create IOR property. * const ior = iorExtension.createIOR().setIOR(1.0); * * // Assign to a Material. * material.setExtension('KHR_materials_ior', ior); * ``` */ export declare class KHRMaterialsIOR extends Extension { static readonly EXTENSION_NAME: typeof KHR_MATERIALS_IOR; readonly extensionName: typeof KHR_MATERIALS_IOR; readonly prereadTypes: PropertyType[]; readonly prewriteTypes: PropertyType[]; /** Creates a new IOR property for use on a {@link Material}. */ createIOR(): IOR; /** @hidden */ read(_context: ReaderContext): this; /** @hidden */ write(_context: WriterContext): this; /** @hidden */ preread(context: ReaderContext): this; /** @hidden */ prewrite(context: WriterContext): this; }