UNPKG

@gltf-transform/extensions

Version:

Adds extension support to @gltf-transform/core

43 lines (42 loc) 1.55 kB
import { Extension, type ReaderContext, type WriterContext } from '@gltf-transform/core'; import { KHR_LIGHTS_PUNCTUAL } from '../constants.js'; import { Light } from './light.js'; /** * [`KHR_lights_punctual`](https://github.com/KhronosGroup/gltf/blob/main/extensions/2.0/Khronos/KHR_lights_punctual/) defines three "punctual" light types: directional, point and * spot. * * Punctual lights are parameterized, infinitely small points that emit light in * well-defined directions and intensities. Lights are referenced by nodes and inherit the transform * of that node. * * Properties: * - {@link Light} * * ### Example * * ```typescript * import { KHRLightsPunctual, Light, LightType } from '@gltf-transform/extensions'; * * // Create an Extension attached to the Document. * const lightsExtension = document.createExtension(KHRLightsPunctual); * * // Create a Light property. * const light = lightsExtension.createLight() * .setType(LightType.POINT) * .setIntensity(2.0) * .setColor([1.0, 0.0, 0.0]); * * // Attach the property to a Material. * node.setExtension('KHR_lights_punctual', light); * ``` */ export declare class KHRLightsPunctual extends Extension { readonly extensionName: typeof KHR_LIGHTS_PUNCTUAL; static readonly EXTENSION_NAME: typeof KHR_LIGHTS_PUNCTUAL; /** Creates a new punctual Light property for use on a {@link Node}. */ createLight(name?: string): Light; /** @hidden */ read(context: ReaderContext): this; /** @hidden */ write(context: WriterContext): this; }