UNPKG

nanogl-gltf

Version:
50 lines (49 loc) 1.54 kB
import { IExtensionFactory, IExtensionInstance } from "../IExtension"; import GltfLoader from "../../io/GltfLoader"; import Light from "nanogl-pbr/lighting/Light"; /** * Interface representing a light with its name and index in a list */ export interface LightItemCollection { name: string; index: number; } /** * Class to manage a collection of lights */ export declare class LightCollection { /** * List of lights */ list: Light[]; /** * List of lights with their name and index in the list */ _items: Array<LightItemCollection>; constructor(); /** * Add a light to the collection * @param light Light to add * @param name Light's name */ addLight(light: Light, name?: string): void; /** * Get a light from this collection by its name * @param name Light's name to get */ getLightByName(name: string): Light; /** * Get a list of lights from this collection by their name * @param name Lights' name to get */ getLightsByName(name: string): Array<Light>; } /** * This extension allows to define in a glTF file a set of lights that can be used by the scene. * The 3 possible types of lights (directional, spot and point) will be created as nanogl-pbr DirectionalLight, * SpotLight and PointLight, and added to the Node they are linked to. */ export default class KHR_lights_punctual implements IExtensionFactory { readonly name: string; createInstance(gltfLoader: GltfLoader): IExtensionInstance; }