LightningStrike.d.ts 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. import {
  2. Vector3
  3. } from '../../../src/Three';
  4. export interface RandomGenerator {
  5. random(): number;
  6. getSeed(): number;
  7. setSeed( seed: number ): void;
  8. }
  9. export interface LightningSegment {
  10. iteration: number;
  11. pos0: Vector3;
  12. pos1: Vector3;
  13. linPos0: Vector3;
  14. linPos1: Vector3;
  15. up0: Vector3;
  16. up1: Vector3;
  17. radius0: number;
  18. radius1: number;
  19. fraction0: number;
  20. fraction1: number;
  21. positionVariationFactor: number;
  22. }
  23. export interface LightningSubray {
  24. seed: number;
  25. maxIterations: number;
  26. recursion: number;
  27. pos0: Vector3;
  28. pos1: Vector3;
  29. linPos0: Vector3;
  30. linPos1: Vector3;
  31. up0: Vector3;
  32. up1: Vector3;
  33. radius0: number;
  34. radius1: number;
  35. birthTime: number;
  36. deathTime: number;
  37. timeScale: number;
  38. roughness: number;
  39. straightness: number;
  40. propagationTimeFactor: number;
  41. vanishingTimeFactor: number;
  42. endPropagationTime: number;
  43. beginVanishingTime: number;
  44. }
  45. export interface RayParameters {
  46. sourceOffset?: Vector3;
  47. destOffset?: Vector3;
  48. timeScale?: number;
  49. roughness?: number;
  50. straightness?: number;
  51. up0?: Vector3;
  52. up1?: Vector3;
  53. radius0?: number;
  54. radius1?: number;
  55. radius0Factor? : number;
  56. radius1Factor? : number;
  57. minRadius? : number;
  58. isEternal?: boolean;
  59. birthTime?: number;
  60. deathTime?: number;
  61. propagationTimeFactor?: number;
  62. vanishingTimeFactor?: number;
  63. subrayPeriod?: number;
  64. subrayDutyCycle?: number;
  65. maxIterations?: number;
  66. isStatic?: boolean;
  67. ramification?: number;
  68. maxSubrayRecursion?: number;
  69. recursionProbability?: number;
  70. generateUVs?: boolean;
  71. randomGenerator?: RandomGenerator;
  72. noiseSeed?: number;
  73. onDecideSubrayCreation?: ( segment: LightningSegment, lightningStrike: LightningStrike ) => void;
  74. onSubrayCreation?: ( segment: LightningSegment, parentSubray: LightningSubray, childSubray: LightningSubray, lightningStrike: LightningStrike ) => void;
  75. }
  76. export class LightningStrike {
  77. constructor( rayParameters?: RayParameters );
  78. copyParameters( dest?: RayParameters, source?: RayParameters ): RayParameters;
  79. // Ray states
  80. static readonly RAY_INITIALIZED: number;
  81. static readonly RAY_UNBORN: number;
  82. static readonly RAY_PROPAGATING: number;
  83. static readonly RAY_STEADY: number;
  84. static readonly RAY_VANISHING: number;
  85. static readonly RAY_EXTINGUISHED: number;
  86. state: number;
  87. update( time: number ): void;
  88. copy( source: LightningStrike ): LightningStrike;
  89. clone(): LightningStrike;
  90. }