babylon.quarks 0.18.1 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +57 -0
- package/README.md +38 -16
- package/dist/babylon.quarks.cjs +1 -1
- package/dist/babylon.quarks.cjs.map +1 -1
- package/dist/babylon.quarks.esm.js +1 -1
- package/dist/babylon.quarks.esm.js.map +1 -1
- package/dist/babylon.quarks.umd.min.js +1 -1
- package/dist/babylon.quarks.umd.min.js.map +1 -1
- package/dist/types/index.d.ts +2121 -1157
- package/package.json +67 -67
- package/src/BatchedRenderer.ts +228 -15
- package/src/MeshSurfaceEmitter.ts +34 -23
- package/src/ParticleEmitter.ts +34 -10
- package/src/ParticleSystem.ts +558 -197
- package/src/QuarksLoader.ts +204 -18
- package/src/QuarksPrefab.ts +8 -11
- package/src/QuarksUtil.ts +1 -3
- package/src/SpriteBatch.ts +520 -98
- package/src/TrailBatch.ts +374 -166
- package/src/VFXBatch.ts +24 -5
- package/src/envAtlas.ts +136 -0
- package/src/index.ts +34 -29
- package/src/materials/ParticleMaterials.ts +1 -1
- package/src/shaders/index.ts +4 -4
- package/src/shaders/local_particle_physics_vert.wgsl.ts +81 -0
- package/src/shaders/particle_frag.wgsl.ts +64 -0
- package/src/shaders/particle_physics_frag.glsl.ts +56 -1
- package/src/shaders/particle_physics_frag.wgsl.ts +125 -0
- package/src/shaders/particle_vert.glsl.ts +20 -0
- package/src/shaders/particle_vert.wgsl.ts +107 -0
- package/src/shaders/shaderLanguageSupport.ts +54 -0
- package/src/shaders/stretched_bb_particle_vert.glsl.ts +18 -5
- package/src/shaders/stretched_bb_particle_vert.wgsl.ts +101 -0
- package/src/shaders/trail_frag.wgsl.ts +23 -0
- package/src/shaders/trail_vert.wgsl.ts +63 -0
package/dist/types/index.d.ts
CHANGED
|
@@ -1,70 +1,11 @@
|
|
|
1
|
+
import { BaseTexture } from '@babylonjs/core/Materials/Textures/baseTexture';
|
|
2
|
+
import { Texture } from '@babylonjs/core/Materials/Textures/texture';
|
|
1
3
|
import { TransformNode } from '@babylonjs/core/Meshes/transformNode';
|
|
2
4
|
import { Scene } from '@babylonjs/core/scene';
|
|
3
|
-
import { Texture } from '@babylonjs/core/Materials/Textures/texture';
|
|
4
|
-
import { BaseTexture } from '@babylonjs/core/Materials/Textures/baseTexture';
|
|
5
5
|
import { Mesh } from '@babylonjs/core/Meshes/mesh';
|
|
6
|
-
import { Node } from '@babylonjs/core/node';
|
|
7
6
|
import { PBRMaterial } from '@babylonjs/core/Materials/PBR/pbrMaterial';
|
|
8
7
|
import { StandardMaterial } from '@babylonjs/core/Materials/standardMaterial';
|
|
9
|
-
|
|
10
|
-
declare const WebGLCoordinateSystem = 2000;
|
|
11
|
-
declare const WebGPUCoordinateSystem = 2001;
|
|
12
|
-
declare class Matrix4 {
|
|
13
|
-
elements: number[];
|
|
14
|
-
readonly isMatrix4 = true;
|
|
15
|
-
constructor(n11?: number, n12?: number, n13?: number, n14?: number, n21?: number, n22?: number, n23?: number, n24?: number, n31?: number, n32?: number, n33?: number, n34?: number, n41?: number, n42?: number, n43?: number, n44?: number);
|
|
16
|
-
/**
|
|
17
|
-
* @deprecated Use {@link Matrix4#copyPosition .copyPosition()} instead.
|
|
18
|
-
*/
|
|
19
|
-
extractPosition(m: Matrix4): Matrix4;
|
|
20
|
-
/**
|
|
21
|
-
* Sets this matrix to a x b and stores the result into the flat array r.
|
|
22
|
-
* r can be either a regular Array or a TypedArray.
|
|
23
|
-
*
|
|
24
|
-
* @deprecated This method has been removed completely.
|
|
25
|
-
*/
|
|
26
|
-
multiplyToArray(a: Matrix4, b: Matrix4, r: number[]): Matrix4;
|
|
27
|
-
/**
|
|
28
|
-
* @deprecated Use {@link Matrix4#makeRotationFromQuaternion .makeRotationFromQuaternion()} instead.
|
|
29
|
-
*/
|
|
30
|
-
setRotationFromQuaternion(q: Quaternion): Matrix4;
|
|
31
|
-
set(n11: number, n12: number, n13: number, n14: number, n21: number, n22: number, n23: number, n24: number, n31: number, n32: number, n33: number, n34: number, n41: number, n42: number, n43: number, n44: number): this;
|
|
32
|
-
identity(): this;
|
|
33
|
-
clone(): Matrix4;
|
|
34
|
-
copy(m: Matrix4): this;
|
|
35
|
-
copyPosition(m: Matrix4): this;
|
|
36
|
-
setFromMatrix3(m: Matrix3): this;
|
|
37
|
-
extractBasis(xAxis: Vector3, yAxis: Vector3, zAxis: Vector3): this;
|
|
38
|
-
makeBasis(xAxis: Vector3, yAxis: Vector3, zAxis: Vector3): this;
|
|
39
|
-
extractRotation(m: Matrix4): this;
|
|
40
|
-
makeRotationFromEuler(euler: Euler): this;
|
|
41
|
-
makeRotationFromQuaternion(q: Quaternion): this;
|
|
42
|
-
lookAt(eye: Vector3, target: Vector3, up: Vector3): this;
|
|
43
|
-
multiply(m: Matrix4): this;
|
|
44
|
-
premultiply(m: Matrix4): this;
|
|
45
|
-
multiplyMatrices(a: Matrix4, b: Matrix4): this;
|
|
46
|
-
multiplyScalar(s: number): this;
|
|
47
|
-
determinant(): number;
|
|
48
|
-
transpose(): this;
|
|
49
|
-
setPosition(x: number | Vector3, y?: number, z?: number): this;
|
|
50
|
-
invert(): this;
|
|
51
|
-
scale(v: Vector3): this;
|
|
52
|
-
getMaxScaleOnAxis(): number;
|
|
53
|
-
makeTranslation(x: number | Vector3, y?: number, z?: number): this;
|
|
54
|
-
makeRotationX(theta: number): this;
|
|
55
|
-
makeRotationY(theta: number): this;
|
|
56
|
-
makeRotationZ(theta: number): this;
|
|
57
|
-
makeRotationAxis(axis: Vector3, angle: number): this;
|
|
58
|
-
makeScale(x: number, y: number, z: number): this;
|
|
59
|
-
makeShear(xy: number, xz: number, yx: number, yz: number, zx: number, zy: number): this;
|
|
60
|
-
compose(position: Vector3, quaternion: Quaternion, scale: Vector3): this;
|
|
61
|
-
decompose(position: Vector3, quaternion: Quaternion, scale: Vector3): this;
|
|
62
|
-
makePerspective(left: number, right: number, top: number, bottom: number, near: number, far: number, coordinateSystem?: number): this;
|
|
63
|
-
makeOrthographic(left: number, right: number, top: number, bottom: number, near: number, far: number, coordinateSystem?: number): this;
|
|
64
|
-
equals(matrix: Matrix4): boolean;
|
|
65
|
-
fromArray(array: number[], offset?: number): this;
|
|
66
|
-
toArray(array?: number[], offset?: number): number[];
|
|
67
|
-
}
|
|
8
|
+
import { Node } from '@babylonjs/core/node';
|
|
68
9
|
|
|
69
10
|
declare class Vector2 {
|
|
70
11
|
x: number;
|
|
@@ -127,41 +68,59 @@ declare class Vector2 {
|
|
|
127
68
|
[Symbol.iterator](): Generator<number, void, unknown>;
|
|
128
69
|
}
|
|
129
70
|
|
|
130
|
-
declare class
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
71
|
+
declare class Quaternion {
|
|
72
|
+
_x: number;
|
|
73
|
+
_y: number;
|
|
74
|
+
_z: number;
|
|
75
|
+
_w: number;
|
|
76
|
+
readonly isQuaternion: boolean;
|
|
77
|
+
constructor(x?: number, y?: number, z?: number, w?: number);
|
|
78
|
+
static slerpFlat(dst: number[], dstOffset: number, src0: number[], srcOffset0: number, src1: number[], srcOffset1: number, t: number): void;
|
|
79
|
+
static multiplyQuaternionsFlat(dst: number[], dstOffset: number, src0: number[], srcOffset0: number, src1: number[], srcOffset1: number): number[];
|
|
80
|
+
get x(): number;
|
|
81
|
+
set x(value: number);
|
|
82
|
+
get y(): number;
|
|
83
|
+
set y(value: number);
|
|
84
|
+
get z(): number;
|
|
85
|
+
set z(value: number);
|
|
86
|
+
get w(): number;
|
|
87
|
+
set w(value: number);
|
|
88
|
+
set(x: number, y: number, z: number, w: number): this;
|
|
89
|
+
clone(): Quaternion;
|
|
90
|
+
copy(quaternion: Quaternion): this;
|
|
91
|
+
setFromEuler(euler: Euler, update?: boolean): this;
|
|
92
|
+
setFromAxisAngle(axis: Vector3, angle: number): this;
|
|
93
|
+
setFromRotationMatrix(m: Matrix4): this;
|
|
94
|
+
setFromUnitVectors(vFrom: Vector3, vTo: Vector3): this;
|
|
95
|
+
angleTo(q: Quaternion): number;
|
|
96
|
+
rotateTowards(q: Quaternion, step: number): this;
|
|
134
97
|
identity(): this;
|
|
135
|
-
copy(m: Matrix3): this;
|
|
136
|
-
extractBasis(xAxis: Vector3, yAxis: Vector3, zAxis: Vector3): this;
|
|
137
|
-
setFromMatrix4(m: Matrix4): this;
|
|
138
|
-
multiply(m: Matrix3): this;
|
|
139
|
-
premultiply(m: Matrix3): this;
|
|
140
|
-
multiplyMatrices(a: Matrix3, b: Matrix3): this;
|
|
141
|
-
multiplyScalar(s: number): this;
|
|
142
|
-
determinant(): number;
|
|
143
98
|
invert(): this;
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
99
|
+
conjugate(): this;
|
|
100
|
+
dot(v: Quaternion): number;
|
|
101
|
+
lengthSq(): number;
|
|
102
|
+
length(): number;
|
|
103
|
+
normalize(): this;
|
|
104
|
+
multiply(q: Quaternion): this;
|
|
105
|
+
premultiply(q: Quaternion): this;
|
|
106
|
+
multiplyQuaternions(a: Quaternion, b: Quaternion): this;
|
|
107
|
+
slerp(qb: Quaternion, t: number): this;
|
|
108
|
+
slerpQuaternions(qa: Quaternion, qb: Quaternion, t: number): this;
|
|
109
|
+
random(): this;
|
|
110
|
+
equals(quaternion: Quaternion): boolean;
|
|
155
111
|
fromArray(array: number[], offset?: number): this;
|
|
156
112
|
toArray(array?: number[], offset?: number): number[];
|
|
157
|
-
|
|
113
|
+
toJSON(): number[];
|
|
114
|
+
_onChange(callback: () => void): this;
|
|
115
|
+
_onChangeCallback(): void;
|
|
116
|
+
[Symbol.iterator](): Generator<number, void, unknown>;
|
|
158
117
|
}
|
|
159
118
|
|
|
160
119
|
declare class Vector3 {
|
|
161
120
|
x: number;
|
|
162
121
|
y: number;
|
|
163
122
|
z: number;
|
|
164
|
-
readonly isVector3
|
|
123
|
+
readonly isVector3: boolean;
|
|
165
124
|
constructor(x?: number, y?: number, z?: number);
|
|
166
125
|
set(x: number, y: number, z: number): this;
|
|
167
126
|
setScalar(scalar: number): this;
|
|
@@ -234,52 +193,94 @@ declare class Vector3 {
|
|
|
234
193
|
[Symbol.iterator](): Generator<number, void, unknown>;
|
|
235
194
|
}
|
|
236
195
|
|
|
237
|
-
declare class
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
isQuaternion: boolean;
|
|
243
|
-
constructor(x?: number, y?: number, z?: number, w?: number);
|
|
244
|
-
static slerpFlat(dst: number[], dstOffset: number, src0: number[], srcOffset0: number, src1: number[], srcOffset1: number, t: number): void;
|
|
245
|
-
static multiplyQuaternionsFlat(dst: number[], dstOffset: number, src0: number[], srcOffset0: number, src1: number[], srcOffset1: number): number[];
|
|
246
|
-
get x(): number;
|
|
247
|
-
set x(value: number);
|
|
248
|
-
get y(): number;
|
|
249
|
-
set y(value: number);
|
|
250
|
-
get z(): number;
|
|
251
|
-
set z(value: number);
|
|
252
|
-
get w(): number;
|
|
253
|
-
set w(value: number);
|
|
254
|
-
set(x: number, y: number, z: number, w: number): this;
|
|
255
|
-
clone(): Quaternion;
|
|
256
|
-
copy(quaternion: Quaternion): this;
|
|
257
|
-
setFromEuler(euler: Euler, update?: boolean): this;
|
|
258
|
-
setFromAxisAngle(axis: Vector3, angle: number): this;
|
|
259
|
-
setFromRotationMatrix(m: Matrix4): this;
|
|
260
|
-
setFromUnitVectors(vFrom: Vector3, vTo: Vector3): this;
|
|
261
|
-
angleTo(q: Quaternion): number;
|
|
262
|
-
rotateTowards(q: Quaternion, step: number): this;
|
|
196
|
+
declare class Matrix3 {
|
|
197
|
+
elements: number[];
|
|
198
|
+
readonly isMatrix3: boolean;
|
|
199
|
+
constructor(n11?: number, n12?: number, n13?: number, n21?: number, n22?: number, n23?: number, n31?: number, n32?: number, n33?: number);
|
|
200
|
+
set(n11: number, n12: number, n13: number, n21: number, n22: number, n23: number, n31: number, n32: number, n33: number): this;
|
|
263
201
|
identity(): this;
|
|
202
|
+
copy(m: Matrix3): this;
|
|
203
|
+
extractBasis(xAxis: Vector3, yAxis: Vector3, zAxis: Vector3): this;
|
|
204
|
+
setFromMatrix4(m: Matrix4): this;
|
|
205
|
+
multiply(m: Matrix3): this;
|
|
206
|
+
premultiply(m: Matrix3): this;
|
|
207
|
+
multiplyMatrices(a: Matrix3, b: Matrix3): this;
|
|
208
|
+
multiplyScalar(s: number): this;
|
|
209
|
+
determinant(): number;
|
|
264
210
|
invert(): this;
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
211
|
+
transpose(): this;
|
|
212
|
+
getNormalMatrix(matrix4: Matrix4): this;
|
|
213
|
+
transposeIntoArray(r: number[]): this;
|
|
214
|
+
setUvTransform(tx: number, ty: number, sx: number, sy: number, rotation: number, cx: number, cy: number): this;
|
|
215
|
+
scale(sx: number, sy: number): this;
|
|
216
|
+
rotate(theta: number): this;
|
|
217
|
+
translate(tx: number, ty: number): this;
|
|
218
|
+
makeTranslation(x: number | Vector2, y: number): this;
|
|
219
|
+
makeRotation(theta: number): this;
|
|
220
|
+
makeScale(x: number, y: number): this;
|
|
221
|
+
equals(matrix: Matrix3): boolean;
|
|
222
|
+
fromArray(array: number[], offset?: number): this;
|
|
223
|
+
toArray(array?: number[], offset?: number): number[];
|
|
224
|
+
clone(): Matrix3;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
declare const WebGLCoordinateSystem = 2000;
|
|
228
|
+
declare const WebGPUCoordinateSystem = 2001;
|
|
229
|
+
declare class Matrix4 {
|
|
230
|
+
elements: number[];
|
|
231
|
+
readonly isMatrix4: boolean;
|
|
232
|
+
constructor(n11?: number, n12?: number, n13?: number, n14?: number, n21?: number, n22?: number, n23?: number, n24?: number, n31?: number, n32?: number, n33?: number, n34?: number, n41?: number, n42?: number, n43?: number, n44?: number);
|
|
233
|
+
/**
|
|
234
|
+
* @deprecated Use {@link Matrix4#copyPosition .copyPosition()} instead.
|
|
235
|
+
*/
|
|
236
|
+
extractPosition(m: Matrix4): Matrix4;
|
|
237
|
+
/**
|
|
238
|
+
* Sets this matrix to a x b and stores the result into the flat array r.
|
|
239
|
+
* r can be either a regular Array or a TypedArray.
|
|
240
|
+
*
|
|
241
|
+
* @deprecated This method has been removed completely.
|
|
242
|
+
*/
|
|
243
|
+
multiplyToArray(a: Matrix4, b: Matrix4, r: number[]): Matrix4;
|
|
244
|
+
/**
|
|
245
|
+
* @deprecated Use {@link Matrix4#makeRotationFromQuaternion .makeRotationFromQuaternion()} instead.
|
|
246
|
+
*/
|
|
247
|
+
setRotationFromQuaternion(q: Quaternion): Matrix4;
|
|
248
|
+
set(n11: number, n12: number, n13: number, n14: number, n21: number, n22: number, n23: number, n24: number, n31: number, n32: number, n33: number, n34: number, n41: number, n42: number, n43: number, n44: number): this;
|
|
249
|
+
identity(): this;
|
|
250
|
+
clone(): Matrix4;
|
|
251
|
+
copy(m: Matrix4): this;
|
|
252
|
+
copyPosition(m: Matrix4): this;
|
|
253
|
+
setFromMatrix3(m: Matrix3): this;
|
|
254
|
+
extractBasis(xAxis: Vector3, yAxis: Vector3, zAxis: Vector3): this;
|
|
255
|
+
makeBasis(xAxis: Vector3, yAxis: Vector3, zAxis: Vector3): this;
|
|
256
|
+
extractRotation(m: Matrix4): this;
|
|
257
|
+
makeRotationFromEuler(euler: Euler): this;
|
|
258
|
+
makeRotationFromQuaternion(q: Quaternion): this;
|
|
259
|
+
lookAt(eye: Vector3, target: Vector3, up: Vector3): this;
|
|
260
|
+
multiply(m: Matrix4): this;
|
|
261
|
+
premultiply(m: Matrix4): this;
|
|
262
|
+
multiplyMatrices(a: Matrix4, b: Matrix4): this;
|
|
263
|
+
multiplyScalar(s: number): this;
|
|
264
|
+
determinant(): number;
|
|
265
|
+
transpose(): this;
|
|
266
|
+
setPosition(x: number | Vector3, y?: number, z?: number): this;
|
|
267
|
+
invert(): this;
|
|
268
|
+
scale(v: Vector3): this;
|
|
269
|
+
getMaxScaleOnAxis(): number;
|
|
270
|
+
makeTranslation(x: number | Vector3, y?: number, z?: number): this;
|
|
271
|
+
makeRotationX(theta: number): this;
|
|
272
|
+
makeRotationY(theta: number): this;
|
|
273
|
+
makeRotationZ(theta: number): this;
|
|
274
|
+
makeRotationAxis(axis: Vector3, angle: number): this;
|
|
275
|
+
makeScale(x: number, y: number, z: number): this;
|
|
276
|
+
makeShear(xy: number, xz: number, yx: number, yz: number, zx: number, zy: number): this;
|
|
277
|
+
compose(position: Vector3, quaternion: Quaternion, scale: Vector3): this;
|
|
278
|
+
decompose(position: Vector3, quaternion: Quaternion, scale: Vector3): this;
|
|
279
|
+
makePerspective(left: number, right: number, top: number, bottom: number, near: number, far: number, coordinateSystem?: number): this;
|
|
280
|
+
makeOrthographic(left: number, right: number, top: number, bottom: number, near: number, far: number, coordinateSystem?: number): this;
|
|
281
|
+
equals(matrix: Matrix4): boolean;
|
|
277
282
|
fromArray(array: number[], offset?: number): this;
|
|
278
283
|
toArray(array?: number[], offset?: number): number[];
|
|
279
|
-
toJSON(): number[];
|
|
280
|
-
_onChange(callback: () => void): this;
|
|
281
|
-
_onChangeCallback(): void;
|
|
282
|
-
[Symbol.iterator](): Generator<number, void, unknown>;
|
|
283
284
|
}
|
|
284
285
|
|
|
285
286
|
type EulerOrder = 'XYZ' | 'YXZ' | 'ZXY' | 'ZYX' | 'YZX' | 'XZY' | 'XYX' | 'YZY' | 'ZXZ' | 'XZX' | 'YXY' | 'ZYZ';
|
|
@@ -288,7 +289,7 @@ declare class Euler {
|
|
|
288
289
|
_y: number;
|
|
289
290
|
_z: number;
|
|
290
291
|
_order: EulerOrder;
|
|
291
|
-
isEuler: boolean;
|
|
292
|
+
readonly isEuler: boolean;
|
|
292
293
|
static DEFAULT_ORDER: EulerOrder;
|
|
293
294
|
constructor(x?: number, y?: number, z?: number, order?: EulerOrder);
|
|
294
295
|
get x(): number;
|
|
@@ -314,11 +315,87 @@ declare class Euler {
|
|
|
314
315
|
[Symbol.iterator](): Generator<number | EulerOrder, void, unknown>;
|
|
315
316
|
}
|
|
316
317
|
|
|
317
|
-
declare
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
318
|
+
declare const DEG2RAD: number;
|
|
319
|
+
declare const RAD2DEG: number;
|
|
320
|
+
declare function generateUUID(): string;
|
|
321
|
+
declare function clamp(value: number, min: number, max: number): number;
|
|
322
|
+
declare function euclideanModulo(n: number, m: number): number;
|
|
323
|
+
declare function mapLinear(x: number, a1: number, a2: number, b1: number, b2: number): number;
|
|
324
|
+
declare function inverseLerp(x: number, y: number, value: number): number;
|
|
325
|
+
declare function lerp(x: number, y: number, t: number): number;
|
|
326
|
+
declare function damp(x: number, y: number, lambda: number, dt: number): number;
|
|
327
|
+
declare function pingpong(x: number, length?: number): number;
|
|
328
|
+
declare function smoothstep(x: number, min: number, max: number): number;
|
|
329
|
+
declare function smootherstep(x: number, min: number, max: number): number;
|
|
330
|
+
declare function randInt(low: number, high: number): number;
|
|
331
|
+
declare function randFloat(low: number, high: number): number;
|
|
332
|
+
declare function randFloatSpread(range: number): number;
|
|
333
|
+
declare function seededRandom(s: number): number;
|
|
334
|
+
declare function degToRad(degrees: number): number;
|
|
335
|
+
declare function radToDeg(radians: number): number;
|
|
336
|
+
declare function isPowerOfTwo(value: number): boolean;
|
|
337
|
+
declare function ceilPowerOfTwo(value: number): number;
|
|
338
|
+
declare function floorPowerOfTwo(value: number): number;
|
|
339
|
+
declare function setQuaternionFromProperEuler(q: Quaternion, a: number, b: number, c: number, order: EulerOrder): void;
|
|
340
|
+
declare function denormalize(value: number, array: number[]): number;
|
|
341
|
+
declare function normalize(value: number, array: number[]): number;
|
|
342
|
+
declare const MathUtils: {
|
|
343
|
+
DEG2RAD: number;
|
|
344
|
+
RAD2DEG: number;
|
|
345
|
+
generateUUID: typeof generateUUID;
|
|
346
|
+
clamp: typeof clamp;
|
|
347
|
+
euclideanModulo: typeof euclideanModulo;
|
|
348
|
+
mapLinear: typeof mapLinear;
|
|
349
|
+
inverseLerp: typeof inverseLerp;
|
|
350
|
+
lerp: typeof lerp;
|
|
351
|
+
damp: typeof damp;
|
|
352
|
+
pingpong: typeof pingpong;
|
|
353
|
+
smoothstep: typeof smoothstep;
|
|
354
|
+
smootherstep: typeof smootherstep;
|
|
355
|
+
randInt: typeof randInt;
|
|
356
|
+
randFloat: typeof randFloat;
|
|
357
|
+
randFloatSpread: typeof randFloatSpread;
|
|
358
|
+
seededRandom: typeof seededRandom;
|
|
359
|
+
degToRad: typeof degToRad;
|
|
360
|
+
radToDeg: typeof radToDeg;
|
|
361
|
+
isPowerOfTwo: typeof isPowerOfTwo;
|
|
362
|
+
ceilPowerOfTwo: typeof ceilPowerOfTwo;
|
|
363
|
+
floorPowerOfTwo: typeof floorPowerOfTwo;
|
|
364
|
+
setQuaternionFromProperEuler: typeof setQuaternionFromProperEuler;
|
|
365
|
+
normalize: typeof normalize;
|
|
366
|
+
denormalize: typeof denormalize;
|
|
367
|
+
};
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* A `Vector3` whose components live in a shared `Float32Array` at a fixed
|
|
371
|
+
* offset rather than in three own properties.
|
|
372
|
+
*
|
|
373
|
+
* Every `Vector3` method routes through `x` / `y` / `z`, so replacing those
|
|
374
|
+
* with accessors inherits the whole API unchanged — including `clone()`, which
|
|
375
|
+
* still returns a detached plain `Vector3`.
|
|
376
|
+
*
|
|
377
|
+
* The accessors are installed on the prototype below rather than written as
|
|
378
|
+
* `get x()` in the class body, because TypeScript forbids overriding an
|
|
379
|
+
* inherited property with an accessor (TS2611). Runtime behaviour is the same:
|
|
380
|
+
* one shared property descriptor for every instance.
|
|
381
|
+
*/
|
|
382
|
+
declare class Vector3View extends Vector3 {
|
|
383
|
+
data: Float32Array;
|
|
384
|
+
offset: number;
|
|
385
|
+
x: number;
|
|
386
|
+
y: number;
|
|
387
|
+
z: number;
|
|
388
|
+
constructor(data: Float32Array, offset: number);
|
|
389
|
+
/** Points the view at a new backing array and row offset. */
|
|
390
|
+
bind(data: Float32Array, offset: number): void;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
declare class Vector4 {
|
|
394
|
+
x: number;
|
|
395
|
+
y: number;
|
|
396
|
+
z: number;
|
|
321
397
|
w: number;
|
|
398
|
+
readonly isVector4: boolean;
|
|
322
399
|
constructor(x?: number, y?: number, z?: number, w?: number);
|
|
323
400
|
get width(): number;
|
|
324
401
|
set width(value: number);
|
|
@@ -372,83 +449,22 @@ declare class Vector4 {
|
|
|
372
449
|
[Symbol.iterator](): Generator<number, void, unknown>;
|
|
373
450
|
}
|
|
374
451
|
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
declare
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
declare function degToRad(degrees: number): number;
|
|
392
|
-
declare function radToDeg(radians: number): number;
|
|
393
|
-
declare function isPowerOfTwo(value: number): boolean;
|
|
394
|
-
declare function ceilPowerOfTwo(value: number): number;
|
|
395
|
-
declare function floorPowerOfTwo(value: number): number;
|
|
396
|
-
declare function setQuaternionFromProperEuler(q: Quaternion, a: number, b: number, c: number, order: EulerOrder): void;
|
|
397
|
-
declare function denormalize(value: number, array: number[]): number;
|
|
398
|
-
declare function normalize(value: number, array: number[]): number;
|
|
399
|
-
declare const MathUtils: {
|
|
400
|
-
DEG2RAD: number;
|
|
401
|
-
RAD2DEG: number;
|
|
402
|
-
generateUUID: typeof generateUUID;
|
|
403
|
-
clamp: typeof clamp;
|
|
404
|
-
euclideanModulo: typeof euclideanModulo;
|
|
405
|
-
mapLinear: typeof mapLinear;
|
|
406
|
-
inverseLerp: typeof inverseLerp;
|
|
407
|
-
lerp: typeof lerp;
|
|
408
|
-
damp: typeof damp;
|
|
409
|
-
pingpong: typeof pingpong;
|
|
410
|
-
smoothstep: typeof smoothstep;
|
|
411
|
-
smootherstep: typeof smootherstep;
|
|
412
|
-
randInt: typeof randInt;
|
|
413
|
-
randFloat: typeof randFloat;
|
|
414
|
-
randFloatSpread: typeof randFloatSpread;
|
|
415
|
-
seededRandom: typeof seededRandom;
|
|
416
|
-
degToRad: typeof degToRad;
|
|
417
|
-
radToDeg: typeof radToDeg;
|
|
418
|
-
isPowerOfTwo: typeof isPowerOfTwo;
|
|
419
|
-
ceilPowerOfTwo: typeof ceilPowerOfTwo;
|
|
420
|
-
floorPowerOfTwo: typeof floorPowerOfTwo;
|
|
421
|
-
setQuaternionFromProperEuler: typeof setQuaternionFromProperEuler;
|
|
422
|
-
normalize: typeof normalize;
|
|
423
|
-
denormalize: typeof denormalize;
|
|
424
|
-
};
|
|
425
|
-
|
|
426
|
-
declare class Bezier {
|
|
427
|
-
p: number[];
|
|
428
|
-
constructor(p1: number, p2: number, p3: number, p4: number);
|
|
429
|
-
genValue(t: number): number;
|
|
430
|
-
derivativeCoefficients(points: number[]): number[][];
|
|
431
|
-
getSlope(t: number): number;
|
|
432
|
-
controlCurve(d0: number, d1: number): void;
|
|
433
|
-
hull(t: number): number[];
|
|
434
|
-
split(t: number): {
|
|
435
|
-
left: Bezier;
|
|
436
|
-
right: Bezier;
|
|
437
|
-
span: number[];
|
|
438
|
-
};
|
|
439
|
-
clone(): Bezier;
|
|
440
|
-
toJSON(): {
|
|
441
|
-
p0: number;
|
|
442
|
-
p1: number;
|
|
443
|
-
p2: number;
|
|
444
|
-
p3: number;
|
|
445
|
-
};
|
|
446
|
-
static fromJSON(json: {
|
|
447
|
-
p0: number;
|
|
448
|
-
p1: number;
|
|
449
|
-
p2: number;
|
|
450
|
-
p3: number;
|
|
451
|
-
}): Bezier;
|
|
452
|
+
/**
|
|
453
|
+
* A `Vector4` backed by a shared `Float32Array` at a fixed offset. Replacing
|
|
454
|
+
* the four component accessors inherits every `Vector4` method as-is; they are
|
|
455
|
+
* installed on the prototype because TypeScript forbids overriding an
|
|
456
|
+
* inherited property with an accessor in the class body (TS2611).
|
|
457
|
+
*/
|
|
458
|
+
declare class Vector4View extends Vector4 {
|
|
459
|
+
data: Float32Array;
|
|
460
|
+
offset: number;
|
|
461
|
+
x: number;
|
|
462
|
+
y: number;
|
|
463
|
+
z: number;
|
|
464
|
+
w: number;
|
|
465
|
+
constructor(data: Float32Array, offset: number);
|
|
466
|
+
/** Points the view at a new backing array and row offset. */
|
|
467
|
+
bind(data: Float32Array, offset: number): void;
|
|
452
468
|
}
|
|
453
469
|
|
|
454
470
|
type FunctionJSON = {
|
|
@@ -504,16 +520,83 @@ type FunctionJSON = {
|
|
|
504
520
|
*/
|
|
505
521
|
type GeneratorMemory = any[];
|
|
506
522
|
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
b: Vector4;
|
|
510
|
-
constructor(a: Vector4, b: Vector4);
|
|
523
|
+
interface RotationGenerator {
|
|
524
|
+
type: 'rotation';
|
|
511
525
|
startGen(memory: GeneratorMemory): void;
|
|
512
|
-
|
|
526
|
+
genValue(memory: GeneratorMemory, q: Quaternion, delta: number, t: number): Quaternion;
|
|
527
|
+
toJSON(): FunctionJSON;
|
|
528
|
+
clone(): RotationGenerator;
|
|
529
|
+
}
|
|
530
|
+
declare function RotationGeneratorFromJSON(json: FunctionJSON): RotationGenerator;
|
|
531
|
+
|
|
532
|
+
/**
|
|
533
|
+
* `startGen`/`genValue` follow the per-particle slot pattern documented in
|
|
534
|
+
* `GeneratorMemory.ts`: spawn calls `startGen(memory)` once (claim a slot or
|
|
535
|
+
* no-op), then `genValue(memory)` per frame.
|
|
536
|
+
*/
|
|
537
|
+
interface ValueGenerator {
|
|
513
538
|
type: 'value';
|
|
539
|
+
startGen(memory: any): void;
|
|
540
|
+
genValue(memory: any): number;
|
|
541
|
+
/** See FunctionValueGenerator.refreshTable. */
|
|
542
|
+
refreshTable?(): void;
|
|
514
543
|
toJSON(): FunctionJSON;
|
|
515
|
-
|
|
516
|
-
|
|
544
|
+
clone(): ValueGenerator;
|
|
545
|
+
}
|
|
546
|
+
interface FunctionValueGenerator {
|
|
547
|
+
type: 'function';
|
|
548
|
+
startGen(memory: GeneratorMemory): void;
|
|
549
|
+
genValue(memory: GeneratorMemory, t: number): number;
|
|
550
|
+
/**
|
|
551
|
+
* Optional hook for generators that can precompute a sampled table of
|
|
552
|
+
* themselves. Called once per frame by behaviors that evaluate the
|
|
553
|
+
* generator per particle, before any genValue of that frame, so a curve
|
|
554
|
+
* edited between frames is picked up.
|
|
555
|
+
*/
|
|
556
|
+
refreshTable?(): void;
|
|
557
|
+
toJSON(): FunctionJSON;
|
|
558
|
+
clone(): FunctionValueGenerator;
|
|
559
|
+
}
|
|
560
|
+
declare function ValueGeneratorFromJSON(json: FunctionJSON): FunctionValueGenerator | ValueGenerator;
|
|
561
|
+
|
|
562
|
+
declare class AxisAngleGenerator implements RotationGenerator {
|
|
563
|
+
axis: Vector3;
|
|
564
|
+
angle: FunctionValueGenerator | ValueGenerator;
|
|
565
|
+
type: 'rotation';
|
|
566
|
+
constructor(axis: Vector3, angle: FunctionValueGenerator | ValueGenerator);
|
|
567
|
+
startGen(memory: GeneratorMemory): void;
|
|
568
|
+
genValue(memory: GeneratorMemory, quat: Quaternion, delta: number, t?: number): Quaternion;
|
|
569
|
+
toJSON(): FunctionJSON;
|
|
570
|
+
static fromJSON(json: FunctionJSON): AxisAngleGenerator;
|
|
571
|
+
clone(): RotationGenerator;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
declare class Bezier {
|
|
575
|
+
p: number[];
|
|
576
|
+
constructor(p1: number, p2: number, p3: number, p4: number);
|
|
577
|
+
genValue(t: number): number;
|
|
578
|
+
derivativeCoefficients(points: number[]): number[][];
|
|
579
|
+
getSlope(t: number): number;
|
|
580
|
+
controlCurve(d0: number, d1: number): void;
|
|
581
|
+
hull(t: number): number[];
|
|
582
|
+
split(t: number): {
|
|
583
|
+
left: Bezier;
|
|
584
|
+
right: Bezier;
|
|
585
|
+
span: number[];
|
|
586
|
+
};
|
|
587
|
+
clone(): Bezier;
|
|
588
|
+
toJSON(): {
|
|
589
|
+
p0: number;
|
|
590
|
+
p1: number;
|
|
591
|
+
p2: number;
|
|
592
|
+
p3: number;
|
|
593
|
+
};
|
|
594
|
+
static fromJSON(json: {
|
|
595
|
+
p0: number;
|
|
596
|
+
p1: number;
|
|
597
|
+
p2: number;
|
|
598
|
+
p3: number;
|
|
599
|
+
}): Bezier;
|
|
517
600
|
}
|
|
518
601
|
|
|
519
602
|
declare class ColorRange implements ColorGenerator {
|
|
@@ -553,13 +636,41 @@ declare class Gradient implements FunctionColorGenerator {
|
|
|
553
636
|
color: ContinuousLinearFunction<Vector3>;
|
|
554
637
|
alpha: ContinuousLinearFunction<number>;
|
|
555
638
|
constructor(color?: Array<[Vector3, number]>, alpha?: Array<[number, number]>);
|
|
639
|
+
/** Sample count of the tables built by {@link refreshTable}. */
|
|
640
|
+
static readonly TABLE_SIZE = 257;
|
|
641
|
+
/** Sampled RGBA copy of the gradient, or null while none has been built. */
|
|
642
|
+
private table;
|
|
643
|
+
/** Keys the tables were built from, used to detect edits. Float64 for the same reason as PiecewiseBezier's. */
|
|
644
|
+
private tableSignature;
|
|
645
|
+
/**
|
|
646
|
+
* Rebuilds the sampled table when the gradient changed, otherwise does
|
|
647
|
+
* nothing. See PiecewiseBezier.refreshTable — same reasoning, and the same
|
|
648
|
+
* signature check so a gradient edited in an editor is picked up.
|
|
649
|
+
*/
|
|
650
|
+
refreshTable(): void;
|
|
651
|
+
/** Drops the sampled table, so later reads go back to evaluating the keys. */
|
|
652
|
+
clearTable(): void;
|
|
556
653
|
genColor(memory: GeneratorMemory, color: Vector4, t: number): Vector4;
|
|
654
|
+
/** Evaluates the gradient keys themselves, ignoring any sampled table. */
|
|
655
|
+
genColorExact(color: Vector4, t: number): Vector4;
|
|
557
656
|
toJSON(): FunctionJSON;
|
|
558
657
|
static fromJSON(json: FunctionJSON): Gradient;
|
|
559
658
|
clone(): FunctionColorGenerator;
|
|
560
659
|
startGen(memory: GeneratorMemory): void;
|
|
561
660
|
}
|
|
562
661
|
|
|
662
|
+
declare class RandomColor implements ColorGenerator {
|
|
663
|
+
a: Vector4;
|
|
664
|
+
b: Vector4;
|
|
665
|
+
constructor(a: Vector4, b: Vector4);
|
|
666
|
+
startGen(memory: GeneratorMemory): void;
|
|
667
|
+
genColor(memory: GeneratorMemory, color: Vector4): Vector4;
|
|
668
|
+
type: 'value';
|
|
669
|
+
toJSON(): FunctionJSON;
|
|
670
|
+
static fromJSON(json: FunctionJSON): RandomColor;
|
|
671
|
+
clone(): ColorGenerator;
|
|
672
|
+
}
|
|
673
|
+
|
|
563
674
|
declare class RandomColorBetweenGradient implements FunctionColorGenerator {
|
|
564
675
|
gradient1: Gradient;
|
|
565
676
|
gradient2: Gradient;
|
|
@@ -584,6 +695,8 @@ interface FunctionColorGenerator {
|
|
|
584
695
|
type: 'function';
|
|
585
696
|
startGen(memory: GeneratorMemory): void;
|
|
586
697
|
genColor(memory: GeneratorMemory, color: Vector4, t: number): Vector4;
|
|
698
|
+
/** See FunctionValueGenerator.refreshTable. */
|
|
699
|
+
refreshTable?(): void;
|
|
587
700
|
toJSON(): FunctionJSON;
|
|
588
701
|
clone(): FunctionColorGenerator;
|
|
589
702
|
}
|
|
@@ -597,28 +710,7 @@ declare class ConstantColor implements ColorGenerator {
|
|
|
597
710
|
static fromJSON(json: FunctionJSON): ConstantColor;
|
|
598
711
|
clone(): ColorGenerator;
|
|
599
712
|
}
|
|
600
|
-
declare function ColorGeneratorFromJSON(json: FunctionJSON):
|
|
601
|
-
|
|
602
|
-
/**
|
|
603
|
-
* `startGen`/`genValue` follow the per-particle slot pattern documented in
|
|
604
|
-
* `GeneratorMemory.ts`: spawn calls `startGen(memory)` once (claim a slot or
|
|
605
|
-
* no-op), then `genValue(memory)` per frame.
|
|
606
|
-
*/
|
|
607
|
-
interface ValueGenerator {
|
|
608
|
-
type: 'value';
|
|
609
|
-
startGen(memory: any): void;
|
|
610
|
-
genValue(memory: any): number;
|
|
611
|
-
toJSON(): FunctionJSON;
|
|
612
|
-
clone(): ValueGenerator;
|
|
613
|
-
}
|
|
614
|
-
interface FunctionValueGenerator {
|
|
615
|
-
type: 'function';
|
|
616
|
-
startGen(memory: GeneratorMemory): void;
|
|
617
|
-
genValue(memory: GeneratorMemory, t: number): number;
|
|
618
|
-
toJSON(): FunctionJSON;
|
|
619
|
-
clone(): FunctionValueGenerator;
|
|
620
|
-
}
|
|
621
|
-
declare function ValueGeneratorFromJSON(json: FunctionJSON): FunctionValueGenerator | ValueGenerator;
|
|
713
|
+
declare function ColorGeneratorFromJSON(json: FunctionJSON): ColorRange | Gradient | RandomColor | RandomColorBetweenGradient | ConstantColor;
|
|
622
714
|
|
|
623
715
|
declare class ConstantValue implements ValueGenerator {
|
|
624
716
|
value: number;
|
|
@@ -631,8 +723,35 @@ declare class ConstantValue implements ValueGenerator {
|
|
|
631
723
|
clone(): ValueGenerator;
|
|
632
724
|
}
|
|
633
725
|
|
|
634
|
-
declare class
|
|
635
|
-
|
|
726
|
+
declare class EulerGenerator implements RotationGenerator {
|
|
727
|
+
angleX: FunctionValueGenerator | ValueGenerator;
|
|
728
|
+
angleY: FunctionValueGenerator | ValueGenerator;
|
|
729
|
+
angleZ: FunctionValueGenerator | ValueGenerator;
|
|
730
|
+
type: 'rotation';
|
|
731
|
+
eular: Euler;
|
|
732
|
+
constructor(angleX: FunctionValueGenerator | ValueGenerator, angleY: FunctionValueGenerator | ValueGenerator, angleZ: FunctionValueGenerator | ValueGenerator, eulerOrder?: EulerOrder);
|
|
733
|
+
startGen(memory: GeneratorMemory): void;
|
|
734
|
+
genValue(memory: GeneratorMemory, quat: Quaternion, delta: number, t?: number): Quaternion;
|
|
735
|
+
toJSON(): FunctionJSON;
|
|
736
|
+
static fromJSON(json: FunctionJSON): EulerGenerator;
|
|
737
|
+
clone(): RotationGenerator;
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
interface Vector3Generator {
|
|
741
|
+
type: 'vec3function';
|
|
742
|
+
startGen(memory: GeneratorMemory): void;
|
|
743
|
+
genValue(memory: GeneratorMemory, vec: Vector3, t?: number): Vector3;
|
|
744
|
+
/** See FunctionValueGenerator.refreshTable. */
|
|
745
|
+
refreshTable?(): void;
|
|
746
|
+
toJSON(): FunctionJSON;
|
|
747
|
+
clone(): Vector3Generator;
|
|
748
|
+
}
|
|
749
|
+
declare function Vector3GeneratorFromJSON(json: FunctionJSON): Vector3Generator;
|
|
750
|
+
|
|
751
|
+
declare function GeneratorFromJSON(json: FunctionJSON): FunctionValueGenerator | ValueGenerator | RotationGenerator | Vector3Generator;
|
|
752
|
+
|
|
753
|
+
declare class IntervalValue implements ValueGenerator {
|
|
754
|
+
a: number;
|
|
636
755
|
b: number;
|
|
637
756
|
constructor(a: number, b: number);
|
|
638
757
|
indexCount: number;
|
|
@@ -660,8 +779,40 @@ declare abstract class PiecewiseFunction<T> {
|
|
|
660
779
|
}
|
|
661
780
|
|
|
662
781
|
declare class PiecewiseBezier extends PiecewiseFunction<Bezier> implements FunctionValueGenerator {
|
|
782
|
+
/** Sample count of the table built by {@link refreshTable}. */
|
|
783
|
+
static readonly TABLE_SIZE = 257;
|
|
663
784
|
constructor(curves?: Array<[Bezier, number]>);
|
|
785
|
+
/**
|
|
786
|
+
* Sampled copy of the curve, or null while none has been built.
|
|
787
|
+
* See {@link refreshTable}.
|
|
788
|
+
*/
|
|
789
|
+
private table;
|
|
790
|
+
/**
|
|
791
|
+
* Control points the table was built from, used to detect edits. Float64 on purpose: the
|
|
792
|
+
* points are doubles, and a Float32Array rounds most of them (0.2, almost any exported value),
|
|
793
|
+
* so the comparison never matched and the table was resampled on every call.
|
|
794
|
+
*/
|
|
795
|
+
private tableSignature;
|
|
796
|
+
/**
|
|
797
|
+
* Rebuilds the sampled table when the curve changed, otherwise does nothing.
|
|
798
|
+
*
|
|
799
|
+
* Evaluating this curve means a piece lookup plus a cubic; a particle system
|
|
800
|
+
* does that once per particle per frame. Sampling it once and interpolating
|
|
801
|
+
* costs two loads and a lerp instead. Sampling error at
|
|
802
|
+
* {@link PiecewiseBezier.TABLE_SIZE} points stays around 1e-5 for the shapes
|
|
803
|
+
* a curve editor produces — far below what a colour or a size can show.
|
|
804
|
+
*
|
|
805
|
+
* The curve is public and mutable (a curve editor writes straight into
|
|
806
|
+
* `functions` and a Bezier's `p`), so this compares the control points
|
|
807
|
+
* against the ones the table was built from and only resamples on a real
|
|
808
|
+
* change. That is a handful of float compares per frame.
|
|
809
|
+
*/
|
|
810
|
+
refreshTable(): void;
|
|
811
|
+
/** Drops the sampled table, so later reads go back to evaluating the curve. */
|
|
812
|
+
clearTable(): void;
|
|
664
813
|
genValue(memory: GeneratorMemory, t?: number): number;
|
|
814
|
+
/** Evaluates the curve itself, ignoring any sampled table. */
|
|
815
|
+
genValueExact(t: number): number;
|
|
665
816
|
toSVG(length: number, segments: number): string;
|
|
666
817
|
type: 'function';
|
|
667
818
|
toJSON(): FunctionJSON;
|
|
@@ -670,15 +821,6 @@ declare class PiecewiseBezier extends PiecewiseFunction<Bezier> implements Funct
|
|
|
670
821
|
startGen(memory: GeneratorMemory): void;
|
|
671
822
|
}
|
|
672
823
|
|
|
673
|
-
interface RotationGenerator {
|
|
674
|
-
type: 'rotation';
|
|
675
|
-
startGen(memory: GeneratorMemory): void;
|
|
676
|
-
genValue(memory: GeneratorMemory, q: Quaternion, delta: number, t: number): Quaternion;
|
|
677
|
-
toJSON(): FunctionJSON;
|
|
678
|
-
clone(): RotationGenerator;
|
|
679
|
-
}
|
|
680
|
-
declare function RotationGeneratorFromJSON(json: FunctionJSON): RotationGenerator;
|
|
681
|
-
|
|
682
824
|
declare class RandomQuatGenerator implements RotationGenerator {
|
|
683
825
|
type: 'rotation';
|
|
684
826
|
constructor();
|
|
@@ -690,41 +832,6 @@ declare class RandomQuatGenerator implements RotationGenerator {
|
|
|
690
832
|
clone(): RotationGenerator;
|
|
691
833
|
}
|
|
692
834
|
|
|
693
|
-
declare class AxisAngleGenerator implements RotationGenerator {
|
|
694
|
-
axis: Vector3;
|
|
695
|
-
angle: FunctionValueGenerator | ValueGenerator;
|
|
696
|
-
type: 'rotation';
|
|
697
|
-
constructor(axis: Vector3, angle: FunctionValueGenerator | ValueGenerator);
|
|
698
|
-
startGen(memory: GeneratorMemory): void;
|
|
699
|
-
genValue(memory: GeneratorMemory, quat: Quaternion, delta: number, t?: number): Quaternion;
|
|
700
|
-
toJSON(): FunctionJSON;
|
|
701
|
-
static fromJSON(json: FunctionJSON): AxisAngleGenerator;
|
|
702
|
-
clone(): RotationGenerator;
|
|
703
|
-
}
|
|
704
|
-
|
|
705
|
-
declare class EulerGenerator implements RotationGenerator {
|
|
706
|
-
angleX: FunctionValueGenerator | ValueGenerator;
|
|
707
|
-
angleY: FunctionValueGenerator | ValueGenerator;
|
|
708
|
-
angleZ: FunctionValueGenerator | ValueGenerator;
|
|
709
|
-
type: 'rotation';
|
|
710
|
-
eular: Euler;
|
|
711
|
-
constructor(angleX: FunctionValueGenerator | ValueGenerator, angleY: FunctionValueGenerator | ValueGenerator, angleZ: FunctionValueGenerator | ValueGenerator, eulerOrder?: EulerOrder);
|
|
712
|
-
startGen(memory: GeneratorMemory): void;
|
|
713
|
-
genValue(memory: GeneratorMemory, quat: Quaternion, delta: number, t?: number): Quaternion;
|
|
714
|
-
toJSON(): FunctionJSON;
|
|
715
|
-
static fromJSON(json: FunctionJSON): EulerGenerator;
|
|
716
|
-
clone(): RotationGenerator;
|
|
717
|
-
}
|
|
718
|
-
|
|
719
|
-
interface Vector3Generator {
|
|
720
|
-
type: 'vec3function';
|
|
721
|
-
startGen(memory: GeneratorMemory): void;
|
|
722
|
-
genValue(memory: GeneratorMemory, vec: Vector3, t?: number): Vector3;
|
|
723
|
-
toJSON(): FunctionJSON;
|
|
724
|
-
clone(): Vector3Generator;
|
|
725
|
-
}
|
|
726
|
-
declare function Vector3GeneratorFromJSON(json: FunctionJSON): Vector3Generator;
|
|
727
|
-
|
|
728
835
|
declare class Vector3Function implements Vector3Generator {
|
|
729
836
|
x: FunctionValueGenerator | ValueGenerator;
|
|
730
837
|
y: FunctionValueGenerator | ValueGenerator;
|
|
@@ -738,7 +845,103 @@ declare class Vector3Function implements Vector3Generator {
|
|
|
738
845
|
clone(): Vector3Generator;
|
|
739
846
|
}
|
|
740
847
|
|
|
741
|
-
|
|
848
|
+
/**
|
|
849
|
+
* Column storage for the vector-valued particle attributes.
|
|
850
|
+
*
|
|
851
|
+
* The three-component and four-component fields of a particle used to be six
|
|
852
|
+
* separate objects per particle, so walking a system meant chasing pointers
|
|
853
|
+
* across the heap. Here each attribute is one flat `Float32Array` shared by
|
|
854
|
+
* every particle in a system, and a particle holds views into its own row. The
|
|
855
|
+
* numbers a simulation step touches are then contiguous and prefetchable, while
|
|
856
|
+
* `particle.position.x` keeps working exactly as before.
|
|
857
|
+
*
|
|
858
|
+
* Scalar attributes (age, life, rotation, …) stay as plain properties on the
|
|
859
|
+
* particle: a monomorphic own property is already a single load, so moving them
|
|
860
|
+
* here would add an indirection rather than remove one.
|
|
861
|
+
*/
|
|
862
|
+
declare class ParticleStore {
|
|
863
|
+
private static readonly EMPTY;
|
|
864
|
+
/** Number of particle rows the arrays can hold. */
|
|
865
|
+
capacity: number;
|
|
866
|
+
position: Float32Array;
|
|
867
|
+
/**
|
|
868
|
+
* Where each particle was when the current simulation step began.
|
|
869
|
+
*
|
|
870
|
+
* The step is fixed while frames are not, so a frame is usually drawn some
|
|
871
|
+
* way past the last step. The renderer closes that gap by continuing the
|
|
872
|
+
* motion the last step produced — and the only way to know that motion for
|
|
873
|
+
* every kind of behavior, not just the ones that move a particle by its
|
|
874
|
+
* velocity, is to have kept where it started.
|
|
875
|
+
*/
|
|
876
|
+
previousPosition: Float32Array;
|
|
877
|
+
/**
|
|
878
|
+
* Size and colour at the start of the current step, for the same reason as
|
|
879
|
+
* {@link previousPosition}. These are read off a curve at `age / life`
|
|
880
|
+
* rather than integrated, and at the lifetimes an explosion uses — a fifth
|
|
881
|
+
* of a second, a dozen steps in total — a whole step of fade lands on one
|
|
882
|
+
* frame and none on the next.
|
|
883
|
+
*/
|
|
884
|
+
previousSize: Float32Array;
|
|
885
|
+
previousColor: Float32Array;
|
|
886
|
+
/**
|
|
887
|
+
* Velocity at the start of the current step. A stretched billboard's shape
|
|
888
|
+
* is its velocity — the streak points along it and is as long as it — so a
|
|
889
|
+
* velocity that only changes on steps makes the sprite's outline pop at the
|
|
890
|
+
* step rate even while its position moves smoothly.
|
|
891
|
+
*
|
|
892
|
+
* Empty until {@link keepPreviousVelocity} asks for it, because only that
|
|
893
|
+
* one render mode reads it and an unused column is not free: it sits
|
|
894
|
+
* between the columns that are hot and costs them their locality.
|
|
895
|
+
*/
|
|
896
|
+
previousVelocity: Float32Array;
|
|
897
|
+
velocity: Float32Array;
|
|
898
|
+
size: Float32Array;
|
|
899
|
+
startSize: Float32Array;
|
|
900
|
+
color: Float32Array;
|
|
901
|
+
startColor: Float32Array;
|
|
902
|
+
/**
|
|
903
|
+
* age, life and speedModifier interleaved, {@link SCALAR_STRIDE} per row.
|
|
904
|
+
*
|
|
905
|
+
* Double precision, unlike the vector columns: age accumulates `+= delta`
|
|
906
|
+
* for the particle's whole life and is compared against life to decide
|
|
907
|
+
* death, so rounding it to float32 shifts when particles die and makes
|
|
908
|
+
* tightly balanced emitters flicker.
|
|
909
|
+
*/
|
|
910
|
+
scalars: Float64Array;
|
|
911
|
+
/** Values per row in {@link scalars}. */
|
|
912
|
+
static readonly SCALAR_STRIDE = 3;
|
|
913
|
+
/** Offsets within a {@link scalars} row. */
|
|
914
|
+
static readonly AGE = 0;
|
|
915
|
+
static readonly LIFE = 1;
|
|
916
|
+
static readonly SPEED_MODIFIER = 2;
|
|
917
|
+
constructor(capacity?: number);
|
|
918
|
+
/**
|
|
919
|
+
* Grows the arrays so `count` rows fit, preserving the existing contents.
|
|
920
|
+
*
|
|
921
|
+
* @param count - Number of rows that must be addressable.
|
|
922
|
+
* @returns `true` when the arrays were replaced, meaning every particle
|
|
923
|
+
* bound to this store has to be re-bound.
|
|
924
|
+
*/
|
|
925
|
+
ensureCapacity(count: number): boolean;
|
|
926
|
+
/**
|
|
927
|
+
* Exchanges the contents of two rows.
|
|
928
|
+
*
|
|
929
|
+
* Used to keep row order aligned with the owning system's particle order, so
|
|
930
|
+
* the live particles stay a contiguous range that a renderer can copy in one
|
|
931
|
+
* go rather than gathering particle by particle.
|
|
932
|
+
*/
|
|
933
|
+
/**
|
|
934
|
+
* Starts keeping {@link previousVelocity}. Harmless to call every step;
|
|
935
|
+
* returns true on the call that allocated, which replaces the array and so
|
|
936
|
+
* leaves every particle's view of it pointing at the old one.
|
|
937
|
+
*/
|
|
938
|
+
keepPreviousVelocity(): boolean;
|
|
939
|
+
swapRows(a: number, b: number): void;
|
|
940
|
+
private static growDouble;
|
|
941
|
+
private static swap3;
|
|
942
|
+
private static swap4;
|
|
943
|
+
private static grow;
|
|
944
|
+
}
|
|
742
945
|
|
|
743
946
|
interface EmissionState {
|
|
744
947
|
burstIndex: number;
|
|
@@ -794,6 +997,31 @@ interface TrailSettings {
|
|
|
794
997
|
* @type {boolean}
|
|
795
998
|
*/
|
|
796
999
|
followLocalOrigin: boolean;
|
|
1000
|
+
/**
|
|
1001
|
+
* Run the texture's U from the particle (0) back to the tail (1), the way
|
|
1002
|
+
* Unity's stretched trails map it. Off, U runs from the tail to the particle.
|
|
1003
|
+
* @type {boolean}
|
|
1004
|
+
*/
|
|
1005
|
+
uvFromHead?: boolean;
|
|
1006
|
+
/**
|
|
1007
|
+
* Draw the whole trail in the particle's current color, as Unity's trails
|
|
1008
|
+
* do, instead of the color each sample had when it was recorded.
|
|
1009
|
+
* @type {boolean}
|
|
1010
|
+
*/
|
|
1011
|
+
colorFromParticle?: boolean;
|
|
1012
|
+
/**
|
|
1013
|
+
* Drop the trail the moment its particle dies, instead of letting it
|
|
1014
|
+
* shrink away one sample per step.
|
|
1015
|
+
* @type {boolean}
|
|
1016
|
+
*/
|
|
1017
|
+
dieWithParticle?: boolean;
|
|
1018
|
+
/**
|
|
1019
|
+
* Record trail points in world space even though the system simulates in
|
|
1020
|
+
* local space, so the trail streaks behind a moving emitter instead of
|
|
1021
|
+
* moving rigidly with it (Unity's Trails > World Space).
|
|
1022
|
+
* @type {boolean}
|
|
1023
|
+
*/
|
|
1024
|
+
recordWorldSpace?: boolean;
|
|
797
1025
|
}
|
|
798
1026
|
interface MeshSettings {
|
|
799
1027
|
/**
|
|
@@ -823,13 +1051,44 @@ interface IEmitter {
|
|
|
823
1051
|
visible: boolean;
|
|
824
1052
|
matrixWorld: any;
|
|
825
1053
|
}
|
|
826
|
-
type ParticleSystemEventType =
|
|
1054
|
+
type ParticleSystemEventType = 'emitEnd' | 'finished' | 'destroy' | 'particleDied';
|
|
827
1055
|
interface ParticleSystemEvent {
|
|
828
1056
|
type: ParticleSystemEventType;
|
|
829
1057
|
particleSystem: IParticleSystem;
|
|
830
1058
|
particle?: IParticle;
|
|
831
1059
|
}
|
|
832
1060
|
interface IParticleSystem {
|
|
1061
|
+
/**
|
|
1062
|
+
* Column storage backing the particles' vector attributes, when the
|
|
1063
|
+
* implementation uses one. Rows `[0, particleNum)` hold the live particles
|
|
1064
|
+
* in the same order as `particles`, so a renderer can read them as ranges.
|
|
1065
|
+
* @type {ParticleStore}
|
|
1066
|
+
*/
|
|
1067
|
+
store?: ParticleStore;
|
|
1068
|
+
/**
|
|
1069
|
+
* Wall-clock time that has passed since the last simulated step, in
|
|
1070
|
+
* seconds, when the implementation simulates on a fixed timestep. Negative
|
|
1071
|
+
* when that step ran a hair ahead of real time instead (rounded to the
|
|
1072
|
+
* nearest step rather than floored, so this stays small either way). A
|
|
1073
|
+
* renderer uses it to draw where the particles are now rather than where
|
|
1074
|
+
* the last step left them.
|
|
1075
|
+
* @type {number}
|
|
1076
|
+
*/
|
|
1077
|
+
simulationResidual?: number;
|
|
1078
|
+
/**
|
|
1079
|
+
* Length of one simulation step, in seconds, when the implementation
|
|
1080
|
+
* simulates on a fixed timestep. Turning is recorded per step rather than
|
|
1081
|
+
* per second, so a renderer needs this to know what fraction of a step
|
|
1082
|
+
* {@link simulationResidual} is.
|
|
1083
|
+
* @type {number}
|
|
1084
|
+
*/
|
|
1085
|
+
simulationStep?: number;
|
|
1086
|
+
/**
|
|
1087
|
+
* Whether this system only emits through another system, which is when its
|
|
1088
|
+
* particles carry their own parent transform.
|
|
1089
|
+
* @type {boolean}
|
|
1090
|
+
*/
|
|
1091
|
+
onlyUsedByOther?: boolean;
|
|
833
1092
|
/**
|
|
834
1093
|
* Whether the ParticleSystem should be automatically disposed when it finishes emitting particles.
|
|
835
1094
|
* @type {string}
|
|
@@ -875,6 +1134,12 @@ interface IParticleSystem {
|
|
|
875
1134
|
* @type {BatchedRenderer}
|
|
876
1135
|
*/
|
|
877
1136
|
rendererEmitterSettings: RendererEmitterSettings;
|
|
1137
|
+
/**
|
|
1138
|
+
* Fraction of billboard particles mirrored along U (x) and V (y), each
|
|
1139
|
+
* picked at random when the particle is born — Unity's renderer Flip.
|
|
1140
|
+
* Absent: nothing is mirrored.
|
|
1141
|
+
*/
|
|
1142
|
+
flip?: Vector2;
|
|
878
1143
|
emissionState: EmissionState;
|
|
879
1144
|
paused: boolean;
|
|
880
1145
|
/** True after `endEmit()` — emission window closed (non-looping duration elapsed). */
|
|
@@ -989,6 +1254,30 @@ interface IParticle {
|
|
|
989
1254
|
get died(): boolean;
|
|
990
1255
|
}
|
|
991
1256
|
interface Particle extends IParticle {
|
|
1257
|
+
/**
|
|
1258
|
+
* Where the particle was when the current simulation step began, when the
|
|
1259
|
+
* implementation keeps it. A renderer draws between fixed steps and uses
|
|
1260
|
+
* this to continue the motion the last step produced, whatever produced it.
|
|
1261
|
+
* @type {Vector3}
|
|
1262
|
+
*/
|
|
1263
|
+
previousPosition?: Vector3;
|
|
1264
|
+
/**
|
|
1265
|
+
* Velocity at the start of the current step, when the implementation keeps
|
|
1266
|
+
* it. A stretched billboard is drawn from its velocity, so a renderer needs
|
|
1267
|
+
* this to keep the sprite's shape moving between steps as its position does.
|
|
1268
|
+
* @type {Vector3}
|
|
1269
|
+
*/
|
|
1270
|
+
previousVelocity?: Vector3;
|
|
1271
|
+
/**
|
|
1272
|
+
* How fast the particle is turning, as the behavior that turns it last left
|
|
1273
|
+
* it: a rate in radians per second for a particle that rotates by an angle,
|
|
1274
|
+
* or one simulation step's turn for one that rotates by quaternion.
|
|
1275
|
+
*
|
|
1276
|
+
* Written by the turning behaviors and read by the renderer, which draws
|
|
1277
|
+
* between simulation steps and has no other way to continue the turn.
|
|
1278
|
+
* @type {number | Quaternion}
|
|
1279
|
+
*/
|
|
1280
|
+
angularVelocity?: number | Quaternion;
|
|
992
1281
|
/**
|
|
993
1282
|
* Speed modifier of the particle.
|
|
994
1283
|
* @type {number}
|
|
@@ -1085,6 +1374,10 @@ declare class NodeParticle implements IParticle {
|
|
|
1085
1374
|
* Particle implementation for sprite-based particle.
|
|
1086
1375
|
*/
|
|
1087
1376
|
declare class SpriteParticle implements Particle {
|
|
1377
|
+
/** Column storage backing this particle's vector attributes. */
|
|
1378
|
+
readonly store: ParticleStore;
|
|
1379
|
+
/** Row this particle occupies in {@link store}. */
|
|
1380
|
+
storeIndex: number;
|
|
1088
1381
|
/**
|
|
1089
1382
|
* Parent matrix for transformation.
|
|
1090
1383
|
* @type {Matrix4}
|
|
@@ -1110,31 +1403,49 @@ declare class SpriteParticle implements Particle {
|
|
|
1110
1403
|
* @type {Vector3}
|
|
1111
1404
|
*/
|
|
1112
1405
|
position: Vector3;
|
|
1406
|
+
/**
|
|
1407
|
+
* Where this particle was when the current simulation step began; see
|
|
1408
|
+
* {@link Particle.previousPosition}.
|
|
1409
|
+
* @type {Vector3}
|
|
1410
|
+
*/
|
|
1411
|
+
previousPosition: Vector3;
|
|
1412
|
+
/**
|
|
1413
|
+
* Velocity at the start of the current step; see
|
|
1414
|
+
* {@link Particle.previousVelocity}.
|
|
1415
|
+
* @type {Vector3}
|
|
1416
|
+
*/
|
|
1417
|
+
previousVelocity: Vector3;
|
|
1113
1418
|
/**
|
|
1114
1419
|
* Velocity of the particle.
|
|
1115
1420
|
* @type {Vector3}
|
|
1116
1421
|
*/
|
|
1117
1422
|
velocity: Vector3;
|
|
1423
|
+
/**
|
|
1424
|
+
* Size of the particle.
|
|
1425
|
+
* @type {Vector3}
|
|
1426
|
+
*/
|
|
1427
|
+
size: Vector3;
|
|
1428
|
+
/** Row of the store's interleaved scalars this particle owns. */
|
|
1429
|
+
protected scalars: Float64Array;
|
|
1430
|
+
protected scalarOffset: number;
|
|
1118
1431
|
/**
|
|
1119
1432
|
* Age of the particle.
|
|
1120
1433
|
* @type {number}
|
|
1121
1434
|
*/
|
|
1122
|
-
age: number;
|
|
1435
|
+
get age(): number;
|
|
1436
|
+
set age(value: number);
|
|
1123
1437
|
/**
|
|
1124
1438
|
* Life duration of the particle.
|
|
1125
1439
|
* @type {number}
|
|
1126
1440
|
*/
|
|
1127
|
-
life: number;
|
|
1128
|
-
|
|
1129
|
-
* Size of the particle.
|
|
1130
|
-
* @type {Vector3}
|
|
1131
|
-
*/
|
|
1132
|
-
size: Vector3;
|
|
1441
|
+
get life(): number;
|
|
1442
|
+
set life(value: number);
|
|
1133
1443
|
/**
|
|
1134
1444
|
* Speed modifier of the particle.
|
|
1135
1445
|
* @type {number}
|
|
1136
1446
|
*/
|
|
1137
|
-
speedModifier: number;
|
|
1447
|
+
get speedModifier(): number;
|
|
1448
|
+
set speedModifier(value: number);
|
|
1138
1449
|
/**
|
|
1139
1450
|
* Angular velocity of the particle.
|
|
1140
1451
|
* @type {number | Quaternion}
|
|
@@ -1155,6 +1466,25 @@ declare class SpriteParticle implements Particle {
|
|
|
1155
1466
|
* @type {number}
|
|
1156
1467
|
*/
|
|
1157
1468
|
uvTile: number;
|
|
1469
|
+
/**
|
|
1470
|
+
* Mirroring picked at birth from the system's `flip` fractions: bit 1
|
|
1471
|
+
* mirrors the sprite along U, bit 2 along V. 0 draws it as is.
|
|
1472
|
+
* @type {number}
|
|
1473
|
+
*/
|
|
1474
|
+
flip: number;
|
|
1475
|
+
/**
|
|
1476
|
+
* @param store - Column storage to bind to. A private single-row store is
|
|
1477
|
+
* created when omitted, so a standalone `new SpriteParticle()` still works.
|
|
1478
|
+
* @param storeIndex - Row this particle owns.
|
|
1479
|
+
*/
|
|
1480
|
+
constructor(store?: ParticleStore, storeIndex?: number);
|
|
1481
|
+
/**
|
|
1482
|
+
* Moves this particle onto a different store row. The caller is responsible
|
|
1483
|
+
* for having moved the row contents too.
|
|
1484
|
+
*/
|
|
1485
|
+
setStoreIndex(index: number): void;
|
|
1486
|
+
/** Re-points the vector views after the store grew its arrays. */
|
|
1487
|
+
rebind(): void;
|
|
1158
1488
|
/**
|
|
1159
1489
|
* Indicates if the particle has died.
|
|
1160
1490
|
* @type {boolean}
|
|
@@ -1179,6 +1509,10 @@ declare class RecordState {
|
|
|
1179
1509
|
* Particle implementation for trail-based particles.
|
|
1180
1510
|
*/
|
|
1181
1511
|
declare class TrailParticle implements Particle {
|
|
1512
|
+
/** Column storage backing this particle's vector attributes. */
|
|
1513
|
+
readonly store: ParticleStore;
|
|
1514
|
+
/** Row this particle occupies in {@link store}. */
|
|
1515
|
+
storeIndex: number;
|
|
1182
1516
|
/**
|
|
1183
1517
|
* Parent matrix for transformation.
|
|
1184
1518
|
* @type {Matrix4}
|
|
@@ -1204,6 +1538,18 @@ declare class TrailParticle implements Particle {
|
|
|
1204
1538
|
* @type {Vector3}
|
|
1205
1539
|
*/
|
|
1206
1540
|
position: Vector3;
|
|
1541
|
+
/**
|
|
1542
|
+
* Where this particle was when the current simulation step began; see
|
|
1543
|
+
* {@link Particle.previousPosition}.
|
|
1544
|
+
* @type {Vector3}
|
|
1545
|
+
*/
|
|
1546
|
+
previousPosition: Vector3;
|
|
1547
|
+
/**
|
|
1548
|
+
* Velocity at the start of the current step; see
|
|
1549
|
+
* {@link Particle.previousVelocity}.
|
|
1550
|
+
* @type {Vector3}
|
|
1551
|
+
*/
|
|
1552
|
+
previousVelocity: Vector3;
|
|
1207
1553
|
/**
|
|
1208
1554
|
* Local position of the particle.
|
|
1209
1555
|
* @type {Vector3}
|
|
@@ -1214,31 +1560,37 @@ declare class TrailParticle implements Particle {
|
|
|
1214
1560
|
* @type {Vector3}
|
|
1215
1561
|
*/
|
|
1216
1562
|
velocity: Vector3;
|
|
1563
|
+
/**
|
|
1564
|
+
* Size of the particle.
|
|
1565
|
+
* @type {Vector3}
|
|
1566
|
+
*/
|
|
1567
|
+
size: Vector3;
|
|
1568
|
+
/** Row of the store's interleaved scalars this particle owns. */
|
|
1569
|
+
protected scalars: Float64Array;
|
|
1570
|
+
protected scalarOffset: number;
|
|
1217
1571
|
/**
|
|
1218
1572
|
* Age of the particle.
|
|
1219
1573
|
* @type {number}
|
|
1220
1574
|
*/
|
|
1221
|
-
age: number;
|
|
1575
|
+
get age(): number;
|
|
1576
|
+
set age(value: number);
|
|
1222
1577
|
/**
|
|
1223
1578
|
* Life duration of the particle.
|
|
1224
1579
|
* @type {number}
|
|
1225
1580
|
*/
|
|
1226
|
-
life: number;
|
|
1581
|
+
get life(): number;
|
|
1582
|
+
set life(value: number);
|
|
1227
1583
|
/**
|
|
1228
|
-
*
|
|
1229
|
-
* @type {
|
|
1584
|
+
* Speed modifier of the particle.
|
|
1585
|
+
* @type {number}
|
|
1230
1586
|
*/
|
|
1231
|
-
|
|
1587
|
+
get speedModifier(): number;
|
|
1588
|
+
set speedModifier(value: number);
|
|
1232
1589
|
/**
|
|
1233
1590
|
* Length of the trail.
|
|
1234
1591
|
* @type {number}
|
|
1235
1592
|
*/
|
|
1236
1593
|
length: number;
|
|
1237
|
-
/**
|
|
1238
|
-
* Speed modifier of the particle.
|
|
1239
|
-
* @type {number}
|
|
1240
|
-
*/
|
|
1241
|
-
speedModifier: number;
|
|
1242
1594
|
/**
|
|
1243
1595
|
* Color of the particle.
|
|
1244
1596
|
* @type {Vector4}
|
|
@@ -1246,6 +1598,10 @@ declare class TrailParticle implements Particle {
|
|
|
1246
1598
|
color: Vector4;
|
|
1247
1599
|
/**
|
|
1248
1600
|
* Previous states of the particle.
|
|
1601
|
+
*
|
|
1602
|
+
* @deprecated The trail history now lives in the flat ring buffer below
|
|
1603
|
+
* (`historyPositions` / `historySizes` / `historyColors`), which records a
|
|
1604
|
+
* sample without allocating. This list is no longer populated or rendered.
|
|
1249
1605
|
* @type {LinkedList<RecordState>}
|
|
1250
1606
|
*/
|
|
1251
1607
|
previous: LinkedList<RecordState>;
|
|
@@ -1254,8 +1610,46 @@ declare class TrailParticle implements Particle {
|
|
|
1254
1610
|
* @type {number}
|
|
1255
1611
|
*/
|
|
1256
1612
|
uvTile: number;
|
|
1613
|
+
/** Ring buffer of recorded positions, 3 floats per sample. */
|
|
1614
|
+
historyPositions: Float32Array;
|
|
1615
|
+
/** Ring buffer of recorded widths, 1 float per sample. */
|
|
1616
|
+
historySizes: Float32Array;
|
|
1617
|
+
/** Ring buffer of recorded colors, 4 floats per sample. */
|
|
1618
|
+
historyColors: Float32Array;
|
|
1619
|
+
/** Number of samples the ring buffers can hold. */
|
|
1620
|
+
historyCapacity: number;
|
|
1621
|
+
/** Slot the next sample is written to. */
|
|
1622
|
+
historyHead: number;
|
|
1623
|
+
/** Number of valid samples currently held. */
|
|
1624
|
+
historyCount: number;
|
|
1625
|
+
/**
|
|
1626
|
+
* @param store - Column storage to bind to. A private single-row store is
|
|
1627
|
+
* created when omitted, so a standalone `new TrailParticle()` still works.
|
|
1628
|
+
* @param storeIndex - Row this particle owns.
|
|
1629
|
+
*/
|
|
1630
|
+
constructor(store?: ParticleStore, storeIndex?: number);
|
|
1257
1631
|
/**
|
|
1258
|
-
*
|
|
1632
|
+
* Moves this particle onto a different store row. The caller is responsible
|
|
1633
|
+
* for having moved the row contents too.
|
|
1634
|
+
*/
|
|
1635
|
+
setStoreIndex(index: number): void;
|
|
1636
|
+
/** Re-points the vector views after the store grew its arrays. */
|
|
1637
|
+
rebind(): void;
|
|
1638
|
+
/**
|
|
1639
|
+
* Allocates the trail ring buffers, reusing them when the capacity is unchanged.
|
|
1640
|
+
* @param {number} capacity - Number of samples to hold.
|
|
1641
|
+
*/
|
|
1642
|
+
ensureHistoryCapacity(capacity: number): void;
|
|
1643
|
+
/** Drops every recorded sample without releasing the buffers. */
|
|
1644
|
+
resetHistory(): void;
|
|
1645
|
+
/**
|
|
1646
|
+
* Ring buffer slot of the i-th sample counting from the oldest one.
|
|
1647
|
+
* @param {number} i - Sample offset, `0` being the oldest live sample.
|
|
1648
|
+
*/
|
|
1649
|
+
getHistoryIndex(i: number): number;
|
|
1650
|
+
/**
|
|
1651
|
+
* Records the current state into the trail ring buffer, or retires the
|
|
1652
|
+
* oldest sample once the particle is dead. Allocation free.
|
|
1259
1653
|
*/
|
|
1260
1654
|
update(): void;
|
|
1261
1655
|
/**
|
|
@@ -1270,494 +1664,390 @@ declare class TrailParticle implements Particle {
|
|
|
1270
1664
|
memory: never[];
|
|
1271
1665
|
}
|
|
1272
1666
|
|
|
1273
|
-
interface
|
|
1274
|
-
|
|
1275
|
-
radius?: number;
|
|
1276
|
-
arc?: number;
|
|
1277
|
-
thickness?: number;
|
|
1278
|
-
donutRadius?: number;
|
|
1279
|
-
angle?: number;
|
|
1280
|
-
width?: number;
|
|
1281
|
-
height?: number;
|
|
1282
|
-
column?: number;
|
|
1283
|
-
row?: number;
|
|
1284
|
-
mesh?: string;
|
|
1285
|
-
mode?: number;
|
|
1286
|
-
particleSystem?: string;
|
|
1287
|
-
spread?: number;
|
|
1288
|
-
speed?: any;
|
|
1667
|
+
interface Constructable<T> {
|
|
1668
|
+
new (...args: any): T;
|
|
1289
1669
|
}
|
|
1670
|
+
type FieldType = 'vec3' | 'value' | 'number' | 'range' | 'colorFunc' | 'valueFunc' | 'rotationFunc' | 'radian' | 'mesh' | 'particleSystem' | 'boolean' | 'string' | 'geometry' | 'emitterMode' | 'vec3Func';
|
|
1671
|
+
type ParameterType = FieldType | 'self';
|
|
1672
|
+
type ParameterPair = [string, Array<ParameterType>];
|
|
1673
|
+
|
|
1290
1674
|
/**
|
|
1291
|
-
*
|
|
1675
|
+
* Interface for particle behaviors.
|
|
1676
|
+
* a behavior is a function that modifies a particle's properties over time.
|
|
1292
1677
|
*/
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
Random = 0,
|
|
1298
|
-
/**
|
|
1299
|
-
* Emit particles in a continuous loop.
|
|
1300
|
-
*/
|
|
1301
|
-
Loop = 1,
|
|
1302
|
-
/**
|
|
1303
|
-
* Emit particles back and forth in a ping-pong manner.
|
|
1304
|
-
*/
|
|
1305
|
-
PingPong = 2,
|
|
1678
|
+
interface Behavior {
|
|
1679
|
+
type: string;
|
|
1680
|
+
initialize(particle: Particle, particleSystem: IParticleSystem): void;
|
|
1681
|
+
update(particle: Particle, delta: number): void;
|
|
1306
1682
|
/**
|
|
1307
|
-
*
|
|
1683
|
+
* Optional bulk form of {@link update}, applied to `particles[0..count)`.
|
|
1684
|
+
*
|
|
1685
|
+
* The per-particle `update` is reached through one call site shared by every
|
|
1686
|
+
* behavior type, which leaves it megamorphic: V8 can neither inline it nor
|
|
1687
|
+
* specialise the generator calls inside. A behavior that implements this
|
|
1688
|
+
* instead gets one call per frame and a loop it owns, where those calls are
|
|
1689
|
+
* monomorphic. Implementations must skip dead particles exactly as the
|
|
1690
|
+
* per-particle path does, and must produce identical results.
|
|
1691
|
+
*
|
|
1692
|
+
* Behaviors that do not implement it keep working unchanged.
|
|
1308
1693
|
*/
|
|
1309
|
-
|
|
1694
|
+
updateAll?(particles: Array<Particle>, count: number, delta: number): void;
|
|
1695
|
+
frameUpdate(delta: number): void;
|
|
1696
|
+
toJSON(): any;
|
|
1697
|
+
clone(): Behavior;
|
|
1698
|
+
reset(): void;
|
|
1310
1699
|
}
|
|
1311
|
-
|
|
1312
|
-
interface EmitterShape {
|
|
1700
|
+
interface BehaviorPlugin {
|
|
1313
1701
|
type: string;
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
clone(): EmitterShape;
|
|
1702
|
+
constructor: Constructable<Behavior>;
|
|
1703
|
+
params: ParameterPair[];
|
|
1704
|
+
loadJSON: (json: any, particleSystem: IParticleSystem) => Behavior;
|
|
1318
1705
|
}
|
|
1706
|
+
declare const BehaviorTypes: {
|
|
1707
|
+
[key: string]: BehaviorPlugin;
|
|
1708
|
+
};
|
|
1709
|
+
declare function BehaviorFromJSON(json: any, particleSystem: IParticleSystem): Behavior | null;
|
|
1319
1710
|
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
*/
|
|
1323
|
-
interface ConeEmitterParameters {
|
|
1324
|
-
/**
|
|
1325
|
-
* The radius of the cone base.
|
|
1326
|
-
*/
|
|
1327
|
-
radius?: number;
|
|
1328
|
-
/**
|
|
1329
|
-
* The arc of the cone.
|
|
1330
|
-
*/
|
|
1331
|
-
arc?: number;
|
|
1332
|
-
/**
|
|
1333
|
-
* The thickness of the cone. 1 is a full cone, 0 is a cone with 0 thickness.
|
|
1334
|
-
*/
|
|
1335
|
-
thickness?: number;
|
|
1336
|
-
/**
|
|
1337
|
-
* The angle of the cone, ranging from 0 to Math.PI / 2.
|
|
1338
|
-
*/
|
|
1339
|
-
angle?: number;
|
|
1340
|
-
/**
|
|
1341
|
-
* The mode of the emitter.
|
|
1342
|
-
* {@link EmitterMode}
|
|
1343
|
-
*/
|
|
1344
|
-
mode?: EmitterMode;
|
|
1345
|
-
/**
|
|
1346
|
-
* The length of the segment at which the emitter point converges at the start and end, when mode is EmitterMode.Loop or EmitterMode.PingPong.
|
|
1347
|
-
* {@link EmitterMode}
|
|
1348
|
-
*/
|
|
1349
|
-
spread?: number;
|
|
1350
|
-
/**
|
|
1351
|
-
* The speed of the emitter start point when mode is EmitterMode.Loop or EmitterMode.PingPong.
|
|
1352
|
-
* {@link EmitterMode}
|
|
1353
|
-
*/
|
|
1354
|
-
speed?: ValueGenerator | FunctionValueGenerator;
|
|
1355
|
-
}
|
|
1356
|
-
declare class ConeEmitter implements EmitterShape {
|
|
1357
|
-
type: string;
|
|
1358
|
-
radius: number;
|
|
1359
|
-
arc: number;
|
|
1360
|
-
thickness: number;
|
|
1361
|
-
angle: number;
|
|
1362
|
-
mode: EmitterMode;
|
|
1363
|
-
spread: number;
|
|
1364
|
-
speed: ValueGenerator | FunctionValueGenerator;
|
|
1365
|
-
memory: GeneratorMemory;
|
|
1366
|
-
private currentValue;
|
|
1367
|
-
constructor(parameters?: ConeEmitterParameters);
|
|
1368
|
-
update(system: IParticleSystem, delta: number): void;
|
|
1369
|
-
initialize(p: Particle, emissionState: EmissionState): void;
|
|
1370
|
-
toJSON(): ShapeJSON;
|
|
1371
|
-
static fromJSON(json: ShapeJSON): ConeEmitter;
|
|
1372
|
-
clone(): EmitterShape;
|
|
1711
|
+
interface PhysicsResolver {
|
|
1712
|
+
resolve(pos: Vector3, normal: Vector3): boolean;
|
|
1373
1713
|
}
|
|
1374
|
-
|
|
1714
|
+
declare function setPhysicsResolver(resolver: PhysicsResolver): void;
|
|
1715
|
+
declare function getPhysicsResolver(): PhysicsResolver;
|
|
1375
1716
|
/**
|
|
1376
|
-
*
|
|
1717
|
+
* Apply collision to particles from a physics resolver.
|
|
1377
1718
|
*/
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
thickness?: number;
|
|
1392
|
-
/**
|
|
1393
|
-
* The mode of the emitter.
|
|
1394
|
-
* {@link EmitterMode}
|
|
1395
|
-
*/
|
|
1396
|
-
mode?: EmitterMode;
|
|
1397
|
-
/**
|
|
1398
|
-
* The length of segment of which emitter point converges at the start and end, when mode is EmitterMode.Loop or EmitterMode.PingPong.
|
|
1399
|
-
* {@link EmitterMode}
|
|
1400
|
-
*/
|
|
1401
|
-
spread?: number;
|
|
1402
|
-
/**
|
|
1403
|
-
* The speed of the emitter start point travels when mode is EmitterMode.Loop or EmitterMode.PingPong.
|
|
1404
|
-
* {@link EmitterMode}
|
|
1405
|
-
*/
|
|
1406
|
-
speed?: ValueGenerator | FunctionValueGenerator;
|
|
1719
|
+
declare class ApplyCollision implements Behavior {
|
|
1720
|
+
resolver: PhysicsResolver;
|
|
1721
|
+
bounce: number;
|
|
1722
|
+
type: string;
|
|
1723
|
+
tempV: Vector3;
|
|
1724
|
+
constructor(resolver: PhysicsResolver, bounce: number);
|
|
1725
|
+
initialize(particle: Particle): void;
|
|
1726
|
+
update(particle: Particle, delta: number): void;
|
|
1727
|
+
frameUpdate(delta: number): void;
|
|
1728
|
+
toJSON(): any;
|
|
1729
|
+
static fromJSON(json: any): Behavior;
|
|
1730
|
+
clone(): Behavior;
|
|
1731
|
+
reset(): void;
|
|
1407
1732
|
}
|
|
1733
|
+
|
|
1408
1734
|
/**
|
|
1409
|
-
* a
|
|
1735
|
+
* Apply a global force to particles.
|
|
1410
1736
|
*/
|
|
1411
|
-
declare class
|
|
1737
|
+
declare class ApplyForce implements Behavior {
|
|
1738
|
+
direction: Vector3;
|
|
1739
|
+
magnitude: ValueGenerator;
|
|
1412
1740
|
type: string;
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1741
|
+
magnitudeValue: number;
|
|
1742
|
+
memory: {
|
|
1743
|
+
data: never[];
|
|
1744
|
+
dataCount: number;
|
|
1745
|
+
};
|
|
1746
|
+
constructor(direction: Vector3, magnitude: ValueGenerator);
|
|
1747
|
+
initialize(particle: Particle): void;
|
|
1748
|
+
update(particle: Particle, delta: number): void;
|
|
1749
|
+
updateAll(particles: Array<Particle>, count: number, delta: number): void;
|
|
1750
|
+
frameUpdate(delta: number): void;
|
|
1751
|
+
toJSON(): any;
|
|
1752
|
+
static fromJSON(json: any): Behavior;
|
|
1753
|
+
clone(): Behavior;
|
|
1754
|
+
reset(): void;
|
|
1755
|
+
}
|
|
1756
|
+
|
|
1757
|
+
interface Sequencer {
|
|
1758
|
+
transform(position: Vector3, index: number): void;
|
|
1759
|
+
toJSON(): any;
|
|
1760
|
+
clone(): Sequencer;
|
|
1427
1761
|
}
|
|
1762
|
+
declare function SequencerFromJSON(json: any): Sequencer;
|
|
1428
1763
|
|
|
1429
1764
|
/**
|
|
1430
|
-
*
|
|
1765
|
+
* Apply sequences to particles.
|
|
1766
|
+
* {@link Sequencer}
|
|
1431
1767
|
*/
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
* The radius of the donut.
|
|
1435
|
-
*/
|
|
1436
|
-
radius?: number;
|
|
1437
|
-
/**
|
|
1438
|
-
* The arc of the donut.
|
|
1439
|
-
*/
|
|
1440
|
-
arc?: number;
|
|
1441
|
-
/**
|
|
1442
|
-
* The thickness of the ring. 1 is a full donut, 0 is a ring with 0 radius.
|
|
1443
|
-
*/
|
|
1444
|
-
thickness?: number;
|
|
1445
|
-
/**
|
|
1446
|
-
* The radius of the hole in the center of the donut.
|
|
1447
|
-
*/
|
|
1448
|
-
donutRadius?: number;
|
|
1449
|
-
/**
|
|
1450
|
-
* The mode of the emitter.
|
|
1451
|
-
* {@link EmitterMode}
|
|
1452
|
-
*/
|
|
1453
|
-
mode?: EmitterMode;
|
|
1454
|
-
/**
|
|
1455
|
-
* The length of the segment at which the emitter point converges at the start and end, when mode is EmitterMode.Loop or EmitterMode.PingPong.
|
|
1456
|
-
* {@link EmitterMode}
|
|
1457
|
-
*/
|
|
1458
|
-
spread?: number;
|
|
1459
|
-
/**
|
|
1460
|
-
* The speed of the emitter start point when mode is EmitterMode.Loop or EmitterMode.PingPong.
|
|
1461
|
-
* {@link EmitterMode}
|
|
1462
|
-
*/
|
|
1463
|
-
speed?: ValueGenerator | FunctionValueGenerator;
|
|
1464
|
-
}
|
|
1465
|
-
declare class DonutEmitter implements EmitterShape {
|
|
1768
|
+
declare class ApplySequences implements Behavior {
|
|
1769
|
+
static BEZIER: Bezier;
|
|
1466
1770
|
type: string;
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
clone(): EmitterShape;
|
|
1771
|
+
sequencers: Array<[IntervalValue, Sequencer]>;
|
|
1772
|
+
time: number;
|
|
1773
|
+
index: number;
|
|
1774
|
+
pCount: number;
|
|
1775
|
+
delay: number;
|
|
1776
|
+
tempV: Vector3;
|
|
1777
|
+
constructor(delayBetweenParticles: number);
|
|
1778
|
+
initialize(particle: Particle): void;
|
|
1779
|
+
reset(): void;
|
|
1780
|
+
update(particle: Particle, delta: number): void;
|
|
1781
|
+
frameUpdate(delta: number): void;
|
|
1782
|
+
appendSequencer(range: IntervalValue, sequencer: Sequencer): void;
|
|
1783
|
+
toJSON(): any;
|
|
1784
|
+
static fromJSON(json: any): Behavior;
|
|
1785
|
+
clone(): Behavior;
|
|
1483
1786
|
}
|
|
1484
1787
|
|
|
1485
1788
|
/**
|
|
1486
|
-
*
|
|
1789
|
+
* Compiles a run of behaviors into a single loop over the particles.
|
|
1790
|
+
*
|
|
1791
|
+
* Each behavior walking the particle array on its own means the array, and
|
|
1792
|
+
* every particle in it, is re-read once per behavior. Merging the ones this
|
|
1793
|
+
* module recognises into one pass reads each particle once — worth roughly
|
|
1794
|
+
* 1.2x at a hundred thousand particles and up to 1.6x at twenty thousand,
|
|
1795
|
+
* where the per-pass overhead weighs most.
|
|
1796
|
+
*
|
|
1797
|
+
* A behavior that is not recognised keeps its own pass, in its original place
|
|
1798
|
+
* in the order, so nothing here depends on the built-in set being complete.
|
|
1487
1799
|
*/
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
clone(): EmitterShape;
|
|
1800
|
+
/** Runs the compiled work for `particles[0..count)`. */
|
|
1801
|
+
type FusedPass = (behaviors: Array<Behavior>, particles: Array<Particle>, count: number, delta: number) => void;
|
|
1802
|
+
/** One step of a plan: either a compiled run of behaviors, or a single behavior. */
|
|
1803
|
+
interface FusionStep {
|
|
1804
|
+
/** Behaviors this step covers, in order. */
|
|
1805
|
+
behaviors: Array<Behavior>;
|
|
1806
|
+
/** Compiled pass, or undefined when the behavior runs its own update. */
|
|
1807
|
+
run?: FusedPass;
|
|
1497
1808
|
}
|
|
1809
|
+
/**
|
|
1810
|
+
* Splits `behaviors` into steps, merging consecutive recognised ones.
|
|
1811
|
+
*
|
|
1812
|
+
* Only consecutive behaviors are merged: a behavior that stays on its own must
|
|
1813
|
+
* still see the particles exactly where the original order left them.
|
|
1814
|
+
*/
|
|
1815
|
+
declare function planBehaviorFusion(behaviors: Array<Behavior>): Array<FusionStep>;
|
|
1498
1816
|
|
|
1499
1817
|
/**
|
|
1500
|
-
*
|
|
1818
|
+
* Change the emit direction of particles.
|
|
1501
1819
|
*/
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
* The radius of the sphere.
|
|
1505
|
-
*/
|
|
1506
|
-
radius?: number;
|
|
1507
|
-
/**
|
|
1508
|
-
* The arc of the sphere.
|
|
1509
|
-
*/
|
|
1510
|
-
arc?: number;
|
|
1511
|
-
/**
|
|
1512
|
-
* The thickness of the sphere. 1 is a full sphere, 0 is a thin shell.
|
|
1513
|
-
*/
|
|
1514
|
-
thickness?: number;
|
|
1515
|
-
/**
|
|
1516
|
-
* The mode of the emitter.
|
|
1517
|
-
* {@link EmitterMode}
|
|
1518
|
-
*/
|
|
1519
|
-
mode?: EmitterMode;
|
|
1520
|
-
/**
|
|
1521
|
-
* The length of the segment at which the emitter point converges at the start and end, when mode is EmitterMode.Loop or EmitterMode.PingPong.
|
|
1522
|
-
* {@link EmitterMode}
|
|
1523
|
-
*/
|
|
1524
|
-
spread?: number;
|
|
1525
|
-
/**
|
|
1526
|
-
* The speed of the emitter start point when mode is EmitterMode.Loop or EmitterMode.PingPong.
|
|
1527
|
-
* {@link EmitterMode}
|
|
1528
|
-
*/
|
|
1529
|
-
speed?: ValueGenerator | FunctionValueGenerator;
|
|
1530
|
-
}
|
|
1531
|
-
declare class SphereEmitter implements EmitterShape {
|
|
1820
|
+
declare class ChangeEmitDirection implements Behavior {
|
|
1821
|
+
angle: ValueGenerator;
|
|
1532
1822
|
type: string;
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
clone(): EmitterShape;
|
|
1823
|
+
_temp: Vector3;
|
|
1824
|
+
_q: Quaternion;
|
|
1825
|
+
memory: {
|
|
1826
|
+
data: never[];
|
|
1827
|
+
dataCount: number;
|
|
1828
|
+
};
|
|
1829
|
+
constructor(angle: ValueGenerator);
|
|
1830
|
+
initialize(particle: Particle): void;
|
|
1831
|
+
update(particle: Particle, delta: number): void;
|
|
1832
|
+
frameUpdate(delta: number): void;
|
|
1833
|
+
toJSON(): any;
|
|
1834
|
+
static fromJSON(json: any): Behavior;
|
|
1835
|
+
clone(): Behavior;
|
|
1836
|
+
reset(): void;
|
|
1548
1837
|
}
|
|
1549
1838
|
|
|
1550
1839
|
/**
|
|
1551
|
-
*
|
|
1840
|
+
* Color particles by their speed.
|
|
1552
1841
|
*/
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
*/
|
|
1557
|
-
radius?: number;
|
|
1558
|
-
/**
|
|
1559
|
-
* The arc of the hemisphere.
|
|
1560
|
-
*/
|
|
1561
|
-
arc?: number;
|
|
1562
|
-
/**
|
|
1563
|
-
* The thickness of the hemisphere. 1 is a full hemisphere, 0 is a thin shell.
|
|
1564
|
-
*/
|
|
1565
|
-
thickness?: number;
|
|
1566
|
-
/**
|
|
1567
|
-
* The mode of the emitter.
|
|
1568
|
-
* {@link EmitterMode}
|
|
1569
|
-
*/
|
|
1570
|
-
mode?: EmitterMode;
|
|
1571
|
-
/**
|
|
1572
|
-
* The length of the segment at which the emitter point converges at the start and end, when mode is EmitterMode.Loop or EmitterMode.PingPong.
|
|
1573
|
-
* {@link EmitterMode}
|
|
1574
|
-
*/
|
|
1575
|
-
spread?: number;
|
|
1576
|
-
/**
|
|
1577
|
-
* The speed of the emitter start point when mode is EmitterMode.Loop or EmitterMode.PingPong.
|
|
1578
|
-
* {@link EmitterMode}
|
|
1579
|
-
*/
|
|
1580
|
-
speed?: ValueGenerator | FunctionValueGenerator;
|
|
1581
|
-
}
|
|
1582
|
-
declare class HemisphereEmitter implements EmitterShape {
|
|
1842
|
+
declare class ColorBySpeed implements Behavior {
|
|
1843
|
+
color: FunctionColorGenerator;
|
|
1844
|
+
speedRange: IntervalValue;
|
|
1583
1845
|
type: string;
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
constructor(parameters?: HemisphereEmitterParameters);
|
|
1593
|
-
private currentValue;
|
|
1594
|
-
update(system: IParticleSystem, delta: number): void;
|
|
1595
|
-
initialize(p: Particle, emissionState: EmissionState): void;
|
|
1596
|
-
toJSON(): ShapeJSON;
|
|
1597
|
-
static fromJSON(json: any): HemisphereEmitter;
|
|
1598
|
-
clone(): EmitterShape;
|
|
1846
|
+
constructor(color: FunctionColorGenerator, speedRange: IntervalValue);
|
|
1847
|
+
initialize(particle: Particle): void;
|
|
1848
|
+
update(particle: Particle, delta: number): void;
|
|
1849
|
+
frameUpdate(delta: number): void;
|
|
1850
|
+
toJSON(): any;
|
|
1851
|
+
static fromJSON(json: any): Behavior;
|
|
1852
|
+
clone(): Behavior;
|
|
1853
|
+
reset(): void;
|
|
1599
1854
|
}
|
|
1600
1855
|
|
|
1601
1856
|
/**
|
|
1602
|
-
*
|
|
1857
|
+
* Color particles by their life.
|
|
1603
1858
|
*/
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
* The width of the grid.
|
|
1607
|
-
*/
|
|
1608
|
-
width?: number;
|
|
1609
|
-
/**
|
|
1610
|
-
* The height of the grid.
|
|
1611
|
-
*/
|
|
1612
|
-
height?: number;
|
|
1613
|
-
/**
|
|
1614
|
-
* The number of columns in the grid.
|
|
1615
|
-
*/
|
|
1616
|
-
column?: number;
|
|
1617
|
-
/**
|
|
1618
|
-
* The number of rows in the grid.
|
|
1619
|
-
*/
|
|
1620
|
-
row?: number;
|
|
1621
|
-
}
|
|
1622
|
-
declare class GridEmitter implements EmitterShape {
|
|
1859
|
+
declare class ColorOverLife implements Behavior {
|
|
1860
|
+
color: FunctionColorGenerator;
|
|
1623
1861
|
type: string;
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
update(system: IParticleSystem, delta: number): void;
|
|
1862
|
+
constructor(color: FunctionColorGenerator);
|
|
1863
|
+
initialize(particle: Particle): void;
|
|
1864
|
+
update(particle: Particle, delta: number): void;
|
|
1865
|
+
updateAll(particles: Array<Particle>, count: number, delta: number): void;
|
|
1866
|
+
frameUpdate(delta: number): void;
|
|
1867
|
+
toJSON(): any;
|
|
1868
|
+
static fromJSON(json: any): Behavior;
|
|
1869
|
+
clone(): Behavior;
|
|
1870
|
+
reset(): void;
|
|
1634
1871
|
}
|
|
1635
1872
|
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
/**
|
|
1641
|
-
* The width of the rectangle.
|
|
1642
|
-
*/
|
|
1643
|
-
width?: number;
|
|
1644
|
-
/**
|
|
1645
|
-
* The height of the rectangle.
|
|
1646
|
-
*/
|
|
1647
|
-
height?: number;
|
|
1648
|
-
/**
|
|
1649
|
-
* The thickness of the ring.
|
|
1650
|
-
* 1 is a full rectangle, 0 is a ring with 0 radius.
|
|
1651
|
-
*/
|
|
1652
|
-
thickness?: number;
|
|
1653
|
-
/**
|
|
1654
|
-
* The mode of the emitter.
|
|
1655
|
-
* {@link EmitterMode}
|
|
1656
|
-
*/
|
|
1657
|
-
mode?: EmitterMode;
|
|
1658
|
-
/**
|
|
1659
|
-
* The length of segment of which emitter point converges at the start and end, when mode is EmitterMode.Loop or EmitterMode.PingPong.
|
|
1660
|
-
* {@link EmitterMode}
|
|
1661
|
-
*/
|
|
1662
|
-
spread?: number;
|
|
1663
|
-
/**
|
|
1664
|
-
* The speed of the emitter start point travels when mode is EmitterMode.Loop or EmitterMode.PingPong.
|
|
1665
|
-
* {@link EmitterMode}
|
|
1666
|
-
*/
|
|
1667
|
-
speed?: ValueGenerator | FunctionValueGenerator;
|
|
1873
|
+
declare enum SubParticleEmitMode {
|
|
1874
|
+
Death = 0,
|
|
1875
|
+
Birth = 1,
|
|
1876
|
+
Frame = 2
|
|
1668
1877
|
}
|
|
1669
1878
|
/**
|
|
1670
|
-
* a particle
|
|
1879
|
+
* Emit a sub particle system from particles.
|
|
1671
1880
|
*/
|
|
1672
|
-
declare class
|
|
1881
|
+
declare class EmitSubParticleSystem implements Behavior {
|
|
1882
|
+
private particleSystem;
|
|
1883
|
+
useVelocityAsBasis: boolean;
|
|
1884
|
+
subParticleSystem: IEmitter | undefined;
|
|
1885
|
+
mode: SubParticleEmitMode;
|
|
1886
|
+
emitProbability: number;
|
|
1673
1887
|
type: string;
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
private
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
clone(): EmitterShape;
|
|
1888
|
+
private q_;
|
|
1889
|
+
private v_;
|
|
1890
|
+
private v2_;
|
|
1891
|
+
private subEmissions;
|
|
1892
|
+
constructor(particleSystem: IParticleSystem, useVelocityAsBasis: boolean, subParticleSystem: IEmitter | undefined, mode?: SubParticleEmitMode, emitProbability?: number);
|
|
1893
|
+
initialize(particle: Particle): void;
|
|
1894
|
+
update(particle: Particle, delta: number): void;
|
|
1895
|
+
private emit;
|
|
1896
|
+
frameUpdate(delta: number): void;
|
|
1897
|
+
toJSON(): any;
|
|
1898
|
+
static fromJSON(json: any, particleSystem: IParticleSystem): Behavior;
|
|
1899
|
+
clone(): Behavior;
|
|
1900
|
+
reset(): void;
|
|
1901
|
+
private setMatrixFromParticle;
|
|
1689
1902
|
}
|
|
1690
1903
|
|
|
1691
|
-
|
|
1692
|
-
|
|
1904
|
+
/**
|
|
1905
|
+
* Apply a force to particles over their life.
|
|
1906
|
+
*/
|
|
1907
|
+
declare class ForceOverLife implements Behavior {
|
|
1908
|
+
x: FunctionValueGenerator | ValueGenerator;
|
|
1909
|
+
y: FunctionValueGenerator | ValueGenerator;
|
|
1910
|
+
z: FunctionValueGenerator | ValueGenerator;
|
|
1911
|
+
type: string;
|
|
1912
|
+
_temp: Vector3;
|
|
1913
|
+
/** Learned in {@link initialize}, so undefined until this behavior sees a particle. */
|
|
1914
|
+
ps?: IParticleSystem;
|
|
1915
|
+
initialize(particle: Particle, particleSystem: IParticleSystem): void;
|
|
1916
|
+
constructor(x: FunctionValueGenerator | ValueGenerator, y: FunctionValueGenerator | ValueGenerator, z: FunctionValueGenerator | ValueGenerator);
|
|
1917
|
+
update(particle: Particle, delta: number): void;
|
|
1918
|
+
updateAll(particles: Array<Particle>, count: number, delta: number): void;
|
|
1919
|
+
toJSON(): any;
|
|
1920
|
+
static fromJSON(json: any): Behavior;
|
|
1921
|
+
_tempScale: Vector3;
|
|
1922
|
+
_tempQ: Quaternion;
|
|
1923
|
+
frameUpdate(delta: number): void;
|
|
1924
|
+
clone(): Behavior;
|
|
1925
|
+
reset(): void;
|
|
1693
1926
|
}
|
|
1694
|
-
type FieldType = 'vec3' | 'value' | 'number' | 'range' | 'colorFunc' | 'valueFunc' | 'rotationFunc' | 'radian' | 'mesh' | 'particleSystem' | 'boolean' | 'string' | 'geometry' | 'emitterMode' | 'vec3Func';
|
|
1695
|
-
type ParameterType = FieldType | 'self';
|
|
1696
|
-
type ParameterPair = [string, Array<ParameterType>];
|
|
1697
1927
|
|
|
1698
|
-
|
|
1928
|
+
/**
|
|
1929
|
+
* apply tile number of particle texture by particles' life.
|
|
1930
|
+
*/
|
|
1931
|
+
declare class FrameOverLife implements Behavior {
|
|
1699
1932
|
type: string;
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1933
|
+
private _frame;
|
|
1934
|
+
constructor(frame: FunctionValueGenerator | ValueGenerator);
|
|
1935
|
+
get frame(): FunctionValueGenerator | ValueGenerator;
|
|
1936
|
+
set frame(frame: FunctionValueGenerator | ValueGenerator);
|
|
1937
|
+
initialize(particle: Particle): void;
|
|
1938
|
+
update(particle: Particle, delta: number): void;
|
|
1939
|
+
updateAll(particles: Array<Particle>, count: number, delta: number): void;
|
|
1940
|
+
private sampleFrame;
|
|
1941
|
+
frameUpdate(delta: number): void;
|
|
1942
|
+
toJSON(): any;
|
|
1943
|
+
static fromJSON(json: any): Behavior;
|
|
1944
|
+
clone(): Behavior;
|
|
1945
|
+
reset(): void;
|
|
1703
1946
|
}
|
|
1704
|
-
declare const EmitterShapes: {
|
|
1705
|
-
[key: string]: EmitterShapePlugin;
|
|
1706
|
-
};
|
|
1707
|
-
declare function EmitterFromJSON(json: ShapeJSON, meta: JsonMetaData): EmitterShape;
|
|
1708
1947
|
|
|
1709
1948
|
/**
|
|
1710
|
-
*
|
|
1711
|
-
*
|
|
1949
|
+
* Apply a gravity force to particles.
|
|
1950
|
+
* the gravity force is calculated as:
|
|
1951
|
+
* F = G * m1 * m2 / r^2
|
|
1712
1952
|
*/
|
|
1713
|
-
|
|
1953
|
+
declare class GravityForce implements Behavior {
|
|
1954
|
+
center: Vector3;
|
|
1955
|
+
magnitude: number;
|
|
1714
1956
|
type: string;
|
|
1715
|
-
|
|
1957
|
+
temp: Vector3;
|
|
1958
|
+
constructor(center: Vector3, magnitude: number);
|
|
1959
|
+
initialize(particle: Particle): void;
|
|
1716
1960
|
update(particle: Particle, delta: number): void;
|
|
1961
|
+
updateAll(particles: Array<Particle>, count: number, delta: number): void;
|
|
1717
1962
|
frameUpdate(delta: number): void;
|
|
1718
1963
|
toJSON(): any;
|
|
1964
|
+
static fromJSON(json: any): Behavior;
|
|
1719
1965
|
clone(): Behavior;
|
|
1720
1966
|
reset(): void;
|
|
1721
1967
|
}
|
|
1722
|
-
|
|
1968
|
+
|
|
1969
|
+
type InheritVelocityMode = 'initial' | 'current';
|
|
1970
|
+
/**
|
|
1971
|
+
* Make particles inherit the emitter's movement velocity (Unity's "Inherit Velocity").
|
|
1972
|
+
* 'initial' adds the emitter velocity to the particle velocity once at spawn;
|
|
1973
|
+
* 'current' displaces particles by the current emitter velocity every frame.
|
|
1974
|
+
*/
|
|
1975
|
+
declare class InheritVelocity implements Behavior {
|
|
1976
|
+
multiplier: FunctionValueGenerator | ValueGenerator;
|
|
1977
|
+
mode: InheritVelocityMode;
|
|
1723
1978
|
type: string;
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1979
|
+
/** Learned in {@link initialize}, so undefined until this behavior sees a particle. */
|
|
1980
|
+
ps?: IParticleSystem;
|
|
1981
|
+
constructor(multiplier?: FunctionValueGenerator | ValueGenerator, mode?: InheritVelocityMode);
|
|
1982
|
+
_temp: Vector3;
|
|
1983
|
+
_tempPos: Vector3;
|
|
1984
|
+
_tempQInv: Quaternion;
|
|
1985
|
+
_tempScaleInv: Vector3;
|
|
1986
|
+
initialize(particle: Particle, particleSystem: IParticleSystem): void;
|
|
1987
|
+
frameUpdate(delta: number): void;
|
|
1988
|
+
update(particle: Particle, delta: number): void;
|
|
1989
|
+
private decomposeInverse;
|
|
1990
|
+
toJSON(): any;
|
|
1991
|
+
static fromJSON(json: any): Behavior;
|
|
1992
|
+
clone(): Behavior;
|
|
1993
|
+
reset(): void;
|
|
1727
1994
|
}
|
|
1728
|
-
declare const BehaviorTypes: {
|
|
1729
|
-
[key: string]: BehaviorPlugin;
|
|
1730
|
-
};
|
|
1731
|
-
declare function BehaviorFromJSON(json: any, particleSystem: IParticleSystem): Behavior | null;
|
|
1732
1995
|
|
|
1733
1996
|
/**
|
|
1734
|
-
*
|
|
1997
|
+
* Limit the speed of particles over their life.
|
|
1735
1998
|
*/
|
|
1736
|
-
declare class
|
|
1737
|
-
|
|
1999
|
+
declare class LimitSpeedOverLife implements Behavior {
|
|
2000
|
+
speed: FunctionValueGenerator;
|
|
2001
|
+
dampen: number;
|
|
1738
2002
|
type: string;
|
|
1739
|
-
constructor(color: FunctionColorGenerator);
|
|
1740
2003
|
initialize(particle: Particle): void;
|
|
2004
|
+
constructor(speed: FunctionValueGenerator, dampen: number);
|
|
1741
2005
|
update(particle: Particle, delta: number): void;
|
|
2006
|
+
updateAll(particles: Array<Particle>, count: number, delta: number): void;
|
|
2007
|
+
toJSON(): any;
|
|
2008
|
+
static fromJSON(json: any): Behavior;
|
|
1742
2009
|
frameUpdate(delta: number): void;
|
|
2010
|
+
clone(): Behavior;
|
|
2011
|
+
reset(): void;
|
|
2012
|
+
}
|
|
2013
|
+
|
|
2014
|
+
/**
|
|
2015
|
+
* Apply noise to particles.
|
|
2016
|
+
*/
|
|
2017
|
+
declare class Noise implements Behavior {
|
|
2018
|
+
frequency: FunctionValueGenerator | ValueGenerator;
|
|
2019
|
+
power: FunctionValueGenerator | ValueGenerator;
|
|
2020
|
+
positionAmount: FunctionValueGenerator | ValueGenerator;
|
|
2021
|
+
rotationAmount: FunctionValueGenerator | ValueGenerator;
|
|
2022
|
+
type: string;
|
|
2023
|
+
duration: number;
|
|
2024
|
+
constructor(frequency: FunctionValueGenerator | ValueGenerator, power: FunctionValueGenerator | ValueGenerator, positionAmount?: FunctionValueGenerator | ValueGenerator, rotationAmount?: FunctionValueGenerator | ValueGenerator);
|
|
2025
|
+
initialize(particle: Particle): void;
|
|
2026
|
+
update(particle: Particle, _: number): void;
|
|
2027
|
+
updateAll(particles: Array<Particle>, count: number, delta: number): void;
|
|
1743
2028
|
toJSON(): any;
|
|
2029
|
+
frameUpdate(delta: number): void;
|
|
1744
2030
|
static fromJSON(json: any): Behavior;
|
|
1745
2031
|
clone(): Behavior;
|
|
1746
2032
|
reset(): void;
|
|
1747
2033
|
}
|
|
1748
2034
|
|
|
1749
2035
|
/**
|
|
1750
|
-
*
|
|
2036
|
+
* Orbit particles around an axis over their life.
|
|
1751
2037
|
*/
|
|
1752
|
-
declare class
|
|
1753
|
-
|
|
2038
|
+
declare class OrbitOverLife implements Behavior {
|
|
2039
|
+
orbitSpeed: FunctionValueGenerator | ValueGenerator;
|
|
2040
|
+
axis: Vector3;
|
|
1754
2041
|
type: string;
|
|
1755
|
-
|
|
2042
|
+
rotation: Quaternion;
|
|
2043
|
+
temp: Vector3;
|
|
2044
|
+
constructor(orbitSpeed: FunctionValueGenerator | ValueGenerator, axis?: Vector3);
|
|
1756
2045
|
initialize(particle: Particle): void;
|
|
1757
2046
|
update(particle: Particle, delta: number): void;
|
|
2047
|
+
updateAll(particles: Array<Particle>, count: number, delta: number): void;
|
|
2048
|
+
frameUpdate(delta: number): void;
|
|
1758
2049
|
toJSON(): any;
|
|
1759
2050
|
static fromJSON(json: any): Behavior;
|
|
1760
|
-
frameUpdate(delta: number): void;
|
|
1761
2051
|
clone(): Behavior;
|
|
1762
2052
|
reset(): void;
|
|
1763
2053
|
}
|
|
@@ -1768,8 +2058,8 @@ declare class RotationOverLife implements Behavior {
|
|
|
1768
2058
|
declare class Rotation3DOverLife implements Behavior {
|
|
1769
2059
|
angularVelocity: RotationGenerator;
|
|
1770
2060
|
type: string;
|
|
1771
|
-
|
|
1772
|
-
|
|
2061
|
+
/** Scratch for the frame's rotation step; also read by the fused pass. */
|
|
2062
|
+
tempQuat: Quaternion;
|
|
1773
2063
|
constructor(angularVelocity: RotationGenerator);
|
|
1774
2064
|
initialize(particle: Particle): void;
|
|
1775
2065
|
update(particle: Particle, delta: number): void;
|
|
@@ -1781,84 +2071,53 @@ declare class Rotation3DOverLife implements Behavior {
|
|
|
1781
2071
|
}
|
|
1782
2072
|
|
|
1783
2073
|
/**
|
|
1784
|
-
* Apply
|
|
2074
|
+
* Apply rotation to particles based on their speed.
|
|
1785
2075
|
*/
|
|
1786
|
-
declare class
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
z: FunctionValueGenerator | ValueGenerator;
|
|
2076
|
+
declare class RotationBySpeed implements Behavior {
|
|
2077
|
+
angularVelocity: ValueGenerator | FunctionValueGenerator;
|
|
2078
|
+
speedRange: IntervalValue;
|
|
1790
2079
|
type: string;
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
initialize(particle: Particle
|
|
1794
|
-
constructor(x: FunctionValueGenerator | ValueGenerator, y: FunctionValueGenerator | ValueGenerator, z: FunctionValueGenerator | ValueGenerator);
|
|
2080
|
+
private tempQuat;
|
|
2081
|
+
constructor(angularVelocity: ValueGenerator | FunctionValueGenerator, speedRange: IntervalValue);
|
|
2082
|
+
initialize(particle: Particle): void;
|
|
1795
2083
|
update(particle: Particle, delta: number): void;
|
|
1796
2084
|
toJSON(): any;
|
|
1797
2085
|
static fromJSON(json: any): Behavior;
|
|
1798
|
-
_tempScale: Vector3;
|
|
1799
|
-
_tempQ: Quaternion;
|
|
1800
2086
|
frameUpdate(delta: number): void;
|
|
1801
2087
|
clone(): Behavior;
|
|
1802
2088
|
reset(): void;
|
|
1803
2089
|
}
|
|
1804
2090
|
|
|
1805
|
-
type VelocityOverLifeSpace = 'local' | 'world';
|
|
1806
2091
|
/**
|
|
1807
|
-
*
|
|
1808
|
-
* Applied as a positional displacement, so it is not affected by speed modifiers,
|
|
1809
|
-
* forces, or speed limits. Orbital speeds rotate particles around the emitter axes.
|
|
2092
|
+
* Apply rotation to particles over their life.
|
|
1810
2093
|
*/
|
|
1811
|
-
declare class
|
|
1812
|
-
|
|
1813
|
-
linearY: FunctionValueGenerator | ValueGenerator;
|
|
1814
|
-
linearZ: FunctionValueGenerator | ValueGenerator;
|
|
1815
|
-
orbitalX: FunctionValueGenerator | ValueGenerator;
|
|
1816
|
-
orbitalY: FunctionValueGenerator | ValueGenerator;
|
|
1817
|
-
orbitalZ: FunctionValueGenerator | ValueGenerator;
|
|
1818
|
-
space: VelocityOverLifeSpace;
|
|
2094
|
+
declare class RotationOverLife implements Behavior {
|
|
2095
|
+
angularVelocity: ValueGenerator | FunctionValueGenerator;
|
|
1819
2096
|
type: string;
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
_temp: Vector3;
|
|
1823
|
-
_tempEmitterPos: Vector3;
|
|
1824
|
-
_tempQ: Quaternion;
|
|
1825
|
-
_tempQInv: Quaternion;
|
|
1826
|
-
_tempScale: Vector3;
|
|
1827
|
-
_tempScaleInv: Vector3;
|
|
1828
|
-
_tempRot: Quaternion;
|
|
1829
|
-
_tempAxis: Vector3;
|
|
1830
|
-
initialize(particle: Particle, particleSystem: IParticleSystem): void;
|
|
1831
|
-
frameUpdate(delta: number): void;
|
|
2097
|
+
constructor(angularVelocity: ValueGenerator | FunctionValueGenerator);
|
|
2098
|
+
initialize(particle: Particle): void;
|
|
1832
2099
|
update(particle: Particle, delta: number): void;
|
|
1833
|
-
|
|
2100
|
+
updateAll(particles: Array<Particle>, count: number, delta: number): void;
|
|
1834
2101
|
toJSON(): any;
|
|
1835
2102
|
static fromJSON(json: any): Behavior;
|
|
2103
|
+
frameUpdate(delta: number): void;
|
|
1836
2104
|
clone(): Behavior;
|
|
1837
2105
|
reset(): void;
|
|
1838
2106
|
}
|
|
1839
2107
|
|
|
1840
|
-
type InheritVelocityMode = 'initial' | 'current';
|
|
1841
2108
|
/**
|
|
1842
|
-
*
|
|
1843
|
-
* 'initial' adds the emitter velocity to the particle velocity once at spawn;
|
|
1844
|
-
* 'current' displaces particles by the current emitter velocity every frame.
|
|
2109
|
+
* Apply size to particles based on their speed.
|
|
1845
2110
|
*/
|
|
1846
|
-
declare class
|
|
1847
|
-
|
|
1848
|
-
|
|
2111
|
+
declare class SizeBySpeed implements Behavior {
|
|
2112
|
+
size: FunctionValueGenerator | Vector3Generator;
|
|
2113
|
+
speedRange: IntervalValue;
|
|
1849
2114
|
type: string;
|
|
1850
|
-
|
|
1851
|
-
constructor(
|
|
1852
|
-
|
|
1853
|
-
_tempPos: Vector3;
|
|
1854
|
-
_tempQInv: Quaternion;
|
|
1855
|
-
_tempScaleInv: Vector3;
|
|
1856
|
-
initialize(particle: Particle, particleSystem: IParticleSystem): void;
|
|
1857
|
-
frameUpdate(delta: number): void;
|
|
1858
|
-
update(particle: Particle, delta: number): void;
|
|
1859
|
-
private decomposeInverse;
|
|
2115
|
+
initialize(particle: Particle): void;
|
|
2116
|
+
constructor(size: FunctionValueGenerator | Vector3Generator, speedRange: IntervalValue);
|
|
2117
|
+
update(particle: Particle): void;
|
|
1860
2118
|
toJSON(): any;
|
|
1861
2119
|
static fromJSON(json: any): Behavior;
|
|
2120
|
+
frameUpdate(delta: number): void;
|
|
1862
2121
|
clone(): Behavior;
|
|
1863
2122
|
reset(): void;
|
|
1864
2123
|
}
|
|
@@ -1867,11 +2126,15 @@ declare class InheritVelocity implements Behavior {
|
|
|
1867
2126
|
* Apply size to particles based on their life.
|
|
1868
2127
|
*/
|
|
1869
2128
|
declare class SizeOverLife implements Behavior {
|
|
1870
|
-
size: FunctionValueGenerator | Vector3Generator;
|
|
1871
2129
|
type: string;
|
|
1872
|
-
|
|
2130
|
+
private _size;
|
|
2131
|
+
private _sizeIsVector3;
|
|
1873
2132
|
constructor(size: FunctionValueGenerator | Vector3Generator);
|
|
2133
|
+
get size(): FunctionValueGenerator | Vector3Generator;
|
|
2134
|
+
set size(size: FunctionValueGenerator | Vector3Generator);
|
|
2135
|
+
initialize(particle: Particle): void;
|
|
1874
2136
|
update(particle: Particle): void;
|
|
2137
|
+
updateAll(particles: Array<Particle>, count: number, delta: number): void;
|
|
1875
2138
|
toJSON(): any;
|
|
1876
2139
|
static fromJSON(json: any): Behavior;
|
|
1877
2140
|
frameUpdate(delta: number): void;
|
|
@@ -1888,6 +2151,7 @@ declare class SpeedOverLife implements Behavior {
|
|
|
1888
2151
|
initialize(particle: Particle): void;
|
|
1889
2152
|
constructor(speed: FunctionValueGenerator);
|
|
1890
2153
|
update(particle: Particle): void;
|
|
2154
|
+
updateAll(particles: Array<Particle>, count: number, delta: number): void;
|
|
1891
2155
|
toJSON(): any;
|
|
1892
2156
|
static fromJSON(json: any): Behavior;
|
|
1893
2157
|
frameUpdate(delta: number): void;
|
|
@@ -1896,34 +2160,107 @@ declare class SpeedOverLife implements Behavior {
|
|
|
1896
2160
|
}
|
|
1897
2161
|
|
|
1898
2162
|
/**
|
|
1899
|
-
*
|
|
2163
|
+
* A random() function, must return a numer in the interval [0,1), just like Math.random().
|
|
1900
2164
|
*/
|
|
1901
|
-
|
|
1902
|
-
|
|
2165
|
+
type RandomFn = () => number;
|
|
2166
|
+
/** Deterministic simplex noise generator suitable for 2D, 3D and 4D spaces. */
|
|
2167
|
+
declare class SimplexNoise {
|
|
2168
|
+
private p;
|
|
2169
|
+
private perm;
|
|
2170
|
+
private permMod12;
|
|
2171
|
+
/**
|
|
2172
|
+
* Creates a new `SimplexNoise` instance.
|
|
2173
|
+
* This involves some setup. You can save a few cpu cycles by reusing the same instance.
|
|
2174
|
+
* @param randomOrSeed A random number generator or a seed (string|number).
|
|
2175
|
+
* Defaults to Math.random (random irreproducible initialization).
|
|
2176
|
+
*/
|
|
2177
|
+
constructor(randomOrSeed?: RandomFn | string | number);
|
|
2178
|
+
/**
|
|
2179
|
+
* Samples the noise field in 2 dimensions
|
|
2180
|
+
* @param x
|
|
2181
|
+
* @param y
|
|
2182
|
+
* @returns a number in the interval [-1, 1]
|
|
2183
|
+
*/
|
|
2184
|
+
noise2D(x: number, y: number): number;
|
|
2185
|
+
/**
|
|
2186
|
+
* Samples the noise field in 3 dimensions
|
|
2187
|
+
* @param x
|
|
2188
|
+
* @param y
|
|
2189
|
+
* @param z
|
|
2190
|
+
* @returns a number in the interval [-1, 1]
|
|
2191
|
+
*/
|
|
2192
|
+
noise3D(x: number, y: number, z: number): number;
|
|
2193
|
+
/**
|
|
2194
|
+
* Samples the noise field in 4 dimensions
|
|
2195
|
+
* @param x
|
|
2196
|
+
* @param y
|
|
2197
|
+
* @param z
|
|
2198
|
+
* @returns a number in the interval [-1, 1]
|
|
2199
|
+
*/
|
|
2200
|
+
noise4D(x: number, y: number, z: number, w: number): number;
|
|
2201
|
+
}
|
|
2202
|
+
|
|
2203
|
+
/**
|
|
2204
|
+
* Apply turbulence to particles.
|
|
2205
|
+
*/
|
|
2206
|
+
declare class TurbulenceField implements Behavior {
|
|
2207
|
+
scale: Vector3;
|
|
2208
|
+
octaves: number;
|
|
2209
|
+
velocityMultiplier: Vector3;
|
|
2210
|
+
timeScale: Vector3;
|
|
1903
2211
|
type: string;
|
|
1904
|
-
|
|
2212
|
+
generator: SimplexNoise;
|
|
2213
|
+
timeOffset: Vector3;
|
|
2214
|
+
temp: Vector3;
|
|
2215
|
+
temp2: Vector3;
|
|
2216
|
+
constructor(scale: Vector3, octaves: number, velocityMultiplier: Vector3, timeScale: Vector3);
|
|
1905
2217
|
initialize(particle: Particle): void;
|
|
1906
2218
|
update(particle: Particle, delta: number): void;
|
|
1907
|
-
frameUpdate(delta: number): void;
|
|
1908
2219
|
toJSON(): any;
|
|
2220
|
+
frameUpdate(delta: number): void;
|
|
1909
2221
|
static fromJSON(json: any): Behavior;
|
|
1910
2222
|
clone(): Behavior;
|
|
1911
2223
|
reset(): void;
|
|
1912
2224
|
}
|
|
1913
2225
|
|
|
2226
|
+
type VelocityOverLifeSpace = 'local' | 'world';
|
|
1914
2227
|
/**
|
|
1915
|
-
*
|
|
2228
|
+
* Move particles with a direct velocity over their life (Unity's "Velocity over Lifetime").
|
|
2229
|
+
* Applied as a positional displacement, so it is not affected by speed modifiers,
|
|
2230
|
+
* forces, or speed limits. Orbital speeds rotate particles around the emitter axes.
|
|
1916
2231
|
*/
|
|
1917
|
-
declare class
|
|
1918
|
-
|
|
1919
|
-
|
|
2232
|
+
declare class VelocityOverLife implements Behavior {
|
|
2233
|
+
linearX: FunctionValueGenerator | ValueGenerator;
|
|
2234
|
+
linearY: FunctionValueGenerator | ValueGenerator;
|
|
2235
|
+
linearZ: FunctionValueGenerator | ValueGenerator;
|
|
2236
|
+
orbitalX: FunctionValueGenerator | ValueGenerator;
|
|
2237
|
+
orbitalY: FunctionValueGenerator | ValueGenerator;
|
|
2238
|
+
orbitalZ: FunctionValueGenerator | ValueGenerator;
|
|
2239
|
+
space: VelocityOverLifeSpace;
|
|
1920
2240
|
type: string;
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
constructor(
|
|
1924
|
-
|
|
1925
|
-
|
|
2241
|
+
/** Learned in {@link initialize}, so undefined until this behavior sees a particle. */
|
|
2242
|
+
ps?: IParticleSystem;
|
|
2243
|
+
constructor(linearX?: FunctionValueGenerator | ValueGenerator, linearY?: FunctionValueGenerator | ValueGenerator, linearZ?: FunctionValueGenerator | ValueGenerator, orbitalX?: FunctionValueGenerator | ValueGenerator, orbitalY?: FunctionValueGenerator | ValueGenerator, orbitalZ?: FunctionValueGenerator | ValueGenerator, space?: VelocityOverLifeSpace);
|
|
2244
|
+
_temp: Vector3;
|
|
2245
|
+
_tempEmitterPos: Vector3;
|
|
2246
|
+
_tempQ: Quaternion;
|
|
2247
|
+
_tempQInv: Quaternion;
|
|
2248
|
+
_tempScale: Vector3;
|
|
2249
|
+
_tempScaleInv: Vector3;
|
|
2250
|
+
_tempRot: Quaternion;
|
|
2251
|
+
/**
|
|
2252
|
+
* Axes the orbital speeds turn around, refreshed once per frame by
|
|
2253
|
+
* {@link frameUpdate}. In world space they are the emitter's axes, which
|
|
2254
|
+
* only change when the emitter does — so they are hoisted out of the
|
|
2255
|
+
* per-particle work rather than rebuilt for every particle.
|
|
2256
|
+
*/
|
|
2257
|
+
_axisX: Vector3;
|
|
2258
|
+
_axisY: Vector3;
|
|
2259
|
+
_axisZ: Vector3;
|
|
2260
|
+
initialize(particle: Particle, particleSystem: IParticleSystem): void;
|
|
1926
2261
|
frameUpdate(delta: number): void;
|
|
2262
|
+
update(particle: Particle, delta: number): void;
|
|
2263
|
+
private orbit;
|
|
1927
2264
|
toJSON(): any;
|
|
1928
2265
|
static fromJSON(json: any): Behavior;
|
|
1929
2266
|
clone(): Behavior;
|
|
@@ -1946,319 +2283,644 @@ declare class WidthOverLength implements Behavior {
|
|
|
1946
2283
|
reset(): void;
|
|
1947
2284
|
}
|
|
1948
2285
|
|
|
2286
|
+
interface IAnimationData {
|
|
2287
|
+
/** Start time in seconds */
|
|
2288
|
+
startTime: number;
|
|
2289
|
+
/** Duration in seconds */
|
|
2290
|
+
duration: number;
|
|
2291
|
+
/** Target object */
|
|
2292
|
+
target: any;
|
|
2293
|
+
}
|
|
2294
|
+
interface IPrefab {
|
|
2295
|
+
/**
|
|
2296
|
+
* The name of the prefab.
|
|
2297
|
+
*/
|
|
2298
|
+
name: string;
|
|
2299
|
+
/**
|
|
2300
|
+
* The children of the prefab.
|
|
2301
|
+
*/
|
|
2302
|
+
animationData: IAnimationData[];
|
|
2303
|
+
}
|
|
2304
|
+
|
|
2305
|
+
interface ShapeTransformJSON {
|
|
2306
|
+
/** Offset of the shape, `[x, y, z]`. Omitted when zero. */
|
|
2307
|
+
position?: number[];
|
|
2308
|
+
/** Rotation of the shape as a quaternion, `[x, y, z, w]`. Omitted when identity. */
|
|
2309
|
+
rotation?: number[];
|
|
2310
|
+
/** Scale of the shape, `[x, y, z]`. Omitted when `[1, 1, 1]`. */
|
|
2311
|
+
scale?: number[];
|
|
2312
|
+
}
|
|
1949
2313
|
/**
|
|
1950
|
-
*
|
|
2314
|
+
* Local transform of an emitter shape inside its particle system, like the
|
|
2315
|
+
* Position / Rotation / Scale of Unity's Shape module.
|
|
2316
|
+
*
|
|
2317
|
+
* A spawn point `p` lands at `position + rotation * (scale * p)`. The start
|
|
2318
|
+
* direction goes through the same scale and rotation and is then brought back
|
|
2319
|
+
* to its old length, so a squashed shape bends directions without changing the
|
|
2320
|
+
* start speed — which is what Unity does.
|
|
1951
2321
|
*/
|
|
1952
|
-
declare class
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
2322
|
+
declare class ShapeTransform {
|
|
2323
|
+
position: Vector3;
|
|
2324
|
+
rotation: Quaternion;
|
|
2325
|
+
scale: Vector3;
|
|
2326
|
+
constructor(position?: Vector3, rotation?: Quaternion, scale?: Vector3);
|
|
2327
|
+
/** Moves a freshly initialized particle from shape space into system space. */
|
|
2328
|
+
apply(p: Particle): void;
|
|
2329
|
+
isIdentity(): boolean;
|
|
2330
|
+
toJSON(): ShapeTransformJSON;
|
|
2331
|
+
/** Returns undefined when there is no transform in the JSON. */
|
|
2332
|
+
static fromJSON(json: ShapeTransformJSON | undefined): ShapeTransform | undefined;
|
|
2333
|
+
/**
|
|
2334
|
+
* The `transform` entry of a shape's JSON: empty when the shape has no
|
|
2335
|
+
* transform or an identity one, so shapes without one serialize as before.
|
|
2336
|
+
*/
|
|
2337
|
+
static toShapeJSON(transform: ShapeTransform | undefined): {
|
|
2338
|
+
transform?: ShapeTransformJSON;
|
|
1960
2339
|
};
|
|
1961
|
-
|
|
1962
|
-
initialize(particle: Particle): void;
|
|
1963
|
-
update(particle: Particle, delta: number): void;
|
|
1964
|
-
frameUpdate(delta: number): void;
|
|
1965
|
-
toJSON(): any;
|
|
1966
|
-
static fromJSON(json: any): Behavior;
|
|
1967
|
-
clone(): Behavior;
|
|
1968
|
-
reset(): void;
|
|
2340
|
+
clone(): ShapeTransform;
|
|
1969
2341
|
}
|
|
1970
2342
|
|
|
2343
|
+
interface ShapeJSON {
|
|
2344
|
+
type: string;
|
|
2345
|
+
radius?: number;
|
|
2346
|
+
arc?: number;
|
|
2347
|
+
thickness?: number;
|
|
2348
|
+
donutRadius?: number;
|
|
2349
|
+
angle?: number;
|
|
2350
|
+
width?: number;
|
|
2351
|
+
height?: number;
|
|
2352
|
+
depth?: number;
|
|
2353
|
+
emitFrom?: number;
|
|
2354
|
+
boxThickness?: number[];
|
|
2355
|
+
column?: number;
|
|
2356
|
+
row?: number;
|
|
2357
|
+
mesh?: string;
|
|
2358
|
+
mode?: number;
|
|
2359
|
+
particleSystem?: string;
|
|
2360
|
+
spread?: number;
|
|
2361
|
+
speed?: any;
|
|
2362
|
+
/** Local offset / rotation / scale of the shape; omitted when there is none. */
|
|
2363
|
+
transform?: ShapeTransformJSON;
|
|
2364
|
+
}
|
|
1971
2365
|
/**
|
|
1972
|
-
*
|
|
1973
|
-
* the gravity force is calculated as:
|
|
1974
|
-
* F = G * m1 * m2 / r^2
|
|
2366
|
+
* Enum representing the emitter modes for particles.
|
|
1975
2367
|
*/
|
|
1976
|
-
declare
|
|
1977
|
-
|
|
1978
|
-
|
|
2368
|
+
declare enum EmitterMode {
|
|
2369
|
+
/**
|
|
2370
|
+
* Emit particles randomly over the specified duration.
|
|
2371
|
+
*/
|
|
2372
|
+
Random = 0,
|
|
2373
|
+
/**
|
|
2374
|
+
* Emit particles in a continuous loop.
|
|
2375
|
+
*/
|
|
2376
|
+
Loop = 1,
|
|
2377
|
+
/**
|
|
2378
|
+
* Emit particles back and forth in a ping-pong manner.
|
|
2379
|
+
*/
|
|
2380
|
+
PingPong = 2,
|
|
2381
|
+
/**
|
|
2382
|
+
* Emit particles in bursts.
|
|
2383
|
+
*/
|
|
2384
|
+
Burst = 3
|
|
2385
|
+
}
|
|
2386
|
+
declare function getValueFromEmitterMode(mode: EmitterMode, currentValue: number, spread: number, emissionState: EmissionState): number;
|
|
2387
|
+
interface EmitterShape {
|
|
1979
2388
|
type: string;
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
2389
|
+
initialize(particle: Particle, emissionState: EmissionState): void;
|
|
2390
|
+
toJSON(): ShapeJSON;
|
|
2391
|
+
update(system: IParticleSystem, delta: number): void;
|
|
2392
|
+
clone(): EmitterShape;
|
|
2393
|
+
/**
|
|
2394
|
+
* Optional local transform of the shape inside its particle system, applied
|
|
2395
|
+
* by the shape itself at the end of {@link initialize}.
|
|
2396
|
+
*/
|
|
2397
|
+
transform?: ShapeTransform;
|
|
1989
2398
|
}
|
|
1990
2399
|
|
|
1991
2400
|
/**
|
|
1992
|
-
*
|
|
2401
|
+
* Which part of the box particles start from.
|
|
1993
2402
|
*/
|
|
1994
|
-
declare
|
|
1995
|
-
|
|
2403
|
+
declare enum BoxEmitFrom {
|
|
2404
|
+
/** Anywhere inside the box. */
|
|
2405
|
+
Volume = 0,
|
|
2406
|
+
/** On the six faces. */
|
|
2407
|
+
Shell = 1,
|
|
2408
|
+
/** On the twelve edges. */
|
|
2409
|
+
Edge = 2
|
|
2410
|
+
}
|
|
2411
|
+
/**
|
|
2412
|
+
* Interface representing the parameters for a box emitter.
|
|
2413
|
+
*/
|
|
2414
|
+
interface BoxEmitterParameters {
|
|
2415
|
+
/** Size of the box along X. */
|
|
2416
|
+
width?: number;
|
|
2417
|
+
/** Size of the box along Y. */
|
|
2418
|
+
height?: number;
|
|
2419
|
+
/** Size of the box along Z. */
|
|
2420
|
+
depth?: number;
|
|
2421
|
+
/** Which part of the box particles start from. {@link BoxEmitFrom} */
|
|
2422
|
+
emitFrom?: BoxEmitFrom;
|
|
2423
|
+
/**
|
|
2424
|
+
* How far Shell and Edge particles may sink into the box on each axis, as a fraction of the
|
|
2425
|
+
* box size: 0 keeps them on the surface, 0.5 reaches the center.
|
|
2426
|
+
*/
|
|
2427
|
+
boxThickness?: [number, number, number];
|
|
2428
|
+
}
|
|
2429
|
+
/**
|
|
2430
|
+
* A particle emitter that emits particles from a box centered on the emitter, all moving along +Z
|
|
2431
|
+
* like Unity's Box shape. A box with no depth is a flat rectangle (Unity's Rectangle shape).
|
|
2432
|
+
*/
|
|
2433
|
+
declare class BoxEmitter implements EmitterShape {
|
|
1996
2434
|
type: string;
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
constructor(
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2435
|
+
width: number;
|
|
2436
|
+
height: number;
|
|
2437
|
+
depth: number;
|
|
2438
|
+
emitFrom: BoxEmitFrom;
|
|
2439
|
+
boxThickness: [number, number, number];
|
|
2440
|
+
private readonly _point;
|
|
2441
|
+
constructor(parameters?: BoxEmitterParameters);
|
|
2442
|
+
update(_system: IParticleSystem, _delta: number): void;
|
|
2443
|
+
initialize(p: Particle, _emissionState: EmissionState): void;
|
|
2444
|
+
/**
|
|
2445
|
+
* A coordinate on one of the two faces across `axis`, in -1..1. As measured in Unity, a
|
|
2446
|
+
* thickness leaves half the particles on the face and sinks the rest evenly up to
|
|
2447
|
+
* 2 × thickness of the half-size into the box.
|
|
2448
|
+
*/
|
|
2449
|
+
private onSurface;
|
|
2450
|
+
toJSON(): ShapeJSON;
|
|
2451
|
+
static fromJSON(json: any): BoxEmitter;
|
|
2452
|
+
clone(): EmitterShape;
|
|
2011
2453
|
}
|
|
2012
2454
|
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2455
|
+
/**
|
|
2456
|
+
* Interface representing the parameters for a circle emitter.
|
|
2457
|
+
*/
|
|
2458
|
+
interface CircleEmitterParameters {
|
|
2459
|
+
/**
|
|
2460
|
+
* The radius of the circle.
|
|
2461
|
+
*/
|
|
2462
|
+
radius?: number;
|
|
2463
|
+
/**
|
|
2464
|
+
* The arc of the circle.
|
|
2465
|
+
*/
|
|
2466
|
+
arc?: number;
|
|
2467
|
+
/**
|
|
2468
|
+
* The thickness of the ring.
|
|
2469
|
+
* 1 is a full circle, 0 is a ring with 0 radius.
|
|
2470
|
+
*/
|
|
2471
|
+
thickness?: number;
|
|
2472
|
+
/**
|
|
2473
|
+
* The mode of the emitter.
|
|
2474
|
+
* {@link EmitterMode}
|
|
2475
|
+
*/
|
|
2476
|
+
mode?: EmitterMode;
|
|
2477
|
+
/**
|
|
2478
|
+
* The length of segment of which emitter point converges at the start and end, when mode is EmitterMode.Loop or EmitterMode.PingPong.
|
|
2479
|
+
* {@link EmitterMode}
|
|
2480
|
+
*/
|
|
2481
|
+
spread?: number;
|
|
2482
|
+
/**
|
|
2483
|
+
* The speed of the emitter start point travels when mode is EmitterMode.Loop or EmitterMode.PingPong.
|
|
2484
|
+
* {@link EmitterMode}
|
|
2485
|
+
*/
|
|
2486
|
+
speed?: ValueGenerator | FunctionValueGenerator;
|
|
2487
|
+
/**
|
|
2488
|
+
* Offset, rotation and scale of the shape within the particle system.
|
|
2489
|
+
* {@link ShapeTransform}
|
|
2490
|
+
*/
|
|
2491
|
+
transform?: ShapeTransform;
|
|
2492
|
+
}
|
|
2493
|
+
/**
|
|
2494
|
+
* a particle emitter that emits particles from a circle.
|
|
2495
|
+
*/
|
|
2496
|
+
declare class CircleEmitter implements EmitterShape {
|
|
2497
|
+
type: string;
|
|
2498
|
+
radius: number;
|
|
2499
|
+
arc: number;
|
|
2500
|
+
thickness: number;
|
|
2501
|
+
mode: EmitterMode;
|
|
2502
|
+
spread: number;
|
|
2503
|
+
speed: ValueGenerator | FunctionValueGenerator;
|
|
2504
|
+
memory: GeneratorMemory;
|
|
2505
|
+
transform?: ShapeTransform;
|
|
2506
|
+
private currentValue;
|
|
2507
|
+
constructor(parameters?: CircleEmitterParameters);
|
|
2508
|
+
update(system: IParticleSystem, delta: number): void;
|
|
2509
|
+
initialize(p: Particle, emissionState: EmissionState): void;
|
|
2510
|
+
toJSON(): ShapeJSON;
|
|
2511
|
+
static fromJSON(json: any): CircleEmitter;
|
|
2512
|
+
clone(): EmitterShape;
|
|
2513
|
+
}
|
|
2514
|
+
|
|
2515
|
+
/**
|
|
2516
|
+
* Interface representing the parameters for a cone emitter.
|
|
2517
|
+
*/
|
|
2518
|
+
interface ConeEmitterParameters {
|
|
2519
|
+
/**
|
|
2520
|
+
* The radius of the cone base.
|
|
2521
|
+
*/
|
|
2522
|
+
radius?: number;
|
|
2523
|
+
/**
|
|
2524
|
+
* The arc of the cone.
|
|
2525
|
+
*/
|
|
2526
|
+
arc?: number;
|
|
2527
|
+
/**
|
|
2528
|
+
* The thickness of the cone. 1 is a full cone, 0 is a cone with 0 thickness.
|
|
2529
|
+
*/
|
|
2530
|
+
thickness?: number;
|
|
2531
|
+
/**
|
|
2532
|
+
* The angle of the cone, ranging from 0 to Math.PI / 2.
|
|
2533
|
+
*/
|
|
2534
|
+
angle?: number;
|
|
2535
|
+
/**
|
|
2536
|
+
* The mode of the emitter.
|
|
2537
|
+
* {@link EmitterMode}
|
|
2538
|
+
*/
|
|
2539
|
+
mode?: EmitterMode;
|
|
2540
|
+
/**
|
|
2541
|
+
* The length of the segment at which the emitter point converges at the start and end, when mode is EmitterMode.Loop or EmitterMode.PingPong.
|
|
2542
|
+
* {@link EmitterMode}
|
|
2543
|
+
*/
|
|
2544
|
+
spread?: number;
|
|
2545
|
+
/**
|
|
2546
|
+
* The speed of the emitter start point when mode is EmitterMode.Loop or EmitterMode.PingPong.
|
|
2547
|
+
* {@link EmitterMode}
|
|
2548
|
+
*/
|
|
2549
|
+
speed?: ValueGenerator | FunctionValueGenerator;
|
|
2550
|
+
/**
|
|
2551
|
+
* Offset, rotation and scale of the shape within the particle system.
|
|
2552
|
+
* {@link ShapeTransform}
|
|
2553
|
+
*/
|
|
2554
|
+
transform?: ShapeTransform;
|
|
2017
2555
|
}
|
|
2018
|
-
|
|
2019
|
-
* Emit a sub particle system from particles.
|
|
2020
|
-
*/
|
|
2021
|
-
declare class EmitSubParticleSystem implements Behavior {
|
|
2022
|
-
private particleSystem;
|
|
2023
|
-
useVelocityAsBasis: boolean;
|
|
2024
|
-
subParticleSystem: IEmitter | undefined;
|
|
2025
|
-
mode: SubParticleEmitMode;
|
|
2026
|
-
emitProbability: number;
|
|
2556
|
+
declare class ConeEmitter implements EmitterShape {
|
|
2027
2557
|
type: string;
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2558
|
+
radius: number;
|
|
2559
|
+
arc: number;
|
|
2560
|
+
thickness: number;
|
|
2561
|
+
angle: number;
|
|
2562
|
+
mode: EmitterMode;
|
|
2563
|
+
spread: number;
|
|
2564
|
+
speed: ValueGenerator | FunctionValueGenerator;
|
|
2565
|
+
memory: GeneratorMemory;
|
|
2566
|
+
transform?: ShapeTransform;
|
|
2567
|
+
private currentValue;
|
|
2568
|
+
constructor(parameters?: ConeEmitterParameters);
|
|
2569
|
+
update(system: IParticleSystem, delta: number): void;
|
|
2570
|
+
initialize(p: Particle, emissionState: EmissionState): void;
|
|
2571
|
+
toJSON(): ShapeJSON;
|
|
2572
|
+
static fromJSON(json: ShapeJSON): ConeEmitter;
|
|
2573
|
+
clone(): EmitterShape;
|
|
2042
2574
|
}
|
|
2043
2575
|
|
|
2044
2576
|
/**
|
|
2045
|
-
*
|
|
2577
|
+
* Interface representing the parameters for a donut emitter.
|
|
2046
2578
|
*/
|
|
2047
|
-
|
|
2048
|
-
/** Deterministic simplex noise generator suitable for 2D, 3D and 4D spaces. */
|
|
2049
|
-
declare class SimplexNoise {
|
|
2050
|
-
private p;
|
|
2051
|
-
private perm;
|
|
2052
|
-
private permMod12;
|
|
2579
|
+
interface DonutEmitterParameters {
|
|
2053
2580
|
/**
|
|
2054
|
-
*
|
|
2055
|
-
* This involves some setup. You can save a few cpu cycles by reusing the same instance.
|
|
2056
|
-
* @param randomOrSeed A random number generator or a seed (string|number).
|
|
2057
|
-
* Defaults to Math.random (random irreproducible initialization).
|
|
2581
|
+
* The radius of the donut.
|
|
2058
2582
|
*/
|
|
2059
|
-
|
|
2583
|
+
radius?: number;
|
|
2060
2584
|
/**
|
|
2061
|
-
*
|
|
2062
|
-
* @param x
|
|
2063
|
-
* @param y
|
|
2064
|
-
* @returns a number in the interval [-1, 1]
|
|
2585
|
+
* The arc of the donut.
|
|
2065
2586
|
*/
|
|
2066
|
-
|
|
2587
|
+
arc?: number;
|
|
2067
2588
|
/**
|
|
2068
|
-
*
|
|
2069
|
-
* @param x
|
|
2070
|
-
* @param y
|
|
2071
|
-
* @param z
|
|
2072
|
-
* @returns a number in the interval [-1, 1]
|
|
2589
|
+
* The thickness of the ring. 1 is a full donut, 0 is a ring with 0 radius.
|
|
2073
2590
|
*/
|
|
2074
|
-
|
|
2591
|
+
thickness?: number;
|
|
2075
2592
|
/**
|
|
2076
|
-
*
|
|
2077
|
-
* @param x
|
|
2078
|
-
* @param y
|
|
2079
|
-
* @param z
|
|
2080
|
-
* @returns a number in the interval [-1, 1]
|
|
2593
|
+
* The radius of the hole in the center of the donut.
|
|
2081
2594
|
*/
|
|
2082
|
-
|
|
2595
|
+
donutRadius?: number;
|
|
2596
|
+
/**
|
|
2597
|
+
* The mode of the emitter.
|
|
2598
|
+
* {@link EmitterMode}
|
|
2599
|
+
*/
|
|
2600
|
+
mode?: EmitterMode;
|
|
2601
|
+
/**
|
|
2602
|
+
* The length of the segment at which the emitter point converges at the start and end, when mode is EmitterMode.Loop or EmitterMode.PingPong.
|
|
2603
|
+
* {@link EmitterMode}
|
|
2604
|
+
*/
|
|
2605
|
+
spread?: number;
|
|
2606
|
+
/**
|
|
2607
|
+
* The speed of the emitter start point when mode is EmitterMode.Loop or EmitterMode.PingPong.
|
|
2608
|
+
* {@link EmitterMode}
|
|
2609
|
+
*/
|
|
2610
|
+
speed?: ValueGenerator | FunctionValueGenerator;
|
|
2611
|
+
/**
|
|
2612
|
+
* Offset, rotation and scale of the shape within the particle system.
|
|
2613
|
+
* {@link ShapeTransform}
|
|
2614
|
+
*/
|
|
2615
|
+
transform?: ShapeTransform;
|
|
2616
|
+
}
|
|
2617
|
+
declare class DonutEmitter implements EmitterShape {
|
|
2618
|
+
type: string;
|
|
2619
|
+
radius: number;
|
|
2620
|
+
donutRadius: number;
|
|
2621
|
+
arc: number;
|
|
2622
|
+
thickness: number;
|
|
2623
|
+
mode: EmitterMode;
|
|
2624
|
+
spread: number;
|
|
2625
|
+
speed: ValueGenerator | FunctionValueGenerator;
|
|
2626
|
+
memory: GeneratorMemory;
|
|
2627
|
+
transform?: ShapeTransform;
|
|
2628
|
+
_m1: Matrix4;
|
|
2629
|
+
constructor(parameters?: DonutEmitterParameters);
|
|
2630
|
+
private currentValue;
|
|
2631
|
+
update(system: IParticleSystem, delta: number): void;
|
|
2632
|
+
initialize(p: Particle, emissionState: EmissionState): void;
|
|
2633
|
+
toJSON(): ShapeJSON;
|
|
2634
|
+
static fromJSON(json: any): DonutEmitter;
|
|
2635
|
+
clone(): EmitterShape;
|
|
2083
2636
|
}
|
|
2084
2637
|
|
|
2085
2638
|
/**
|
|
2086
|
-
*
|
|
2639
|
+
* Interface representing the parameters for an edge emitter.
|
|
2087
2640
|
*/
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2641
|
+
interface EdgeEmitterParameters {
|
|
2642
|
+
/** Half the length of the line: it runs from -radius to +radius along X. */
|
|
2643
|
+
radius?: number;
|
|
2644
|
+
/**
|
|
2645
|
+
* The mode of the emitter.
|
|
2646
|
+
* {@link EmitterMode}
|
|
2647
|
+
*/
|
|
2648
|
+
mode?: EmitterMode;
|
|
2649
|
+
/**
|
|
2650
|
+
* The length of the segment at which the emitter point converges at the start and end, when mode is EmitterMode.Loop or EmitterMode.PingPong.
|
|
2651
|
+
* {@link EmitterMode}
|
|
2652
|
+
*/
|
|
2653
|
+
spread?: number;
|
|
2654
|
+
/**
|
|
2655
|
+
* The speed of the emitter start point when mode is EmitterMode.Loop or EmitterMode.PingPong.
|
|
2656
|
+
* {@link EmitterMode}
|
|
2657
|
+
*/
|
|
2658
|
+
speed?: ValueGenerator | FunctionValueGenerator;
|
|
2106
2659
|
}
|
|
2107
|
-
|
|
2108
2660
|
/**
|
|
2109
|
-
*
|
|
2661
|
+
* A particle emitter that emits particles from a line along X, all moving along +Y like Unity's
|
|
2662
|
+
* single-sided Edge shape.
|
|
2110
2663
|
*/
|
|
2111
|
-
declare class
|
|
2112
|
-
frequency: FunctionValueGenerator | ValueGenerator;
|
|
2113
|
-
power: FunctionValueGenerator | ValueGenerator;
|
|
2114
|
-
positionAmount: FunctionValueGenerator | ValueGenerator;
|
|
2115
|
-
rotationAmount: FunctionValueGenerator | ValueGenerator;
|
|
2664
|
+
declare class EdgeEmitter implements EmitterShape {
|
|
2116
2665
|
type: string;
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2666
|
+
radius: number;
|
|
2667
|
+
mode: EmitterMode;
|
|
2668
|
+
spread: number;
|
|
2669
|
+
speed: ValueGenerator | FunctionValueGenerator;
|
|
2670
|
+
memory: GeneratorMemory;
|
|
2671
|
+
private currentValue;
|
|
2672
|
+
constructor(parameters?: EdgeEmitterParameters);
|
|
2673
|
+
update(system: IParticleSystem, delta: number): void;
|
|
2674
|
+
initialize(p: Particle, emissionState: EmissionState): void;
|
|
2675
|
+
toJSON(): ShapeJSON;
|
|
2676
|
+
static fromJSON(json: any): EdgeEmitter;
|
|
2677
|
+
clone(): EmitterShape;
|
|
2126
2678
|
}
|
|
2127
2679
|
|
|
2128
|
-
interface
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2680
|
+
interface EmitterShapePlugin {
|
|
2681
|
+
type: string;
|
|
2682
|
+
constructor: Constructable<EmitterShape>;
|
|
2683
|
+
params: ParameterPair[];
|
|
2684
|
+
loadJSON: (json: any, meta: JsonMetaData) => EmitterShape;
|
|
2132
2685
|
}
|
|
2133
|
-
declare
|
|
2686
|
+
declare const EmitterShapes: {
|
|
2687
|
+
[key: string]: EmitterShapePlugin;
|
|
2688
|
+
};
|
|
2689
|
+
declare function EmitterFromJSON(json: ShapeJSON, meta: JsonMetaData): EmitterShape;
|
|
2134
2690
|
|
|
2135
2691
|
/**
|
|
2136
|
-
*
|
|
2137
|
-
* {@link Sequencer}
|
|
2692
|
+
* Interface representing the parameters for a grid emitter.
|
|
2138
2693
|
*/
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2694
|
+
interface GridEmitterParameters {
|
|
2695
|
+
/**
|
|
2696
|
+
* The width of the grid.
|
|
2697
|
+
*/
|
|
2698
|
+
width?: number;
|
|
2699
|
+
/**
|
|
2700
|
+
* The height of the grid.
|
|
2701
|
+
*/
|
|
2702
|
+
height?: number;
|
|
2703
|
+
/**
|
|
2704
|
+
* The number of columns in the grid.
|
|
2705
|
+
*/
|
|
2706
|
+
column?: number;
|
|
2707
|
+
/**
|
|
2708
|
+
* The number of rows in the grid.
|
|
2709
|
+
*/
|
|
2710
|
+
row?: number;
|
|
2711
|
+
/**
|
|
2712
|
+
* Offset, rotation and scale of the shape within the particle system.
|
|
2713
|
+
* {@link ShapeTransform}
|
|
2714
|
+
*/
|
|
2715
|
+
transform?: ShapeTransform;
|
|
2157
2716
|
}
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2717
|
+
declare class GridEmitter implements EmitterShape {
|
|
2718
|
+
type: string;
|
|
2719
|
+
width: number;
|
|
2720
|
+
height: number;
|
|
2721
|
+
column: number;
|
|
2722
|
+
row: number;
|
|
2723
|
+
transform?: ShapeTransform;
|
|
2724
|
+
constructor(parameters?: GridEmitterParameters);
|
|
2725
|
+
initialize(p: Particle): void;
|
|
2726
|
+
toJSON(): ShapeJSON;
|
|
2727
|
+
static fromJSON(json: any): GridEmitter;
|
|
2728
|
+
clone(): EmitterShape;
|
|
2729
|
+
update(system: IParticleSystem, delta: number): void;
|
|
2161
2730
|
}
|
|
2162
|
-
|
|
2163
|
-
declare function getPhysicsResolver(): PhysicsResolver;
|
|
2731
|
+
|
|
2164
2732
|
/**
|
|
2165
|
-
*
|
|
2733
|
+
* Interface representing the parameters for a hemisphere emitter.
|
|
2166
2734
|
*/
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2735
|
+
interface HemisphereEmitterParameters {
|
|
2736
|
+
/**
|
|
2737
|
+
* The radius of the hemisphere.
|
|
2738
|
+
*/
|
|
2739
|
+
radius?: number;
|
|
2740
|
+
/**
|
|
2741
|
+
* The arc of the hemisphere.
|
|
2742
|
+
*/
|
|
2743
|
+
arc?: number;
|
|
2744
|
+
/**
|
|
2745
|
+
* The thickness of the hemisphere. 1 is a full hemisphere, 0 is a thin shell.
|
|
2746
|
+
*/
|
|
2747
|
+
thickness?: number;
|
|
2748
|
+
/**
|
|
2749
|
+
* The mode of the emitter.
|
|
2750
|
+
* {@link EmitterMode}
|
|
2751
|
+
*/
|
|
2752
|
+
mode?: EmitterMode;
|
|
2753
|
+
/**
|
|
2754
|
+
* The length of the segment at which the emitter point converges at the start and end, when mode is EmitterMode.Loop or EmitterMode.PingPong.
|
|
2755
|
+
* {@link EmitterMode}
|
|
2756
|
+
*/
|
|
2757
|
+
spread?: number;
|
|
2758
|
+
/**
|
|
2759
|
+
* The speed of the emitter start point when mode is EmitterMode.Loop or EmitterMode.PingPong.
|
|
2760
|
+
* {@link EmitterMode}
|
|
2761
|
+
*/
|
|
2762
|
+
speed?: ValueGenerator | FunctionValueGenerator;
|
|
2763
|
+
/**
|
|
2764
|
+
* Offset, rotation and scale of the shape within the particle system.
|
|
2765
|
+
* {@link ShapeTransform}
|
|
2766
|
+
*/
|
|
2767
|
+
transform?: ShapeTransform;
|
|
2768
|
+
}
|
|
2769
|
+
declare class HemisphereEmitter implements EmitterShape {
|
|
2170
2770
|
type: string;
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2771
|
+
radius: number;
|
|
2772
|
+
arc: number;
|
|
2773
|
+
thickness: number;
|
|
2774
|
+
mode: EmitterMode;
|
|
2775
|
+
spread: number;
|
|
2776
|
+
speed: ValueGenerator | FunctionValueGenerator;
|
|
2777
|
+
memory: GeneratorMemory;
|
|
2778
|
+
transform?: ShapeTransform;
|
|
2779
|
+
_m1: Matrix4;
|
|
2780
|
+
constructor(parameters?: HemisphereEmitterParameters);
|
|
2781
|
+
private currentValue;
|
|
2782
|
+
update(system: IParticleSystem, delta: number): void;
|
|
2783
|
+
initialize(p: Particle, emissionState: EmissionState): void;
|
|
2784
|
+
toJSON(): ShapeJSON;
|
|
2785
|
+
static fromJSON(json: any): HemisphereEmitter;
|
|
2786
|
+
clone(): EmitterShape;
|
|
2180
2787
|
}
|
|
2181
2788
|
|
|
2182
2789
|
/**
|
|
2183
|
-
*
|
|
2790
|
+
* A point emitter emits particles from a single point.
|
|
2184
2791
|
*/
|
|
2185
|
-
declare class
|
|
2186
|
-
color: FunctionColorGenerator;
|
|
2187
|
-
speedRange: IntervalValue;
|
|
2792
|
+
declare class PointEmitter implements EmitterShape {
|
|
2188
2793
|
type: string;
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2794
|
+
_m1: Matrix4;
|
|
2795
|
+
/**
|
|
2796
|
+
* Offset, rotation and scale of the point within the particle system.
|
|
2797
|
+
* {@link ShapeTransform}
|
|
2798
|
+
*/
|
|
2799
|
+
transform?: ShapeTransform;
|
|
2800
|
+
constructor(transform?: ShapeTransform);
|
|
2801
|
+
update(system: IParticleSystem, delta: number): void;
|
|
2802
|
+
initialize(p: Particle): void;
|
|
2803
|
+
toJSON(): ShapeJSON;
|
|
2804
|
+
static fromJSON(json: any): PointEmitter;
|
|
2805
|
+
clone(): EmitterShape;
|
|
2197
2806
|
}
|
|
2198
2807
|
|
|
2199
2808
|
/**
|
|
2200
|
-
*
|
|
2809
|
+
* Interface representing the parameters for a rectangle emitter.
|
|
2201
2810
|
*/
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2811
|
+
interface RectangleEmitterParameters {
|
|
2812
|
+
/**
|
|
2813
|
+
* The width of the rectangle.
|
|
2814
|
+
*/
|
|
2815
|
+
width?: number;
|
|
2816
|
+
/**
|
|
2817
|
+
* The height of the rectangle.
|
|
2818
|
+
*/
|
|
2819
|
+
height?: number;
|
|
2820
|
+
/**
|
|
2821
|
+
* The thickness of the ring.
|
|
2822
|
+
* 1 is a full rectangle, 0 is a ring with 0 radius.
|
|
2823
|
+
*/
|
|
2824
|
+
thickness?: number;
|
|
2825
|
+
/**
|
|
2826
|
+
* The mode of the emitter.
|
|
2827
|
+
* {@link EmitterMode}
|
|
2828
|
+
*/
|
|
2829
|
+
mode?: EmitterMode;
|
|
2830
|
+
/**
|
|
2831
|
+
* The length of segment of which emitter point converges at the start and end, when mode is EmitterMode.Loop or EmitterMode.PingPong.
|
|
2832
|
+
* {@link EmitterMode}
|
|
2833
|
+
*/
|
|
2834
|
+
spread?: number;
|
|
2835
|
+
/**
|
|
2836
|
+
* The speed of the emitter start point travels when mode is EmitterMode.Loop or EmitterMode.PingPong.
|
|
2837
|
+
* {@link EmitterMode}
|
|
2838
|
+
*/
|
|
2839
|
+
speed?: ValueGenerator | FunctionValueGenerator;
|
|
2840
|
+
/**
|
|
2841
|
+
* Offset, rotation and scale of the shape within the particle system.
|
|
2842
|
+
* {@link ShapeTransform}
|
|
2843
|
+
*/
|
|
2844
|
+
transform?: ShapeTransform;
|
|
2214
2845
|
}
|
|
2215
|
-
|
|
2216
2846
|
/**
|
|
2217
|
-
*
|
|
2847
|
+
* a particle emitter that emits particles from a rectangle.
|
|
2218
2848
|
*/
|
|
2219
|
-
declare class
|
|
2220
|
-
angularVelocity: ValueGenerator | FunctionValueGenerator;
|
|
2221
|
-
speedRange: IntervalValue;
|
|
2849
|
+
declare class RectangleEmitter implements EmitterShape {
|
|
2222
2850
|
type: string;
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2851
|
+
width: number;
|
|
2852
|
+
height: number;
|
|
2853
|
+
thickness: number;
|
|
2854
|
+
mode: EmitterMode;
|
|
2855
|
+
spread: number;
|
|
2856
|
+
speed: ValueGenerator | FunctionValueGenerator;
|
|
2857
|
+
memory: GeneratorMemory;
|
|
2858
|
+
transform?: ShapeTransform;
|
|
2859
|
+
private currentValue;
|
|
2860
|
+
private _m1;
|
|
2861
|
+
constructor(parameters?: RectangleEmitterParameters);
|
|
2862
|
+
update(system: IParticleSystem, delta: number): void;
|
|
2863
|
+
initialize(p: Particle, emissionState: EmissionState): void;
|
|
2864
|
+
toJSON(): ShapeJSON;
|
|
2865
|
+
static fromJSON(json: any): RectangleEmitter;
|
|
2866
|
+
clone(): EmitterShape;
|
|
2232
2867
|
}
|
|
2233
2868
|
|
|
2234
2869
|
/**
|
|
2235
|
-
*
|
|
2870
|
+
* Interface representing the parameters for a sphere emitter.
|
|
2236
2871
|
*/
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2872
|
+
interface SphereEmitterParameters {
|
|
2873
|
+
/**
|
|
2874
|
+
* The radius of the sphere.
|
|
2875
|
+
*/
|
|
2876
|
+
radius?: number;
|
|
2877
|
+
/**
|
|
2878
|
+
* The arc of the sphere.
|
|
2879
|
+
*/
|
|
2880
|
+
arc?: number;
|
|
2881
|
+
/**
|
|
2882
|
+
* The thickness of the sphere. 1 is a full sphere, 0 is a thin shell.
|
|
2883
|
+
*/
|
|
2884
|
+
thickness?: number;
|
|
2885
|
+
/**
|
|
2886
|
+
* The mode of the emitter.
|
|
2887
|
+
* {@link EmitterMode}
|
|
2888
|
+
*/
|
|
2889
|
+
mode?: EmitterMode;
|
|
2890
|
+
/**
|
|
2891
|
+
* The length of the segment at which the emitter point converges at the start and end, when mode is EmitterMode.Loop or EmitterMode.PingPong.
|
|
2892
|
+
* {@link EmitterMode}
|
|
2893
|
+
*/
|
|
2894
|
+
spread?: number;
|
|
2895
|
+
/**
|
|
2896
|
+
* The speed of the emitter start point when mode is EmitterMode.Loop or EmitterMode.PingPong.
|
|
2897
|
+
* {@link EmitterMode}
|
|
2898
|
+
*/
|
|
2899
|
+
speed?: ValueGenerator | FunctionValueGenerator;
|
|
2900
|
+
/**
|
|
2901
|
+
* Offset, rotation and scale of the shape within the particle system.
|
|
2902
|
+
* {@link ShapeTransform}
|
|
2903
|
+
*/
|
|
2904
|
+
transform?: ShapeTransform;
|
|
2249
2905
|
}
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2906
|
+
declare class SphereEmitter implements EmitterShape {
|
|
2907
|
+
type: string;
|
|
2908
|
+
radius: number;
|
|
2909
|
+
arc: number;
|
|
2910
|
+
thickness: number;
|
|
2911
|
+
mode: EmitterMode;
|
|
2912
|
+
spread: number;
|
|
2913
|
+
speed: ValueGenerator | FunctionValueGenerator;
|
|
2914
|
+
memory: GeneratorMemory;
|
|
2915
|
+
transform?: ShapeTransform;
|
|
2916
|
+
_m1: Matrix4;
|
|
2917
|
+
constructor(parameters?: SphereEmitterParameters);
|
|
2918
|
+
private currentValue;
|
|
2919
|
+
update(system: IParticleSystem, delta: number): void;
|
|
2920
|
+
initialize(p: Particle, emissionState: EmissionState): void;
|
|
2921
|
+
toJSON(): ShapeJSON;
|
|
2922
|
+
static fromJSON(json: any): SphereEmitter;
|
|
2923
|
+
clone(): EmitterShape;
|
|
2262
2924
|
}
|
|
2263
2925
|
|
|
2264
2926
|
interface Plugin {
|
|
@@ -2271,23 +2933,17 @@ declare const Plugins: Array<Plugin>;
|
|
|
2271
2933
|
declare function loadPlugin(plugin: Plugin): void;
|
|
2272
2934
|
declare function unloadPlugin(pluginId: string): void;
|
|
2273
2935
|
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
*/
|
|
2286
|
-
name: string;
|
|
2287
|
-
/**
|
|
2288
|
-
* The children of the prefab.
|
|
2289
|
-
*/
|
|
2290
|
-
animationData: IAnimationData[];
|
|
2936
|
+
declare class TextureSequencer implements Sequencer {
|
|
2937
|
+
scaleX: number;
|
|
2938
|
+
scaleY: number;
|
|
2939
|
+
position: Vector3;
|
|
2940
|
+
locations: Vector2[];
|
|
2941
|
+
constructor(scaleX?: number, scaleY?: number, position?: Vector3);
|
|
2942
|
+
transform(position: Vector3, index: number): void;
|
|
2943
|
+
static fromJSON(json: any): Sequencer;
|
|
2944
|
+
clone(): Sequencer;
|
|
2945
|
+
toJSON(): any;
|
|
2946
|
+
fromImage(img: CanvasImageSource, threshold: number): void;
|
|
2291
2947
|
}
|
|
2292
2948
|
|
|
2293
2949
|
declare enum RenderMode {
|
|
@@ -2317,7 +2973,13 @@ interface StoredBatchSettings {
|
|
|
2317
2973
|
materialDepthWrite: boolean;
|
|
2318
2974
|
materialAlphaTest: number;
|
|
2319
2975
|
texture: any;
|
|
2976
|
+
reflectionTexture: BaseTexture | null;
|
|
2977
|
+
reflectionLevel: number;
|
|
2978
|
+
reflectionFaces: BaseTexture[] | null;
|
|
2979
|
+
reflectionAtlas: BaseTexture | null;
|
|
2320
2980
|
layerMask: number;
|
|
2981
|
+
/** Billboard pivot in particle-size units, see {@link VFXBatchSettings.pivot}. */
|
|
2982
|
+
pivot?: Vector3;
|
|
2321
2983
|
}
|
|
2322
2984
|
declare abstract class VFXBatch {
|
|
2323
2985
|
mesh: Mesh;
|
|
@@ -2325,9 +2987,15 @@ declare abstract class VFXBatch {
|
|
|
2325
2987
|
settings: StoredBatchSettings;
|
|
2326
2988
|
protected maxParticles: number;
|
|
2327
2989
|
protected scene: Scene;
|
|
2990
|
+
private readonly visibleSystems;
|
|
2328
2991
|
protected constructor(settings: VFXBatchSettings, scene: Scene);
|
|
2329
2992
|
addSystem(system: IParticleSystem): void;
|
|
2330
2993
|
removeSystem(system: IParticleSystem): void;
|
|
2994
|
+
/**
|
|
2995
|
+
* Visible systems of this batch, written into a buffer owned by the batch.
|
|
2996
|
+
* Called once per frame per batch, so the result is reused rather than
|
|
2997
|
+
* reallocated; treat it as valid only until the next call.
|
|
2998
|
+
*/
|
|
2331
2999
|
getVisibleSystems(): IParticleSystem[];
|
|
2332
3000
|
applyDepthTexture(depthTexture: BaseTexture | null): void;
|
|
2333
3001
|
abstract setupBuffers(): void;
|
|
@@ -2356,7 +3024,34 @@ interface VFXBatchSettings {
|
|
|
2356
3024
|
materialDepthWrite: boolean;
|
|
2357
3025
|
materialAlphaTest: number;
|
|
2358
3026
|
texture: Texture | null;
|
|
3027
|
+
/**
|
|
3028
|
+
* Cubemap (or other reflection texture) harvested from a Babylon material's
|
|
3029
|
+
* `reflectionTexture`. Mesh batches sample it like StandardMaterial cubic
|
|
3030
|
+
* reflection; other render modes ignore it.
|
|
3031
|
+
*/
|
|
3032
|
+
reflectionTexture: BaseTexture | null;
|
|
3033
|
+
/** Multiplier for the reflection sample — mirrors `texture.level`. */
|
|
3034
|
+
reflectionLevel: number;
|
|
3035
|
+
/**
|
|
3036
|
+
* Optional six cube-face 2D textures (px,py,pz,nx,ny,nz). Prefer
|
|
3037
|
+
* `reflectionAtlas` on iOS — many simultaneous face samplers still trip
|
|
3038
|
+
* GL_INVALID_OPERATION on WebKit.
|
|
3039
|
+
*/
|
|
3040
|
+
reflectionFaces: BaseTexture[] | null;
|
|
3041
|
+
/**
|
|
3042
|
+
* Single 3×2 atlas of cube faces (px py pz / nx ny nz). One sampler2D —
|
|
3043
|
+
* the path that stays valid on iOS WebKit ShaderMaterial draws.
|
|
3044
|
+
*/
|
|
3045
|
+
reflectionAtlas: BaseTexture | null;
|
|
2359
3046
|
layerMask: number;
|
|
3047
|
+
/**
|
|
3048
|
+
* Offset of billboard quads from their particle, in particle-size units
|
|
3049
|
+
* (Unity's renderer Pivot). On billboards x/y move the quad in its own plane
|
|
3050
|
+
* before it is rotated and z moves it toward the camera (up for horizontal
|
|
3051
|
+
* billboards). On stretched billboards x runs from the head to the tail and
|
|
3052
|
+
* y across, and z is unused. Absent or zero: no offset. Meshes ignore it.
|
|
3053
|
+
*/
|
|
3054
|
+
pivot?: Vector3;
|
|
2360
3055
|
}
|
|
2361
3056
|
interface AdaptivePerformanceOptions {
|
|
2362
3057
|
targetFrameMs: number;
|
|
@@ -2374,22 +3069,66 @@ declare class BatchedRenderer extends TransformNode {
|
|
|
2374
3069
|
batches: Array<VFXBatch>;
|
|
2375
3070
|
systemToBatchIndex: Map<IParticleSystem, number>;
|
|
2376
3071
|
depthTexture: BaseTexture | null;
|
|
3072
|
+
/** Systems in insertion order — iterated every frame, unlike the map. */
|
|
3073
|
+
private systems;
|
|
3074
|
+
/**
|
|
3075
|
+
* The same systems, ordered so that one emitting into another comes first.
|
|
3076
|
+
*
|
|
3077
|
+
* A sub emitter's particles are created by its parent's behaviors, part way
|
|
3078
|
+
* through the parent's step. A sub system updated before its parent has
|
|
3079
|
+
* already fixed the list of particles it will run behaviors over, so those
|
|
3080
|
+
* new particles are drawn that frame with nothing but their start values —
|
|
3081
|
+
* white where a colour curve would have coloured them, at their start size,
|
|
3082
|
+
* sitting at the point they were born. Rebuilt only when the set of systems
|
|
3083
|
+
* or their behaviors changes, not per frame.
|
|
3084
|
+
*/
|
|
3085
|
+
private orderedSystems;
|
|
3086
|
+
private orderedSystemsStale;
|
|
3087
|
+
/** Consecutive frames each batch has held no system, parallel to `batches`. */
|
|
3088
|
+
private batchEmptyFrames;
|
|
3089
|
+
/**
|
|
3090
|
+
* How long an empty batch is kept before it is disposed. Systems that toggle
|
|
3091
|
+
* a setting back and forth reuse the batch within this window instead of
|
|
3092
|
+
* rebuilding a mesh and material every time.
|
|
3093
|
+
*/
|
|
3094
|
+
private static readonly EMPTY_BATCH_GRACE_FRAMES;
|
|
2377
3095
|
private adaptivePerformanceState;
|
|
2378
3096
|
private lastAppliedQuality;
|
|
2379
3097
|
constructor(name: string, scene: Scene);
|
|
2380
3098
|
private static clamp;
|
|
2381
3099
|
private static equals;
|
|
2382
3100
|
addSystem(system: IParticleSystem): void;
|
|
2383
|
-
|
|
3101
|
+
/** Places a system into a compatible batch, creating one when none matches. */
|
|
3102
|
+
private assignToBatch;
|
|
3103
|
+
deleteSystem(system: IParticleSystem): boolean;
|
|
3104
|
+
/** Detaches a system from its batch, leaving the renderer's system list alone. */
|
|
3105
|
+
private removeFromBatch;
|
|
3106
|
+
/**
|
|
3107
|
+
* Re-buckets a system whose render settings changed. The system keeps its
|
|
3108
|
+
* place in the update order, so this is safe to call mid-frame.
|
|
3109
|
+
*/
|
|
2384
3110
|
updateSystem(system: IParticleSystem): void;
|
|
2385
3111
|
setDepthTexture(depthTexture: BaseTexture | null): void;
|
|
2386
3112
|
configureAdaptivePerformance(options?: Partial<AdaptivePerformanceOptions>): void;
|
|
2387
3113
|
disableAdaptivePerformance(resetQuality?: boolean): void;
|
|
2388
3114
|
getAdaptivePerformanceState(): AdaptivePerformanceState;
|
|
2389
3115
|
private applyAdaptiveQuality;
|
|
3116
|
+
/** @internal Called when a system's behaviors change, which can add a sub emitter. */
|
|
3117
|
+
_invalidateUpdateOrder(): void;
|
|
3118
|
+
/**
|
|
3119
|
+
* Orders the systems so a system emitting into another runs first.
|
|
3120
|
+
*
|
|
3121
|
+
* Depth first over "emits into" edges, recording each system once all the
|
|
3122
|
+
* systems it feeds have been recorded, then reversed — a system therefore
|
|
3123
|
+
* lands ahead of everything it emits into, however deep the chain. A cycle
|
|
3124
|
+
* cannot be satisfied by any order; it is left as found rather than dropped.
|
|
3125
|
+
*/
|
|
3126
|
+
private orderSystems;
|
|
2390
3127
|
update(delta: number): void;
|
|
2391
3128
|
/** Rebuild instance buffers from current particle state without advancing simulation. */
|
|
2392
3129
|
refreshBatches(): void;
|
|
3130
|
+
/** Disposes the batch at `index` and repairs the system→batch mapping. */
|
|
3131
|
+
private removeBatch;
|
|
2393
3132
|
/** Per-batch particle vs GPU instance counts — for diagnosing stale render state. */
|
|
2394
3133
|
getBatchRenderStats(): Array<{
|
|
2395
3134
|
batchIndex: number;
|
|
@@ -2403,69 +3142,63 @@ declare class BatchedRenderer extends TransformNode {
|
|
|
2403
3142
|
|
|
2404
3143
|
declare const BatchedParticleRenderer: typeof BatchedRenderer;
|
|
2405
3144
|
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
private lastStretchedSpeedFactor;
|
|
2433
|
-
update(): void;
|
|
2434
|
-
/** Pushes a zero-alpha instance so stale instancing data cannot linger on screen. */
|
|
2435
|
-
private uploadClearedInstance;
|
|
2436
|
-
dispose(): void;
|
|
3145
|
+
/** Reads the six face URLs from a Babylon CubeTexture (px py pz nx ny nz). */
|
|
3146
|
+
declare function cubeFaceUrls(reflection: BaseTexture | null | undefined): string[] | null;
|
|
3147
|
+
/** Returns a previously built atlas for this cube, if any. */
|
|
3148
|
+
declare function getCachedEnvAtlas(cube: BaseTexture): Texture | null;
|
|
3149
|
+
/** Stores an atlas for a cube source (tests / prebuilt atlases). */
|
|
3150
|
+
declare function cacheEnvAtlas(cube: BaseTexture, atlas: Texture): void;
|
|
3151
|
+
/**
|
|
3152
|
+
* Packs six cube-face images into one 3×2 atlas Texture (px py pz / nx ny nz).
|
|
3153
|
+
* Uses invertY:false so UV cellY=0 maps to the +faces row matching the shader.
|
|
3154
|
+
*/
|
|
3155
|
+
declare function createEnvAtlasFromFaceUrls(urls: string[], scene: Scene): Promise<Texture>;
|
|
3156
|
+
/**
|
|
3157
|
+
* Ensures a 3×2 env atlas exists for a CubeTexture. Returns a cached atlas
|
|
3158
|
+
* synchronously when available; otherwise starts (or joins) an async build and
|
|
3159
|
+
* invokes onReady when the atlas is usable.
|
|
3160
|
+
*/
|
|
3161
|
+
declare function ensureEnvAtlasFromCube(cube: BaseTexture, scene: Scene, onReady: (atlas: Texture) => void): Texture | null;
|
|
3162
|
+
|
|
3163
|
+
type BabylonParticleMaterialParameters = Record<string, any>;
|
|
3164
|
+
declare class ParticleMeshStandardMaterial extends StandardMaterial {
|
|
3165
|
+
readonly isParticleMeshStandardMaterial = true;
|
|
3166
|
+
constructor(name: string, scene?: Scene, parameters?: BabylonParticleMaterialParameters);
|
|
3167
|
+
}
|
|
3168
|
+
declare class ParticleMeshPhysicsMaterial extends PBRMaterial {
|
|
3169
|
+
readonly isParticleMeshPhysicsMaterial = true;
|
|
3170
|
+
constructor(name: string, scene?: Scene, parameters?: BabylonParticleMaterialParameters);
|
|
2437
3171
|
}
|
|
2438
3172
|
|
|
2439
|
-
declare class
|
|
2440
|
-
|
|
2441
|
-
private
|
|
2442
|
-
private
|
|
2443
|
-
private
|
|
2444
|
-
private
|
|
2445
|
-
private
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
expandBuffers(target: number): void;
|
|
2457
|
-
rebuildMaterial(): void;
|
|
2458
|
-
private vector_;
|
|
2459
|
-
private vector2_;
|
|
2460
|
-
private vector3_;
|
|
2461
|
-
private quaternion_;
|
|
2462
|
-
update(): void;
|
|
2463
|
-
dispose(): void;
|
|
3173
|
+
declare class MeshSurfaceEmitter implements EmitterShape {
|
|
3174
|
+
type: string;
|
|
3175
|
+
private _triangleIndexToArea;
|
|
3176
|
+
private _mesh?;
|
|
3177
|
+
private _positions?;
|
|
3178
|
+
private _indices?;
|
|
3179
|
+
private _meshReferenceId?;
|
|
3180
|
+
/** Offset, rotation and scale of the mesh within the particle system. */
|
|
3181
|
+
transform?: ShapeTransform;
|
|
3182
|
+
get mesh(): Mesh | undefined;
|
|
3183
|
+
set mesh(mesh: Mesh | undefined);
|
|
3184
|
+
constructor(mesh?: Mesh, meshReferenceId?: string, transform?: ShapeTransform);
|
|
3185
|
+
initialize(p: Particle): void;
|
|
3186
|
+
toJSON(): ShapeJSON;
|
|
3187
|
+
static fromJSON(json: any): MeshSurfaceEmitter;
|
|
3188
|
+
clone(): EmitterShape;
|
|
3189
|
+
update(_system: IParticleSystem, _delta: number): void;
|
|
2464
3190
|
}
|
|
3191
|
+
declare const MeshSurfaceEmitterPlugin: Plugin;
|
|
2465
3192
|
|
|
2466
3193
|
declare class ParticleEmitter extends TransformNode {
|
|
2467
3194
|
system: IParticleSystem;
|
|
2468
3195
|
private _matrixWorld;
|
|
3196
|
+
private _matrixWorldFlag;
|
|
3197
|
+
/**
|
|
3198
|
+
* The node's world matrix in quarks.core form. Mirrored from Babylon's
|
|
3199
|
+
* matrix only when that matrix actually changed (tracked by its
|
|
3200
|
+
* `updateFlag`), so repeated reads inside a frame are free.
|
|
3201
|
+
*/
|
|
2469
3202
|
get matrixWorld(): Matrix4;
|
|
2470
3203
|
get visible(): boolean;
|
|
2471
3204
|
set visible(value: boolean);
|
|
@@ -2500,6 +3233,8 @@ interface ParticleSystemParameters {
|
|
|
2500
3233
|
emissionOverTime?: ValueGenerator | FunctionValueGenerator;
|
|
2501
3234
|
emissionOverDistance?: ValueGenerator | FunctionValueGenerator;
|
|
2502
3235
|
emissionBursts?: Array<BurstParameters>;
|
|
3236
|
+
/** Most particles alive at once; emission past it is dropped. Leave unset for no limit. */
|
|
3237
|
+
maxParticles?: number;
|
|
2503
3238
|
onlyUsedByOther?: boolean;
|
|
2504
3239
|
behaviors?: Array<Behavior>;
|
|
2505
3240
|
instancingGeometry?: Float32Array;
|
|
@@ -2526,6 +3261,10 @@ interface ParticleSystemParameters {
|
|
|
2526
3261
|
depthWrite?: boolean;
|
|
2527
3262
|
alphaTest?: number;
|
|
2528
3263
|
layerMask?: number;
|
|
3264
|
+
/** Billboard pivot in particle-size units, see {@link VFXBatchSettings.pivot}. */
|
|
3265
|
+
pivot?: Vector3;
|
|
3266
|
+
/** Fraction of billboard particles mirrored along U (x) and V (y), see {@link ParticleSystem.flip}. */
|
|
3267
|
+
flip?: Vector2;
|
|
2529
3268
|
scene?: Scene;
|
|
2530
3269
|
}
|
|
2531
3270
|
interface BurstParametersJSON {
|
|
@@ -2551,6 +3290,7 @@ interface ParticleSystemJSONParameters {
|
|
|
2551
3290
|
emissionOverTime: FunctionJSON;
|
|
2552
3291
|
emissionOverDistance: FunctionJSON;
|
|
2553
3292
|
emissionBursts?: Array<BurstParametersJSON>;
|
|
3293
|
+
maxParticles?: number;
|
|
2554
3294
|
onlyUsedByOther: boolean;
|
|
2555
3295
|
rendererEmitterSettings: RendererEmitterSettings;
|
|
2556
3296
|
instancingGeometry?: any;
|
|
@@ -2574,6 +3314,10 @@ interface ParticleSystemJSONParameters {
|
|
|
2574
3314
|
alphaTest?: number;
|
|
2575
3315
|
behaviors: Array<any>;
|
|
2576
3316
|
worldSpace: boolean;
|
|
3317
|
+
/** `[x, y, z]`; written only when non-zero. */
|
|
3318
|
+
pivot?: number[];
|
|
3319
|
+
/** `[u, v]`; written only when non-zero. */
|
|
3320
|
+
flip?: number[];
|
|
2577
3321
|
}
|
|
2578
3322
|
interface BabylonMetaData {
|
|
2579
3323
|
textures: {
|
|
@@ -2615,14 +3359,24 @@ declare class ParticleSystem implements IParticleSystem {
|
|
|
2615
3359
|
startColor: ColorGenerator | FunctionColorGenerator;
|
|
2616
3360
|
startTileIndex: ValueGenerator;
|
|
2617
3361
|
rendererEmitterSettings: RendererEmitterSettings;
|
|
3362
|
+
/**
|
|
3363
|
+
* Fraction of billboard particles mirrored along U (x) and V (y), each
|
|
3364
|
+
* picked at random when the particle is born — Unity's renderer Flip.
|
|
3365
|
+
* Undefined: nothing is mirrored. Meshes ignore it.
|
|
3366
|
+
*/
|
|
3367
|
+
flip?: Vector2;
|
|
2618
3368
|
emissionOverTime: ValueGenerator | FunctionValueGenerator;
|
|
2619
3369
|
emissionOverDistance: ValueGenerator | FunctionValueGenerator;
|
|
2620
3370
|
emissionBursts: Array<BurstParameters>;
|
|
3371
|
+
/** Most particles alive at once (Unity's Max Particles); emission past it is dropped. Undefined means no limit. */
|
|
3372
|
+
maxParticles?: number;
|
|
2621
3373
|
onlyUsedByOther: boolean;
|
|
2622
3374
|
worldSpace: boolean;
|
|
2623
3375
|
particleNum: number;
|
|
2624
3376
|
paused: boolean;
|
|
2625
3377
|
particles: Array<Particle>;
|
|
3378
|
+
/** Column storage shared by this system's particles. */
|
|
3379
|
+
readonly store: ParticleStore;
|
|
2626
3380
|
emitterShape: EmitterShape;
|
|
2627
3381
|
emitter: ParticleEmitter;
|
|
2628
3382
|
rendererSettings: VFXBatchSettings;
|
|
@@ -2643,10 +3397,13 @@ declare class ParticleSystem implements IParticleSystem {
|
|
|
2643
3397
|
private listeners;
|
|
2644
3398
|
private readonly layerMaskProxy;
|
|
2645
3399
|
private materialRef;
|
|
3400
|
+
private sceneRef;
|
|
2646
3401
|
private qualityFactor;
|
|
2647
|
-
private useFastTrailHistory;
|
|
2648
3402
|
private simulationAccumulator;
|
|
2649
3403
|
private destroyed;
|
|
3404
|
+
/** Behaviors the cached plan was built from, compared by identity. */
|
|
3405
|
+
private fusionPlan?;
|
|
3406
|
+
private fusionSteps;
|
|
2650
3407
|
/** @internal **/
|
|
2651
3408
|
_renderer?: BatchedRenderer;
|
|
2652
3409
|
set time(time: number);
|
|
@@ -2671,6 +3428,15 @@ declare class ParticleSystem implements IParticleSystem {
|
|
|
2671
3428
|
set blendTiles(v: boolean);
|
|
2672
3429
|
get softParticles(): boolean;
|
|
2673
3430
|
set softParticles(v: boolean);
|
|
3431
|
+
/**
|
|
3432
|
+
* Billboard pivot in particle-size units (Unity's renderer Pivot), see
|
|
3433
|
+
* {@link VFXBatchSettings.pivot}. Assign a new vector to change it: editing
|
|
3434
|
+
* the returned one in place does not reach the renderer.
|
|
3435
|
+
*/
|
|
3436
|
+
get pivot(): Vector3 | undefined;
|
|
3437
|
+
set pivot(v: Vector3 | undefined);
|
|
3438
|
+
private static nonZeroPivot;
|
|
3439
|
+
private static nonZeroFlip;
|
|
2674
3440
|
get softNearFade(): number;
|
|
2675
3441
|
set softNearFade(v: number);
|
|
2676
3442
|
get softFarFade(): number;
|
|
@@ -2688,12 +3454,16 @@ declare class ParticleSystem implements IParticleSystem {
|
|
|
2688
3454
|
pause(): void;
|
|
2689
3455
|
play(): void;
|
|
2690
3456
|
stop(): void;
|
|
2691
|
-
private refreshTrailHistoryMode;
|
|
2692
|
-
private ensureTrailHistoryCapacity;
|
|
2693
|
-
private resetTrailHistory;
|
|
2694
|
-
private getTrailHistoryCount;
|
|
2695
|
-
private updateFastTrailHistory;
|
|
2696
3457
|
setQualityFactor(qualityFactor: number): void;
|
|
3458
|
+
/**
|
|
3459
|
+
* Appends one particle to the pool, giving it the next row of the store.
|
|
3460
|
+
*
|
|
3461
|
+
* Growing the store replaces its arrays, so every particle already bound to
|
|
3462
|
+
* it has to be re-pointed at the new ones.
|
|
3463
|
+
*/
|
|
3464
|
+
/** Points every particle at the store's columns again, after any were replaced. */
|
|
3465
|
+
private rebindParticles;
|
|
3466
|
+
private growParticlePool;
|
|
2697
3467
|
private spawn;
|
|
2698
3468
|
endEmit(): void;
|
|
2699
3469
|
dispose(): void;
|
|
@@ -2701,6 +3471,45 @@ declare class ParticleSystem implements IParticleSystem {
|
|
|
2701
3471
|
private firstTimeUpdate;
|
|
2702
3472
|
/** @internal */
|
|
2703
3473
|
update(delta: number): void;
|
|
3474
|
+
/**
|
|
3475
|
+
* Time the display is ahead of (positive) or still ahead of the simulation
|
|
3476
|
+
* (negative — the simulation ran a hair early), in seconds. Magnitude never
|
|
3477
|
+
* exceeds one step.
|
|
3478
|
+
*
|
|
3479
|
+
* The simulation runs on a fixed 1/60 step so that emission and lifetimes
|
|
3480
|
+
* stay in phase — without it a slow emitter flickers when the frame rate
|
|
3481
|
+
* wobbles. But frames do not arrive on that grid: a display running at
|
|
3482
|
+
* anything other than exactly 60Hz leaves some frames with no step at all
|
|
3483
|
+
* (half of them at 120Hz, three in five at 144Hz) and others with two, so
|
|
3484
|
+
* the particles are drawn stuttering even while the frame rate is perfect.
|
|
3485
|
+
*
|
|
3486
|
+
* The steps-per-frame count below is chosen by *rounding* the accumulated
|
|
3487
|
+
* time to the nearest step, not flooring it. Flooring always leaves the
|
|
3488
|
+
* accumulator positive, and when the real frame rate sits very close to
|
|
3489
|
+
* 60Hz (as most displays do) that leftover creeps toward a full step for
|
|
3490
|
+
* many consecutive frames before tipping over into a frame that runs two
|
|
3491
|
+
* steps at once and resets it to near zero — a visible lurch, every particle
|
|
3492
|
+
* in the system at once, with a perfectly steady frame rate the whole time.
|
|
3493
|
+
* Rounding lets the leftover go negative instead, which keeps it centered
|
|
3494
|
+
* near zero and stops it from ever building up toward that reset.
|
|
3495
|
+
*
|
|
3496
|
+
* Renderers close the gap by advancing what they draw along each particle's
|
|
3497
|
+
* velocity by this much. That reproduces the straight-line part of the
|
|
3498
|
+
* motion exactly — it is the same term the next step would integrate — so
|
|
3499
|
+
* the simulation stays fixed-step while the picture moves continuously.
|
|
3500
|
+
*/
|
|
3501
|
+
/** Length of one simulation step, in seconds. See {@link simulationResidual}. */
|
|
3502
|
+
get simulationStep(): number;
|
|
3503
|
+
get simulationResidual(): number;
|
|
3504
|
+
/**
|
|
3505
|
+
* Execution plan for this system's behaviors, rebuilt when the list changes.
|
|
3506
|
+
*
|
|
3507
|
+
* Consecutive behaviors that can be compiled into one loop are merged, so
|
|
3508
|
+
* the particles are walked once instead of once per behavior. The plan is
|
|
3509
|
+
* keyed on the behavior instances, not their types: swapping one out has to
|
|
3510
|
+
* change the generated code's indices.
|
|
3511
|
+
*/
|
|
3512
|
+
private behaviorSteps;
|
|
2704
3513
|
/** Advances emission, behaviors, motion and culling by one fixed timestep. */
|
|
2705
3514
|
private simulateStep;
|
|
2706
3515
|
private notifyFinished;
|
|
@@ -2720,46 +3529,70 @@ declare class ParticleSystem implements IParticleSystem {
|
|
|
2720
3529
|
addEventListener(event: ParticleSystemEventType, callback: (event: ParticleSystemEvent) => void): void;
|
|
2721
3530
|
removeAllEventListeners(event: ParticleSystemEventType): void;
|
|
2722
3531
|
removeEventListener(event: ParticleSystemEventType, callback: (event: ParticleSystemEvent) => void): void;
|
|
3532
|
+
/** True when at least one callback is registered for the event type. */
|
|
3533
|
+
private hasListeners;
|
|
2723
3534
|
private fire;
|
|
2724
3535
|
clone(): ParticleSystem;
|
|
2725
3536
|
}
|
|
2726
3537
|
|
|
2727
|
-
declare class QuarksUtil {
|
|
2728
|
-
static runOnAllParticleEmitters(root: Node, callback: (emitter: ParticleEmitter) => void): void;
|
|
2729
|
-
static addToBatchRenderer(root: Node, batchRenderer: BatchedRenderer): void;
|
|
2730
|
-
static play(root: Node): void;
|
|
2731
|
-
static stop(root: Node): void;
|
|
2732
|
-
static pause(root: Node): void;
|
|
2733
|
-
static restart(root: Node): void;
|
|
2734
|
-
static setAutoDestroy(root: Node, autoDestroy: boolean): void;
|
|
2735
|
-
static endEmit(root: Node): void;
|
|
2736
|
-
/** True when every emitter under `root` is a finished non-looping system (or looping). */
|
|
2737
|
-
static isEffectFinished(root: Node): boolean;
|
|
2738
|
-
private static traverseNode;
|
|
2739
|
-
}
|
|
2740
|
-
|
|
2741
3538
|
interface QuarksLoaderOptions {
|
|
2742
3539
|
baseUrl?: string;
|
|
3540
|
+
/**
|
|
3541
|
+
* Reuse one Texture per scene for every effect that references the same image with the same
|
|
3542
|
+
* sampling, and one copy of the data for identical mesh geometry. The renderer only batches
|
|
3543
|
+
* systems that share the texture (and geometry) object, so without this every loaded effect
|
|
3544
|
+
* gets batches — draw calls and buffer uploads — of its own even when its images are the same
|
|
3545
|
+
* as another effect's. Default true; turn off to give each effect private textures, e.g. to
|
|
3546
|
+
* change one effect's texture settings without touching the others.
|
|
3547
|
+
*/
|
|
3548
|
+
shareResources?: boolean;
|
|
2743
3549
|
}
|
|
2744
3550
|
declare class QuarksLoader {
|
|
2745
3551
|
private scene;
|
|
2746
3552
|
private options;
|
|
2747
3553
|
constructor(scene: Scene, options?: QuarksLoaderOptions);
|
|
2748
3554
|
load(url: string): Promise<TransformNode>;
|
|
3555
|
+
/**
|
|
3556
|
+
* Inlines geometries that an export wrote to their own file (`{uuid, type: 'QuarksGeometry',
|
|
3557
|
+
* url}` — e.g. the Unity exporter's "geometries as files"): each `url` is passed to
|
|
3558
|
+
* `loadGeometry`, and the `positions / indices / uvs / normals` it returns replace the url in
|
|
3559
|
+
* place, so `parse()` (which is synchronous) sees an ordinary inline geometry. `load()` does
|
|
3560
|
+
* this with `fetch`; call it yourself before `parse()` when the files come from elsewhere.
|
|
3561
|
+
* A geometry that fails to load is left as is and warned about.
|
|
3562
|
+
*/
|
|
3563
|
+
static resolveExternalGeometries(json: any, loadGeometry: (url: string) => Promise<any>): Promise<void>;
|
|
2749
3564
|
parse(json: any, baseUrl?: string): TransformNode;
|
|
2750
3565
|
private parseGeometries;
|
|
3566
|
+
/** The scene's copy of an identical geometry when resources are shared, else `geometry` itself. */
|
|
3567
|
+
private share;
|
|
3568
|
+
/**
|
|
3569
|
+
* Forgets the textures and geometries shared between loads into `scene` (see
|
|
3570
|
+
* {@link QuarksLoaderOptions.shareResources}). Effects already loaded keep theirs; the next
|
|
3571
|
+
* load creates new ones. Textures are not disposed — they may still be in use.
|
|
3572
|
+
*/
|
|
3573
|
+
static clearSharedResources(scene: Scene): void;
|
|
2751
3574
|
private parseSphereGeometry;
|
|
2752
3575
|
private parseBufferGeometry;
|
|
2753
3576
|
private extractInterleavedAttribute;
|
|
2754
3577
|
private int32ArrayToFloat32;
|
|
2755
3578
|
private parseImages;
|
|
3579
|
+
/**
|
|
3580
|
+
* Flags an image entry that is plainly not an image, which otherwise only
|
|
3581
|
+
* shows up as a texture that silently fails to load.
|
|
3582
|
+
*
|
|
3583
|
+
* The case worth naming: an exporter that could not embed a texture falls
|
|
3584
|
+
* back to writing the source asset's path, and a Unity built-in texture
|
|
3585
|
+
* reports a virtual path such as `Resources/unity_builtin_extra` that no
|
|
3586
|
+
* file backs.
|
|
3587
|
+
*/
|
|
3588
|
+
private static warnIfNotAnImageUrl;
|
|
2756
3589
|
/**
|
|
2757
3590
|
* `img.url` is already absolute for data/blob URIs and full http(s) URLs — common for
|
|
2758
3591
|
* "portable" exports that embed textures as base64 (see ensurePortableTextureUrl in
|
|
2759
3592
|
* babylon.quarks-editor). Prepending baseUrl to those turns e.g.
|
|
2760
3593
|
* "data:image/png;base64,AAAA" into an invalid path like "/some/dir/data:image/png;base64,AAAA".
|
|
2761
3594
|
*/
|
|
2762
|
-
private
|
|
3595
|
+
private static resolveUrl;
|
|
2763
3596
|
private parseTextures;
|
|
2764
3597
|
private mapWrapMode;
|
|
2765
3598
|
private parseMaterials;
|
|
@@ -2815,53 +3648,184 @@ declare class QuarksPrefab extends TransformNode implements IPrefab {
|
|
|
2815
3648
|
private updateDuration;
|
|
2816
3649
|
}
|
|
2817
3650
|
|
|
2818
|
-
declare class
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
static fromJSON(json: any): MeshSurfaceEmitter;
|
|
2831
|
-
clone(): EmitterShape;
|
|
2832
|
-
update(_system: IParticleSystem, _delta: number): void;
|
|
3651
|
+
declare class QuarksUtil {
|
|
3652
|
+
static runOnAllParticleEmitters(root: Node, callback: (emitter: ParticleEmitter) => void): void;
|
|
3653
|
+
static addToBatchRenderer(root: Node, batchRenderer: BatchedRenderer): void;
|
|
3654
|
+
static play(root: Node): void;
|
|
3655
|
+
static stop(root: Node): void;
|
|
3656
|
+
static pause(root: Node): void;
|
|
3657
|
+
static restart(root: Node): void;
|
|
3658
|
+
static setAutoDestroy(root: Node, autoDestroy: boolean): void;
|
|
3659
|
+
static endEmit(root: Node): void;
|
|
3660
|
+
/** True when every emitter under `root` is a finished non-looping system (or looping). */
|
|
3661
|
+
static isEffectFinished(root: Node): boolean;
|
|
3662
|
+
private static traverseNode;
|
|
2833
3663
|
}
|
|
2834
|
-
declare const MeshSurfaceEmitterPlugin: Plugin;
|
|
2835
3664
|
|
|
2836
3665
|
declare function registerShaderChunks(): void;
|
|
2837
3666
|
declare function getShaderChunk(chunkName: string): string | undefined;
|
|
2838
3667
|
declare function getRegisteredShaderChunks(): Readonly<Record<string, string>>;
|
|
2839
3668
|
|
|
2840
|
-
declare const _default$7: "\
|
|
3669
|
+
declare const _default$7: "\nattribute vec3 position;\nattribute vec2 uv;\nattribute vec3 normal;\nattribute vec3 offset;\nattribute vec4 color;\nattribute vec3 size;\nattribute vec4 rotation;\nattribute float uvTile;\n\nuniform mat4 world;\nuniform mat4 view;\nuniform mat4 projection;\n\n#ifdef UV_TILE\nuniform float tileCountX;\nuniform float tileCountY;\n#endif\n\nvarying vec2 vUV;\nvarying vec4 vColor;\nvarying vec3 vNormal;\nvarying vec3 vWorldPos;\n\n#ifdef TILE_BLEND\nvarying vec2 vUV2;\nvarying float vTileBlend;\n#endif\n\n#ifdef SOFT_PARTICLES\nvarying vec4 projPosition;\nvarying float linearDepth;\n#endif\n\nvec3 applyQuaternion(vec3 v, vec4 q) {\n vec3 qVec = q.xyz;\n float qW = q.w;\n vec3 t = 2.0 * cross(qVec, v);\n return v + qW * t + cross(qVec, t);\n}\n\nvoid main() {\n vec3 scaledPosition = position * size;\n vec3 rotatedPosition = applyQuaternion(scaledPosition, rotation);\n vec3 rotatedNormal = normalize(applyQuaternion(normal, rotation));\n vec3 localPos = rotatedPosition + offset;\n\n vec4 worldPos = world * vec4(localPos, 1.0);\n vec4 viewPos = view * worldPos;\n gl_Position = projection * viewPos;\n\n vWorldPos = worldPos.xyz;\n vNormal = normalize((world * vec4(rotatedNormal, 0.0)).xyz);\n\n#ifdef SOFT_PARTICLES\n projPosition = gl_Position;\n linearDepth = -viewPos.z;\n#endif\n\n#ifdef UV_TILE\n vec2 tc = vec2(tileCountX, tileCountY);\n float baseTile = floor(uvTile);\n float tileU = mod(baseTile, tc.x) / tc.x;\n float tileV = 1.0 - floor(baseTile / tc.x) / tc.y - 1.0 / tc.y;\n vUV = uv / tc + vec2(tileU, tileV);\n #ifdef TILE_BLEND\n float nextTile = ceil(uvTile);\n float nextU = mod(nextTile, tc.x) / tc.x;\n float nextV = 1.0 - floor(nextTile / tc.x) / tc.y - 1.0 / tc.y;\n vUV2 = uv / tc + vec2(nextU, nextV);\n vTileBlend = fract(uvTile);\n #endif\n#else\n vUV = uv;\n#endif\n\n vColor = color;\n}\n";
|
|
2841
3670
|
|
|
2842
|
-
declare const _default$6: "\
|
|
3671
|
+
declare const _default$6: "\n// Per-vertex attributes\nattribute vec3 position;\nattribute vec2 uv;\n\n// Per-instance attributes\nattribute vec3 offset;\nattribute vec4 color;\nattribute vec3 size;\nattribute vec4 rotation;\nattribute float uvTile;\n\n// Uniforms\nuniform mat4 worldViewProjection;\n\n#ifdef UV_TILE\nuniform float tileCountX;\nuniform float tileCountY;\n#endif\n\n// Varyings\nvarying vec2 vUV;\nvarying vec4 vColor;\n\nvec3 applyQuaternion(vec3 v, vec4 q) {\n vec3 qVec = q.xyz;\n float qW = q.w;\n vec3 t = 2.0 * cross(qVec, v);\n return v + qW * t + cross(qVec, t);\n}\n\nvoid main() {\n vec3 rotatedPosition = applyQuaternion(position * size, rotation);\n vec3 worldPos = rotatedPosition + offset;\n\n gl_Position = worldViewProjection * vec4(worldPos, 1.0);\n\n #ifdef UV_TILE\n vec2 tc = vec2(tileCountX, tileCountY);\n float baseTile = floor(uvTile);\n float tileU = mod(baseTile, tc.x) / tc.x;\n float tileV = 1.0 - floor(baseTile / tc.x) / tc.y - 1.0 / tc.y;\n vUV = uv / tc + vec2(tileU, tileV);\n #else\n vUV = uv;\n #endif\n\n vColor = color;\n}\n";
|
|
2843
3672
|
|
|
2844
|
-
declare const _default$5: "\
|
|
3673
|
+
declare const _default$5: "\nvarying vec2 vUV;\nvarying vec4 vColor;\n\n#ifdef TILE_BLEND\nvarying vec2 vUV2;\nvarying float vTileBlend;\n#endif\n\n#ifdef USE_MAP\nuniform sampler2D map;\n#endif\n\n#ifdef SOFT_PARTICLES\nuniform sampler2D depthTexture;\nuniform vec2 softParams;\nuniform vec4 projParams;\nvarying vec4 projPosition;\nvarying float linearDepth;\n#endif\n\n#ifdef USE_ALPHATEST\nuniform float alphaTest;\n#endif\n\nvoid main() {\n vec4 baseColor = vColor;\n\n#ifdef USE_MAP\n vec4 texColor = texture2D(map, vUV);\n #ifdef TILE_BLEND\n vec4 texColor2 = texture2D(map, vUV2);\n texColor = mix(texColor, texColor2, vTileBlend);\n #endif\n baseColor *= texColor;\n#endif\n\n#ifdef USE_COLOR_AS_ALPHA\n baseColor.a *= (baseColor.r + baseColor.g + baseColor.b) / 3.0;\n#endif\n\n#ifdef USE_ALPHATEST\n if (baseColor.a < alphaTest) discard;\n#else\n if (baseColor.a < 0.01) discard;\n#endif\n\n gl_FragColor = baseColor;\n\n#ifdef SOFT_PARTICLES\n vec2 p2 = projPosition.xy / projPosition.w;\n p2 = 0.5 * p2 + 0.5;\n float readDepth = texture2D(depthTexture, p2.xy).r;\n float zNear = projParams.x;\n float zFar = projParams.y;\n float viewDepth = (zFar * zNear) / (zFar - readDepth * (zFar - zNear));\n float fade = clamp(softParams.y * ((viewDepth - softParams.x) - linearDepth), 0.0, 1.0);\n gl_FragColor *= fade;\n#endif\n}\n";
|
|
2845
3674
|
|
|
2846
|
-
declare const _default$4: "\
|
|
3675
|
+
declare const _default$4: "\nvarying vec2 vUV;\nvarying vec4 vColor;\nvarying vec3 vNormal;\nvarying vec3 vWorldPos;\n\nuniform vec3 lightDirection;\nuniform vec3 lightColor;\nuniform vec3 ambientColor;\n\n#ifdef TILE_BLEND\nvarying vec2 vUV2;\nvarying float vTileBlend;\n#endif\n\n#ifdef USE_MAP\nuniform sampler2D map;\n#endif\n\n// One 3\u00D72 atlas (px py pz / nx ny nz). Avoids samplerCube and multi-face\n// sampler bindings that raise GL_INVALID_OPERATION on iOS WebKit.\n#ifdef USE_ENVMAP_ATLAS\nuniform sampler2D envAtlas;\nuniform vec3 eyePosition;\nuniform float reflectionLevel;\n\nvec3 sampleEnvAtlas(vec3 r) {\n vec3 a = abs(r);\n vec2 localUV;\n float cellX;\n float cellY;\n // Atlas layout: +X +Y +Z on row 0, -X -Y -Z on row 1.\n if (a.x >= a.y && a.x >= a.z) {\n cellX = 0.0;\n if (r.x >= 0.0) {\n cellY = 0.0;\n localUV = vec2(-r.z, -r.y) / a.x * 0.5 + 0.5;\n } else {\n cellY = 1.0;\n localUV = vec2(r.z, -r.y) / a.x * 0.5 + 0.5;\n }\n } else if (a.y >= a.z) {\n cellX = 1.0;\n if (r.y >= 0.0) {\n cellY = 0.0;\n localUV = vec2(r.x, r.z) / a.y * 0.5 + 0.5;\n } else {\n cellY = 1.0;\n localUV = vec2(r.x, -r.z) / a.y * 0.5 + 0.5;\n }\n } else {\n cellX = 2.0;\n if (r.z >= 0.0) {\n cellY = 0.0;\n localUV = vec2(r.x, -r.y) / a.z * 0.5 + 0.5;\n } else {\n cellY = 1.0;\n localUV = vec2(-r.x, -r.y) / a.z * 0.5 + 0.5;\n }\n }\n vec2 uv = (vec2(cellX, cellY) + clamp(localUV, 0.0, 1.0)) / vec2(3.0, 2.0);\n return texture2D(envAtlas, uv).rgb;\n}\n#endif\n\n#ifdef SOFT_PARTICLES\nuniform sampler2D depthTexture;\nuniform vec2 softParams;\nuniform vec4 projParams;\nvarying vec4 projPosition;\nvarying float linearDepth;\n#endif\n\n#ifdef USE_ALPHATEST\nuniform float alphaTest;\n#endif\n\nvoid main() {\n vec4 baseColor = vColor;\n\n#ifdef USE_MAP\n vec4 texColor = texture2D(map, vUV);\n #ifdef TILE_BLEND\n vec4 texColor2 = texture2D(map, vUV2);\n texColor = mix(texColor, texColor2, vTileBlend);\n #endif\n baseColor *= texColor;\n#endif\n\n#ifdef USE_ALPHATEST\n if (baseColor.a < alphaTest) discard;\n#else\n if (baseColor.a < 0.01) discard;\n#endif\n\n vec3 N = normalize(vNormal);\n vec3 L = normalize(-lightDirection);\n float NdotL = max(dot(N, L), 0.0);\n vec3 litColor = ambientColor + lightColor * NdotL;\n\n vec3 color = baseColor.rgb * litColor;\n\n#ifdef USE_ENVMAP_ATLAS\n vec3 viewDir = normalize(vWorldPos - eyePosition);\n vec3 reflectionCoords = reflect(viewDir, N);\n color += sampleEnvAtlas(reflectionCoords) * reflectionLevel;\n#endif\n\n gl_FragColor = vec4(color, baseColor.a);\n\n#ifdef SOFT_PARTICLES\n vec2 p2 = projPosition.xy / projPosition.w;\n p2 = 0.5 * p2 + 0.5;\n float readDepth = texture2D(depthTexture, p2.xy).r;\n float zNear = projParams.x;\n float zFar = projParams.y;\n float viewDepth = (zFar * zNear) / (zFar - readDepth * (zFar - zNear));\n float fade = clamp(softParams.y * ((viewDepth - softParams.x) - linearDepth), 0.0, 1.0);\n gl_FragColor *= fade;\n#endif\n}\n";
|
|
2847
3676
|
|
|
2848
|
-
declare const _default$3: "\
|
|
3677
|
+
declare const _default$3: "\n// Per-vertex attributes\nattribute vec3 position;\nattribute vec2 uv;\n\n// Per-instance attributes\nattribute vec3 offset;\nattribute vec4 color;\nattribute vec3 size;\nattribute float rotation;\nattribute float uvTile;\n\n// Uniforms\nuniform mat4 world;\nuniform mat4 view;\nuniform mat4 projection;\nuniform mat4 worldViewProjection;\n\n#ifdef UV_TILE\nuniform float tileCountX;\nuniform float tileCountY;\n#endif\n\n#ifdef PIVOT\n// Quad offset in particle-size units: xy in the quad's plane, z toward the camera.\nuniform vec3 pivot;\n#endif\n\n// Varyings\nvarying vec2 vUV;\nvarying vec4 vColor;\n#ifdef TILE_BLEND\nvarying vec2 vUV2;\nvarying float vTileBlend;\n#endif\n#ifdef SOFT_PARTICLES\nvarying vec4 projPosition;\nvarying float linearDepth;\n#endif\n\nvoid main() {\n float c = cos(rotation);\n float s = sin(rotation);\n\n // A negative size mirrors the quad, which is how flipped particles arrive.\n vec2 alignedPosition = position.xy * size.xy;\n#ifdef PIVOT\n // The pivot turns with the particle but is not mirrored with it.\n alignedPosition += pivot.xy * abs(size.xy);\n#endif\n vec2 rotatedPosition;\n rotatedPosition.x = c * alignedPosition.x - s * alignedPosition.y;\n rotatedPosition.y = s * alignedPosition.x + c * alignedPosition.y;\n\n#ifdef HORIZONTAL\n vec4 mvPosition = world * vec4(offset, 1.0);\n mvPosition.x += rotatedPosition.x;\n mvPosition.z -= rotatedPosition.y;\n#ifdef PIVOT\n mvPosition.y += pivot.z * abs(size.x);\n#endif\n mvPosition = view * mvPosition;\n#elif defined(VERTICAL)\n vec4 mvPosition = world * vec4(offset, 1.0);\n mvPosition.y += rotatedPosition.y;\n mvPosition = view * mvPosition;\n mvPosition.x += rotatedPosition.x;\n#else\n vec4 mvPosition = view * world * vec4(offset, 1.0);\n mvPosition.xy += rotatedPosition;\n#endif\n#ifdef PIVOT\n#ifndef HORIZONTAL\n // Toward the camera along its view axis, whichever way the view space\n // faces: anything in front of the camera has the sign of the far side.\n mvPosition.z -= sign(mvPosition.z) * pivot.z * abs(size.x);\n#endif\n#endif\n\n gl_Position = projection * mvPosition;\n#ifdef SOFT_PARTICLES\n projPosition = gl_Position;\n linearDepth = -mvPosition.z;\n#endif\n\n #ifdef UV_TILE\n vec2 tc = vec2(tileCountX, tileCountY);\n float baseTile = floor(uvTile);\n float tileU = mod(baseTile, tc.x) / tc.x;\n float tileV = 1.0 - floor(baseTile / tc.x) / tc.y - 1.0 / tc.y;\n vUV = uv / tc + vec2(tileU, tileV);\n #ifdef TILE_BLEND\n float nextTile = ceil(uvTile);\n float nextU = mod(nextTile, tc.x) / tc.x;\n float nextV = 1.0 - floor(nextTile / tc.x) / tc.y - 1.0 / tc.y;\n vUV2 = uv / tc + vec2(nextU, nextV);\n vTileBlend = fract(uvTile);\n #endif\n #else\n vUV = uv;\n #endif\n\n vColor = color;\n}\n";
|
|
2849
3678
|
|
|
2850
|
-
declare const _default$2: "\n// Per-vertex attributes\nattribute vec3 position;\nattribute vec2 uv;\n\n// Per-instance attributes\nattribute vec3 offset;\nattribute vec4 color;\nattribute vec3 size;\nattribute float rotation;\nattribute float uvTile;\nattribute vec4 velocity;\n\n// Uniforms\nuniform mat4 world;\nuniform mat4 view;\nuniform mat4 projection;\nuniform float speedFactor;\n\n#ifdef UV_TILE\nuniform float tileCountX;\nuniform float tileCountY;\n#endif\n\n// Varyings\nvarying vec2 vUV;\nvarying vec4 vColor;\n#ifdef TILE_BLEND\nvarying vec2 vUV2;\nvarying float vTileBlend;\n#endif\n#ifdef SOFT_PARTICLES\nvarying vec4 projPosition;\nvarying float linearDepth;\n#endif\n\nvoid main() {\n float lengthFactor = velocity.w;\n float avgSize = (size.x + size.y) * 0.5;\n vec4 mvPosition = view * world * vec4(offset, 1.0);\n vec3 viewVelocity = mat3(view * world) * velocity.xyz;\n float vlength = length(viewVelocity);\n // Stretch direction is the velocity direction; only a genuinely motionless particle has none.\n // Deriving it via normalize keeps the stretch aligned even when the speed contribution is ~0\n // (e.g. speedFactor 0), instead of collapsing the whole burst onto a fixed screen axis.\n vec3 vdir = vlength > 0.000001 ? viewVelocity / vlength : vec3(0.0, 0.0, 1.0);\n
|
|
3679
|
+
declare const _default$2: "\n// Per-vertex attributes\nattribute vec3 position;\nattribute vec2 uv;\n\n// Per-instance attributes\nattribute vec3 offset;\nattribute vec4 color;\nattribute vec3 size;\nattribute float rotation;\nattribute float uvTile;\nattribute vec4 velocity;\n\n// Uniforms\nuniform mat4 world;\nuniform mat4 view;\nuniform mat4 projection;\nuniform float speedFactor;\n\n#ifdef UV_TILE\nuniform float tileCountX;\nuniform float tileCountY;\n#endif\n\n#ifdef PIVOT\n// Streak offset in particle-size units: x from head to tail, y across.\nuniform vec3 pivot;\n#endif\n\n// Varyings\nvarying vec2 vUV;\nvarying vec4 vColor;\n#ifdef TILE_BLEND\nvarying vec2 vUV2;\nvarying float vTileBlend;\n#endif\n#ifdef SOFT_PARTICLES\nvarying vec4 projPosition;\nvarying float linearDepth;\n#endif\n\nvoid main() {\n float lengthFactor = velocity.w;\n // A flipped particle arrives with a negative size: the streak keeps its\n // extent and mirrors its texture instead (see quadUV below).\n float avgSize = (abs(size.x) + abs(size.y)) * 0.5;\n vec4 mvPosition = view * world * vec4(offset, 1.0);\n vec3 viewVelocity = mat3(view * world) * velocity.xyz;\n float vlength = length(viewVelocity);\n // Stretch direction is the velocity direction; only a genuinely motionless particle has none.\n // Deriving it via normalize keeps the stretch aligned even when the speed contribution is ~0\n // (e.g. speedFactor 0), instead of collapsing the whole burst onto a fixed screen axis.\n vec3 vdir = vlength > 0.000001 ? viewVelocity / vlength : vec3(0.0, 0.0, 1.0);\n vec3 side = normalize(cross(mvPosition.xyz, vdir));\n mvPosition.xyz += position.y * side * avgSize;\n // Equivalent to viewVelocity * (1.0 + lengthFactor / vlength) for moving particles, but the\n // size-based term (vdir * lengthFactor) survives when the velocity contribution vanishes.\n mvPosition.xyz -= (position.x + 0.5) * (viewVelocity + vdir * lengthFactor) * avgSize;\n#ifdef PIVOT\n // In particle-size units along the quad's own axes: x from head to tail, y across.\n mvPosition.xyz += (pivot.y * side - pivot.x * vdir) * avgSize;\n#endif\n gl_Position = projection * mvPosition;\n vec2 quadUV = vec2(size.x < 0.0 ? 1.0 - uv.x : uv.x, size.y < 0.0 ? 1.0 - uv.y : uv.y);\n#ifdef SOFT_PARTICLES\n projPosition = gl_Position;\n linearDepth = -mvPosition.z;\n#endif\n\n #ifdef UV_TILE\n vec2 tc = vec2(tileCountX, tileCountY);\n float baseTile = floor(uvTile);\n float tileU = mod(baseTile, tc.x) / tc.x;\n float tileV = 1.0 - floor(baseTile / tc.x) / tc.y - 1.0 / tc.y;\n vUV = quadUV / tc + vec2(tileU, tileV);\n #ifdef TILE_BLEND\n float nextTile = ceil(uvTile);\n float nextU = mod(nextTile, tc.x) / tc.x;\n float nextV = 1.0 - floor(nextTile / tc.x) / tc.y - 1.0 / tc.y;\n vUV2 = quadUV / tc + vec2(nextU, nextV);\n vTileBlend = fract(uvTile);\n #endif\n #else\n vUV = quadUV;\n #endif\n\n vColor = color;\n}\n";
|
|
2851
3680
|
|
|
2852
|
-
declare const _default$1: "\
|
|
3681
|
+
declare const _default$1: "\nvarying vec2 vUV;\nvarying vec4 vColor;\n\n#ifdef USE_MAP\nuniform sampler2D map;\n#endif\n\nvoid main() {\n vec4 baseColor = vColor;\n\n#ifdef USE_MAP\n vec4 texColor = texture2D(map, vUV);\n baseColor *= texColor;\n#endif\n\n if (baseColor.a < 0.01) discard;\n\n gl_FragColor = baseColor;\n}\n";
|
|
2853
3682
|
|
|
2854
|
-
declare const _default: "\nvarying vec2 vUV;\nvarying vec4 vColor;\n\
|
|
3683
|
+
declare const _default: "\nattribute vec3 position;\nattribute vec3 previous;\nattribute vec3 next;\nattribute float side;\nattribute float width;\nattribute vec2 uv;\nattribute vec4 color;\n\nuniform mat4 view;\nuniform mat4 projection;\nuniform float lineWidth;\nuniform vec2 resolution;\nuniform float sizeAttenuation;\n\nvarying vec2 vUV;\nvarying vec4 vColor;\n\nvec2 fix(vec4 i, float aspect) {\n vec2 res = i.xy / i.w;\n res.x *= aspect;\n return res;\n}\n\nvoid main() {\n float aspect = resolution.x / resolution.y;\n vec4 finalPosition = projection * view * vec4(position, 1.0);\n vec4 prevPos = projection * view * vec4(previous, 1.0);\n vec4 nextPos = projection * view * vec4(next, 1.0);\n\n vec2 currentP = fix(finalPosition, aspect);\n vec2 prevP = fix(prevPos, aspect);\n vec2 nextP = fix(nextPos, aspect);\n\n float w = lineWidth * width;\n vec2 dir;\n if (distance(nextP, currentP) < 0.0001) {\n dir = normalize(currentP - prevP);\n } else if (distance(prevP, currentP) < 0.0001) {\n dir = normalize(nextP - currentP);\n } else {\n vec2 dir1 = normalize(currentP - prevP);\n vec2 dir2 = normalize(nextP - currentP);\n dir = normalize(dir1 + dir2);\n }\n vec4 normal = vec4(-dir.y, dir.x, 0.0, 1.0);\n normal.xy *= 0.5 * w;\n normal *= projection;\n if (sizeAttenuation == 0.0) {\n normal.xy *= finalPosition.w;\n normal.xy /= (vec4(resolution, 0.0, 1.0) * projection).xy;\n }\n finalPosition.xy += normal.xy * side;\n gl_Position = finalPosition;\n vUV = uv;\n vColor = color;\n}\n";
|
|
2855
3684
|
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
3685
|
+
declare class SpriteBatch extends VFXBatch {
|
|
3686
|
+
private static whiteTextureByScene;
|
|
3687
|
+
/** 1×1 white map so mesh batches always have a sampler2D (iOS WebKit). */
|
|
3688
|
+
private static whiteTexture;
|
|
3689
|
+
private offsetBuffer;
|
|
3690
|
+
private rotationBuffer;
|
|
3691
|
+
private sizeBuffer;
|
|
3692
|
+
private colorBuffer;
|
|
3693
|
+
private uvTileBuffer;
|
|
3694
|
+
private velocityBuffer?;
|
|
3695
|
+
/** Concretely typed handle on the batch material, see syncStretchedSpeedFactor. */
|
|
3696
|
+
private shaderMaterial;
|
|
3697
|
+
private offsetVB;
|
|
3698
|
+
private rotationVB;
|
|
3699
|
+
private sizeVB;
|
|
3700
|
+
private colorVB;
|
|
3701
|
+
private uvTileVB;
|
|
3702
|
+
private velocityVB?;
|
|
3703
|
+
constructor(settings: VFXBatchSettings, scene: Scene);
|
|
3704
|
+
setupBuffers(): void;
|
|
3705
|
+
/** Releases the instance vertex buffers so a resize does not leak GPU memory. */
|
|
3706
|
+
private disposeExpandableBuffers;
|
|
3707
|
+
private buildExpandableBuffers;
|
|
3708
|
+
expandBuffers(target: number): void;
|
|
3709
|
+
rebuildMaterial(): void;
|
|
3710
|
+
private vector_;
|
|
3711
|
+
private vector2_;
|
|
3712
|
+
private vector3_;
|
|
3713
|
+
private quaternion_;
|
|
3714
|
+
private quaternion2_;
|
|
3715
|
+
private quaternion3_;
|
|
3716
|
+
private quaternion4_;
|
|
3717
|
+
private quaternion5_;
|
|
3718
|
+
private rotationMat_;
|
|
3719
|
+
private rotationMat2_;
|
|
3720
|
+
private lastStretchedSpeedFactor;
|
|
3721
|
+
/** Slot 0 holds the zero-alpha instance since the batch last went empty. */
|
|
3722
|
+
private clearedInstanceUploaded;
|
|
3723
|
+
update(): void;
|
|
3724
|
+
/**
|
|
3725
|
+
* Pushes the stretched-billboard speed factor to the shader when it changed.
|
|
3726
|
+
*
|
|
3727
|
+
* Deliberately kept out of `update`: touching the loosely typed
|
|
3728
|
+
* `mesh.material` from inside that function gives V8 a generic property
|
|
3729
|
+
* access it has no feedback for, which knocks the whole particle loop out of
|
|
3730
|
+
* optimised code on every frame.
|
|
3731
|
+
*/
|
|
3732
|
+
private syncStretchedSpeedFactor;
|
|
3733
|
+
/** The quads that take a pivot and flip: every billboard kind, stretched included, but not meshes. */
|
|
3734
|
+
private static takesPivotAndFlip;
|
|
3735
|
+
/**
|
|
3736
|
+
* Negates the size of each flipped particle along the axes it flips on,
|
|
3737
|
+
* starting at `base` in `sizes`. The billboard shader scales the quad by
|
|
3738
|
+
* the size, so a negative one mirrors it — and with it the texture, the
|
|
3739
|
+
* quad being centred — the way Unity's renderer Flip mirrors U and V. The
|
|
3740
|
+
* stretched shader reads the sign and mirrors the texture coordinates.
|
|
3741
|
+
*/
|
|
3742
|
+
private static applyFlip;
|
|
3743
|
+
/**
|
|
3744
|
+
* The fraction `f` of a turn, as a normalised lerp from no rotation toward
|
|
3745
|
+
* `step`, written into `out`.
|
|
3746
|
+
*
|
|
3747
|
+
* A true slerp would be exact, but `step` is one simulation step of turning
|
|
3748
|
+
* and `f` is below 1, so the arc being split is small enough that the lerp
|
|
3749
|
+
* is within a rounding error of it and costs a fraction as much.
|
|
3750
|
+
*/
|
|
3751
|
+
private static partialTurn;
|
|
3752
|
+
/**
|
|
3753
|
+
* Continues a three-component column by `fraction` of the step it just took,
|
|
3754
|
+
* never below zero.
|
|
3755
|
+
*
|
|
3756
|
+
* Size fades to nothing at the end of a life, so the last step before death
|
|
3757
|
+
* can point past zero; a negative size turns a sprite inside out.
|
|
3758
|
+
*/
|
|
3759
|
+
private static continueVector3;
|
|
3760
|
+
/** The same for colour, whose alpha runs out at the end of a life too. */
|
|
3761
|
+
private static continueColor;
|
|
3762
|
+
/**
|
|
3763
|
+
* Writes rows `[0, count)` of the store's positions into `target` at `base`,
|
|
3764
|
+
* each carried on by `fraction` of the step it just took.
|
|
3765
|
+
*
|
|
3766
|
+
* Continuing the measured last step covers every way a particle can move —
|
|
3767
|
+
* velocity integration, an orbit, noise, a plugin's own behavior — because
|
|
3768
|
+
* it reads what happened rather than predicting from one term of it. Over
|
|
3769
|
+
* less than a step it is a straight line through a path that may curve,
|
|
3770
|
+
* which for a sixtieth of a second is well under a pixel.
|
|
3771
|
+
*
|
|
3772
|
+
* A particle born during the step has the same position on both sides and
|
|
3773
|
+
* so does not move at all, which is what puts it at the emitter rather than
|
|
3774
|
+
* a step's travel away from it.
|
|
3775
|
+
*/
|
|
3776
|
+
private static extrapolate;
|
|
3777
|
+
/** Pushes a zero-alpha instance so stale instancing data cannot linger on screen. */
|
|
3778
|
+
private uploadClearedInstance;
|
|
3779
|
+
dispose(): void;
|
|
2860
3780
|
}
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
3781
|
+
|
|
3782
|
+
declare class TrailBatch extends VFXBatch {
|
|
3783
|
+
private positionBuffer;
|
|
3784
|
+
private previousBuffer;
|
|
3785
|
+
private nextBuffer;
|
|
3786
|
+
private uvBuffer;
|
|
3787
|
+
private sideBuffer;
|
|
3788
|
+
private widthBuffer;
|
|
3789
|
+
private colorBuffer;
|
|
3790
|
+
private indexBuffer;
|
|
3791
|
+
/** True while the batch is parked on the degenerate draw, see uploadGeometry. */
|
|
3792
|
+
private drawsNothing;
|
|
3793
|
+
private previousVB;
|
|
3794
|
+
private nextVB;
|
|
3795
|
+
private sideVB;
|
|
3796
|
+
private widthVB;
|
|
3797
|
+
constructor(settings: VFXBatchSettings, scene: Scene);
|
|
3798
|
+
setupBuffers(): void;
|
|
3799
|
+
private buildGeometryBuffers;
|
|
3800
|
+
expandBuffers(target: number): void;
|
|
3801
|
+
rebuildMaterial(): void;
|
|
3802
|
+
private vector_;
|
|
3803
|
+
private vector2_;
|
|
3804
|
+
private vector3_;
|
|
3805
|
+
private quaternion_;
|
|
3806
|
+
/** Forces the emitter's world matrix to be current before sampling it. */
|
|
3807
|
+
private static ensureWorldMatrix;
|
|
3808
|
+
update(): void;
|
|
3809
|
+
/**
|
|
3810
|
+
* Uploads the vertex data written by `update` and resizes the sub mesh.
|
|
3811
|
+
*
|
|
3812
|
+
* Split out of `update` on purpose: the Babylon mesh/sub-mesh plumbing here
|
|
3813
|
+
* runs a handful of times per frame, and folding it into the per-vertex loop
|
|
3814
|
+
* costs that loop its optimised code.
|
|
3815
|
+
*/
|
|
3816
|
+
private uploadGeometry;
|
|
3817
|
+
/**
|
|
3818
|
+
* Points every sub mesh at the mesh's own bounds.
|
|
3819
|
+
*
|
|
3820
|
+
* Updating indices rebuilds the sub meshes, and a fresh one computes its
|
|
3821
|
+
* bounds from the vertex data — which this batch keeps deliberately stale
|
|
3822
|
+
* beyond the range it draws. Transparent sorting reads those bounds every
|
|
3823
|
+
* frame, so they have to be replaced again after every index update, not
|
|
3824
|
+
* only when the geometry is built.
|
|
3825
|
+
*/
|
|
3826
|
+
private adoptMeshBounds;
|
|
3827
|
+
dispose(): void;
|
|
2864
3828
|
}
|
|
2865
3829
|
|
|
2866
|
-
export { ApplyCollision, ApplyForce, ApplySequences, AxisAngleGenerator, BatchedParticleRenderer, BatchedRenderer, BehaviorFromJSON, BehaviorTypes, Bezier, ChangeEmitDirection, CircleEmitter, ColorBySpeed, ColorGeneratorFromJSON, ColorOverLife, ColorRange, ConeEmitter, ConstantColor, ConstantValue, DEG2RAD, DonutEmitter, EmitSubParticleSystem, EmitterFromJSON, EmitterMode, EmitterShapes, Euler, EulerGenerator, ForceOverLife, FrameOverLife, GeneratorFromJSON, Gradient, GravityForce, GridEmitter, HemisphereEmitter, InheritVelocity, IntervalValue, LimitSpeedOverLife, MathUtils, Matrix3, Matrix4, MeshSurfaceEmitter, MeshSurfaceEmitterPlugin, NodeParticle, Noise, OrbitOverLife, ParticleEmitter, ParticleMeshPhysicsMaterial, ParticleMeshStandardMaterial, ParticleSystem, PiecewiseBezier, PiecewiseFunction, Plugins, PointEmitter, QuarksLoader, QuarksPrefab, QuarksUtil, Quaternion, RAD2DEG, RandomColor, RandomColorBetweenGradient, RandomQuatGenerator, RecordState, RectangleEmitter, RenderMode, Rotation3DOverLife, RotationBySpeed, RotationGeneratorFromJSON, RotationOverLife, SequencerFromJSON, SizeBySpeed, SizeOverLife, SpeedOverLife, SphereEmitter, SpriteBatch, SpriteParticle, SubParticleEmitMode, TextureSequencer, TrailBatch, TrailParticle, TurbulenceField, VFXBatch, ValueGeneratorFromJSON, Vector2, Vector3, Vector3Function, Vector3GeneratorFromJSON, Vector4, VelocityOverLife, WebGLCoordinateSystem, WebGPUCoordinateSystem, WidthOverLength, ceilPowerOfTwo, clamp, damp, degToRad, denormalize, euclideanModulo, floorPowerOfTwo, generateUUID, getPhysicsResolver, getRegisteredShaderChunks, getShaderChunk, getValueFromEmitterMode, inverseLerp, isPowerOfTwo, lerp, loadPlugin, _default$
|
|
2867
|
-
export type { AdaptivePerformanceOptions, AdaptivePerformanceState, AnimationData, BabylonMetaData, BabylonParticleMaterialParameters, Behavior, BehaviorPlugin, BillBoardSettings, BurstParameters, BurstParametersJSON, CircleEmitterParameters, ColorGenerator, ConeEmitterParameters, Constructable, DonutEmitterParameters, EmissionState, EmitterShape, EmitterShapePlugin, EulerOrder, FieldType, FunctionColorGenerator, FunctionJSON, FunctionValueGenerator, GeneratorMemory, GridEmitterParameters, HemisphereEmitterParameters, IAnimationData, IEmitter, IParticle, IParticleSystem, IPrefab, InheritVelocityMode, JsonMetaData, MeshSettings, ParameterPair, ParameterType, Particle, ParticleSystemEvent, ParticleSystemEventType, ParticleSystemJSONParameters, ParticleSystemParameters, Plugin, QuarksLoaderOptions, QuarksTimelineClip, RectangleEmitterParameters, RendererEmitterSettings, Resource, RotationGenerator, Sequencer, SerializationOptions, ShapeJSON, SphereEmitterParameters, StoredBatchSettings, StretchedBillBoardSettings, TrailSettings, VFXBatchSettings, ValueGenerator, Vector3Generator, VelocityOverLifeSpace };
|
|
3830
|
+
export { ApplyCollision, ApplyForce, ApplySequences, AxisAngleGenerator, BatchedParticleRenderer, BatchedRenderer, BehaviorFromJSON, BehaviorTypes, Bezier, BoxEmitFrom, BoxEmitter, ChangeEmitDirection, CircleEmitter, ColorBySpeed, ColorGeneratorFromJSON, ColorOverLife, ColorRange, ConeEmitter, ConstantColor, ConstantValue, DEG2RAD, DonutEmitter, EdgeEmitter, EmitSubParticleSystem, EmitterFromJSON, EmitterMode, EmitterShapes, Euler, EulerGenerator, ForceOverLife, FrameOverLife, GeneratorFromJSON, Gradient, GravityForce, GridEmitter, HemisphereEmitter, InheritVelocity, IntervalValue, LimitSpeedOverLife, MathUtils, Matrix3, Matrix4, MeshSurfaceEmitter, MeshSurfaceEmitterPlugin, NodeParticle, Noise, OrbitOverLife, ParticleEmitter, ParticleMeshPhysicsMaterial, ParticleMeshStandardMaterial, ParticleStore, ParticleSystem, PiecewiseBezier, PiecewiseFunction, Plugins, PointEmitter, QuarksLoader, QuarksPrefab, QuarksUtil, Quaternion, RAD2DEG, RandomColor, RandomColorBetweenGradient, RandomQuatGenerator, RecordState, RectangleEmitter, RenderMode, Rotation3DOverLife, RotationBySpeed, RotationGeneratorFromJSON, RotationOverLife, SequencerFromJSON, ShapeTransform, SizeBySpeed, SizeOverLife, SpeedOverLife, SphereEmitter, SpriteBatch, SpriteParticle, SubParticleEmitMode, TextureSequencer, TrailBatch, TrailParticle, TurbulenceField, VFXBatch, ValueGeneratorFromJSON, Vector2, Vector3, Vector3Function, Vector3GeneratorFromJSON, Vector3View, Vector4, Vector4View, VelocityOverLife, WebGLCoordinateSystem, WebGPUCoordinateSystem, WidthOverLength, cacheEnvAtlas, ceilPowerOfTwo, clamp, createEnvAtlasFromFaceUrls, cubeFaceUrls, damp, degToRad, denormalize, ensureEnvAtlasFromCube, euclideanModulo, floorPowerOfTwo, generateUUID, getCachedEnvAtlas, getPhysicsResolver, getRegisteredShaderChunks, getShaderChunk, getValueFromEmitterMode, inverseLerp, isPowerOfTwo, lerp, loadPlugin, _default$7 as localParticlePhysicsVertShader, _default$6 as localParticleVertShader, mapLinear, normalize, _default$5 as particleFragShader, _default$4 as particlePhysicsFragShader, _default$3 as particleVertShader, pingpong, planBehaviorFusion, radToDeg, randFloat, randFloatSpread, randInt, registerShaderChunks, seededRandom, setPhysicsResolver, setQuaternionFromProperEuler, smootherstep, smoothstep, _default$2 as stretchedBillboardVertShader, _default$1 as trailFragShader, _default as trailVertShader, unloadPlugin };
|
|
3831
|
+
export type { AdaptivePerformanceOptions, AdaptivePerformanceState, AnimationData, BabylonMetaData, BabylonParticleMaterialParameters, Behavior, BehaviorPlugin, BillBoardSettings, BoxEmitterParameters, BurstParameters, BurstParametersJSON, CircleEmitterParameters, ColorGenerator, ConeEmitterParameters, Constructable, DonutEmitterParameters, EdgeEmitterParameters, EmissionState, EmitterShape, EmitterShapePlugin, EulerOrder, FieldType, FunctionColorGenerator, FunctionJSON, FunctionValueGenerator, FusedPass, FusionStep, GeneratorMemory, GridEmitterParameters, HemisphereEmitterParameters, IAnimationData, IEmitter, IParticle, IParticleSystem, IPrefab, InheritVelocityMode, JsonMetaData, MeshSettings, ParameterPair, ParameterType, Particle, ParticleSystemEvent, ParticleSystemEventType, ParticleSystemJSONParameters, ParticleSystemParameters, Plugin, QuarksLoaderOptions, QuarksTimelineClip, RectangleEmitterParameters, RendererEmitterSettings, Resource, RotationGenerator, Sequencer, SerializationOptions, ShapeJSON, ShapeTransformJSON, SphereEmitterParameters, StoredBatchSettings, StretchedBillBoardSettings, TrailSettings, VFXBatchSettings, ValueGenerator, Vector3Generator, VelocityOverLifeSpace };
|