Fire.d.ts 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. import {
  2. BufferGeometry,
  3. Color,
  4. Clock,
  5. DataTexture,
  6. Mesh,
  7. OrthographicCamera,
  8. PlaneBufferGeometry,
  9. Scene,
  10. ShaderMaterial,
  11. Texture,
  12. Uniform,
  13. WebGLRenderer,
  14. WebGLRenderTarget
  15. } from '../../../src/Three';
  16. export interface FireOptions {
  17. textureWidth?: number;
  18. textureHeight?: number;
  19. debug?: boolean;
  20. color1?: Color;
  21. color2?: Color;
  22. color3?: Color;
  23. colorBias?: number;
  24. diffuse?: number;
  25. viscosity?: number;
  26. expansion?: number;
  27. swirl?: number;
  28. burnRate?: number;
  29. drag?: number;
  30. airSpeed?: number;
  31. windVector?: number;
  32. speed?: number;
  33. massConservation?: boolean;
  34. }
  35. export class Fire extends Mesh {
  36. constructor( geometry: BufferGeometry, options: FireOptions );
  37. clock: Clock;
  38. color1: Color;
  39. color2: Color;
  40. color3: Color;
  41. colorBias: number;
  42. diffuse: number;
  43. viscosity: number;
  44. expansion: number;
  45. swirl: number;
  46. burnRate: number;
  47. drag: number;
  48. airSpeed: number;
  49. windVector: number;
  50. speed: number;
  51. massConservation: boolean;
  52. sourceData: Uint8Array;
  53. field0: WebGLRenderTarget;
  54. field1: WebGLRenderTarget;
  55. fieldProj: WebGLRenderTarget;
  56. fieldScene: Scene;
  57. orthoCamera: OrthographicCamera;
  58. fieldGeometry: PlaneBufferGeometry;
  59. internalSource: DataTexture;
  60. sourceMaterial: ShaderMaterial;
  61. sourceMesh: Mesh;
  62. diffuseMaterial: ShaderMaterial;
  63. driftMaterial: ShaderMaterial;
  64. projMaterial1: ShaderMaterial;
  65. projMaterial2: ShaderMaterial;
  66. projMaterial3: ShaderMaterial;
  67. material: ShaderMaterial;
  68. addSource( u: number, v: number, radius: number, density?: number, windX?: number, windY?: number ): Uint8Array;
  69. clearDiffuse(): void;
  70. clearSources(): Uint8Array;
  71. configShaders( dt: number ): void;
  72. renderDiffuse( renderer: WebGLRenderer ): void;
  73. renderDrift( renderer: WebGLRenderer ): void;
  74. renderProject( renderer: WebGLRenderer ): void;
  75. renderSource( renderer: WebGLRenderer ): void;
  76. restoreRenderState( renderer: WebGLRenderer ): void;
  77. saveRenderState( renderer: WebGLRenderer ): void;
  78. setSourceMap( texture: Texture ): void;
  79. swapTextures(): void;
  80. static SourceShader: SourceShader;
  81. static DiffuseShader: DiffuseShader;
  82. static DriftShader: DriftShader;
  83. static ProjectionShader1: ProjectionShader1;
  84. static ProjectionShader2: ProjectionShader2;
  85. static ProjectionShader3: ProjectionShader3;
  86. static ColorShader: ColorShader;
  87. static DebugShader: DebugShader;
  88. }
  89. declare interface SourceShader {
  90. uniforms: {
  91. sourceMap: Uniform;
  92. densityMap: Uniform;
  93. };
  94. vertexShader: string;
  95. fragmentShader: string;
  96. }
  97. declare interface DiffuseShader {
  98. uniforms: {
  99. oneOverWidth: Uniform;
  100. oneOverHeight: Uniform;
  101. diffuse: Uniform;
  102. viscosity: Uniform;
  103. expansion: Uniform;
  104. swirl: Uniform;
  105. drag: Uniform;
  106. burnRate: Uniform;
  107. densityMap: Uniform;
  108. };
  109. vertexShader: string;
  110. fragmentShader: string;
  111. }
  112. declare interface DriftShader {
  113. uniforms: {
  114. oneOverWidth: Uniform;
  115. oneOverHeight: Uniform;
  116. windVector: Uniform;
  117. airSpeed: Uniform;
  118. densityMap: Uniform;
  119. };
  120. vertexShader: string;
  121. fragmentShader: string;
  122. }
  123. declare interface ProjectionShader1 {
  124. uniforms: {
  125. oneOverWidth: Uniform;
  126. oneOverHeight: Uniform;
  127. densityMap: Uniform;
  128. };
  129. vertexShader: string;
  130. fragmentShader: string;
  131. }
  132. declare interface ProjectionShader2 {
  133. uniforms: {
  134. oneOverWidth: Uniform;
  135. oneOverHeight: Uniform;
  136. densityMap: Uniform;
  137. };
  138. vertexShader: string;
  139. fragmentShader: string;
  140. }
  141. declare interface ProjectionShader3 {
  142. uniforms: {
  143. oneOverWidth: Uniform;
  144. oneOverHeight: Uniform;
  145. densityMap: Uniform;
  146. projMap: Uniform;
  147. };
  148. vertexShader: string;
  149. fragmentShader: string;
  150. }
  151. declare interface ColorShader {
  152. uniforms: {
  153. color1: Uniform;
  154. color2: Uniform;
  155. color3: Uniform;
  156. colorBias: Uniform;
  157. densityMap: Uniform;
  158. };
  159. vertexShader: string;
  160. fragmentShader: string;
  161. }
  162. declare interface DebugShader {
  163. uniforms: {
  164. color1: Uniform;
  165. color2: Uniform;
  166. color3: Uniform;
  167. colorBias: Uniform;
  168. densityMap: Uniform;
  169. };
  170. vertexShader: string;
  171. fragmentShader: string;
  172. }