threepipe
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ILight.ts 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import {Light, LightShadow, Object3D} from 'three'
  2. import {IObject3D, IObject3DEvent, IObject3DEventTypes, IObject3DUserData} from '../IObject'
  3. export interface ILight<
  4. TShadowSupport extends LightShadow | undefined = LightShadow | undefined,
  5. E extends ILightEvent = ILightEvent,
  6. ET extends ILightEventTypes = ILightEventTypes
  7. > extends Light<TShadowSupport, E, ET>, IObject3D<E, ET> {
  8. assetType: 'light'
  9. readonly isLight: true
  10. /**
  11. * @deprecated use `this` instead
  12. */
  13. lightObject: this
  14. // Note: for userData: add _ in front of for private use, which is preserved while cloning but not serialisation, and __ for private use, which is not preserved while cloning and serialisation
  15. userData: IObject3DUserData
  16. /**
  17. * @param removeFromParent - remove from parent. Default true
  18. */
  19. dispose(removeFromParent?: boolean): void;
  20. target?: Object3D
  21. // region inherited type fixes
  22. // re-declaring from IObject3D because: https://github.com/microsoft/TypeScript/issues/16936
  23. traverse(callback: (object: IObject3D) => void): void
  24. traverseVisible(callback: (object: IObject3D) => void): void
  25. traverseAncestors(callback: (object: IObject3D) => void): void
  26. getObjectById<T extends IObject3D = IObject3D>(id: number): T | undefined
  27. getObjectByName<T extends IObject3D = IObject3D>(name: string): T | undefined
  28. getObjectByProperty<T extends IObject3D = IObject3D>(name: string, value: string): T | undefined
  29. copy(source: this, recursive?: boolean, distanceFromTarget?: number, worldSpace?: boolean, ...args: any[]): this
  30. clone(recursive?: boolean): this
  31. add(...object: IObject3D[]): this
  32. remove(...object: IObject3D[]): this
  33. parent: IObject3D | null
  34. children: IObject3D[]
  35. // endregion
  36. }
  37. export type ILightEventTypes = IObject3DEventTypes | 'lightUpdate'// | string
  38. export type ILightEvent = Omit<IObject3DEvent, 'type'> & {
  39. type: ILightEventTypes
  40. light?: ILight | null
  41. // change?: string
  42. }