UNPKG

@polygonjs/polygonjs

Version:

node-based WebGL 3D engine https://polygonjs.com

51 lines (50 loc) 2.02 kB
import { Vector3, IUniform, Light, SpotLight, DirectionalLight, HemisphereLight, PointLight } from 'three'; export interface WorldPosUniformElement { worldPos: Vector3; } export interface DirectionUniformElement { direction: Vector3; } export interface PenumbraUniformElement { penumbra: number; } export interface ShadowUniformElement { shadowBiasAngle: number; shadowBiasDistance: number; } interface UniformWithWorldPosArray extends Array<WorldPosUniformElement> { needsUpdate?: boolean; } export interface UniformsWithWorldPos extends IUniform { value: UniformWithWorldPosArray; } interface UniformWithDirectionArray extends Array<DirectionUniformElement> { needsUpdate?: boolean; } export interface UniformsWithDirection extends IUniform { value: UniformWithDirectionArray; } interface UniformWithPenumbraArray extends Array<PenumbraUniformElement> { needsUpdate?: boolean; } interface UniformWithShadowBiasArray extends Array<ShadowUniformElement> { needsUpdate?: boolean; } export interface UniformsWithPenumbra extends IUniform { value: UniformWithPenumbraArray; } export interface UniformsWithShadowBias extends IUniform { value: UniformWithShadowBiasArray; } export declare enum LightType { SPOT = 0, DIRECTIONAL = 1, HEMISPHERE = 2, POINT = 3 } export declare function getLightType(object: Light): LightType | undefined; export declare function updateUserDataPenumbra(object: SpotLight | PointLight | DirectionalLight, uniforms: UniformsWithPenumbra, index: number, defaultUniformCreate: () => PenumbraUniformElement): void; export declare function updateUserDataShadowBias(object: SpotLight | PointLight | DirectionalLight, uniforms: UniformsWithShadowBias, index: number, defaultUniformCreate: () => ShadowUniformElement): void; export type AvailableLight = SpotLight | DirectionalLight | HemisphereLight | PointLight; export type UniformsUpdateFunction<L extends AvailableLight> = (object: L, uniforms: IUniform) => void; export {};