rapid-render 0.1.0 → 0.1.2-1.1
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/README.md +59 -97
- package/dist/assets.d.ts +92 -0
- package/dist/audio.d.ts +59 -0
- package/dist/depth.d.ts +8 -0
- package/dist/game.d.ts +292 -0
- package/dist/index.d.ts +9 -3
- package/dist/input.d.ts +93 -0
- package/dist/interface.d.ts +337 -32
- package/dist/light.d.ts +7 -0
- package/dist/line.d.ts +15 -2
- package/dist/log.d.ts +2 -0
- package/dist/math.d.ts +272 -45
- package/dist/particle.d.ts +73 -0
- package/dist/rapid.global.js +1 -1
- package/dist/rapid.js +1 -1
- package/dist/rapid.umd.cjs +1 -1
- package/dist/regions/attributes.d.ts +44 -0
- package/dist/regions/graphic_region.d.ts +7 -20
- package/dist/regions/region.d.ts +23 -7
- package/dist/regions/sprite_region.d.ts +5 -26
- package/dist/render.d.ts +159 -45
- package/dist/texture.d.ts +105 -13
- package/dist/tilemap.d.ts +98 -0
- package/dist/utils.d.ts +106 -0
- package/dist/webgl/glshader.d.ts +15 -4
- package/dist/webgl/uniform.d.ts +14 -0
- package/dist/webgl/utils.d.ts +11 -1
- package/package.json +11 -5
package/dist/math.d.ts
CHANGED
|
@@ -1,15 +1,28 @@
|
|
|
1
|
-
import { WebGLContext } from "./interface";
|
|
2
|
-
|
|
1
|
+
import { IMathObject, ITransformOptions, WebGLContext } from "./interface";
|
|
2
|
+
/**
|
|
3
|
+
* @ignore
|
|
4
|
+
*/
|
|
5
|
+
export declare enum ArrayType {
|
|
6
|
+
Float32 = 0,
|
|
7
|
+
Uint32 = 1,
|
|
8
|
+
Uint16 = 2
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* @ignore
|
|
12
|
+
*/
|
|
3
13
|
export declare class DynamicArrayBuffer {
|
|
4
14
|
usedElemNum: number;
|
|
5
|
-
protected typedArray: Float32Array | Uint16Array;
|
|
15
|
+
protected typedArray: Float32Array | Uint32Array | Uint16Array;
|
|
6
16
|
private arrayType;
|
|
7
17
|
protected maxElemNum: number;
|
|
8
18
|
readonly bytePerElem: number;
|
|
9
19
|
private arraybuffer;
|
|
10
|
-
/** if typedArray is Float32Array*/
|
|
11
20
|
private uint32?;
|
|
21
|
+
private float32?;
|
|
22
|
+
private uint16?;
|
|
12
23
|
constructor(arrayType: ArrayType);
|
|
24
|
+
getArrayType(arrayType: ArrayType): Uint16ArrayConstructor | Uint32ArrayConstructor | Float32ArrayConstructor;
|
|
25
|
+
updateTypedArray(): void;
|
|
13
26
|
clear(): void;
|
|
14
27
|
/**
|
|
15
28
|
* resize the array
|
|
@@ -18,12 +31,9 @@ export declare class DynamicArrayBuffer {
|
|
|
18
31
|
*/
|
|
19
32
|
resize(size?: number): void;
|
|
20
33
|
protected setMaxSize(size?: number): void;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
*/
|
|
25
|
-
push(value: number): void;
|
|
26
|
-
pushUint(value: number): void;
|
|
34
|
+
pushUint32(value: number): void;
|
|
35
|
+
pushFloat32(value: number): void;
|
|
36
|
+
pushUint16(value: number): void;
|
|
27
37
|
/**
|
|
28
38
|
* pop a element
|
|
29
39
|
* @param num
|
|
@@ -35,12 +45,15 @@ export declare class DynamicArrayBuffer {
|
|
|
35
45
|
* @param end
|
|
36
46
|
* @returns
|
|
37
47
|
*/
|
|
38
|
-
getArray(begin?: number, end?: number): Uint16Array | Float32Array;
|
|
48
|
+
getArray(begin?: number, end?: number): Uint16Array | Uint32Array | Float32Array;
|
|
39
49
|
/**
|
|
40
50
|
* length of the array
|
|
41
51
|
*/
|
|
42
52
|
get length(): number;
|
|
43
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* @ignore
|
|
56
|
+
*/
|
|
44
57
|
export declare class WebglBufferArray extends DynamicArrayBuffer {
|
|
45
58
|
buffer: WebGLBuffer;
|
|
46
59
|
gl: WebGLContext;
|
|
@@ -50,8 +63,11 @@ export declare class WebglBufferArray extends DynamicArrayBuffer {
|
|
|
50
63
|
* webglbuffer 中的大小
|
|
51
64
|
*/
|
|
52
65
|
private webglBufferSize;
|
|
53
|
-
|
|
54
|
-
|
|
66
|
+
readonly usage: number;
|
|
67
|
+
constructor(gl: WebGLContext, arrayType: ArrayType, type?: number, usage?: number);
|
|
68
|
+
pushFloat32(value: number): void;
|
|
69
|
+
pushUint32(value: number): void;
|
|
70
|
+
pushUint16(value: number): void;
|
|
55
71
|
/**
|
|
56
72
|
* bind buffer to gpu
|
|
57
73
|
*/
|
|
@@ -80,7 +96,7 @@ export declare class MatrixStack extends DynamicArrayBuffer {
|
|
|
80
96
|
* @param x - The amount to translate horizontally.
|
|
81
97
|
* @param y - The amount to translate vertically.
|
|
82
98
|
*/
|
|
83
|
-
translate(x: number | Vec2, y
|
|
99
|
+
translate(x: number | Vec2, y?: number): void;
|
|
84
100
|
/**
|
|
85
101
|
* Rotates the current matrix by the specified angle.
|
|
86
102
|
* @param angle - The angle, in radians, to rotate the matrix by.
|
|
@@ -96,7 +112,7 @@ export declare class MatrixStack extends DynamicArrayBuffer {
|
|
|
96
112
|
* Transforms a point by applying the current matrix stack.
|
|
97
113
|
* @returns The transformed point as an array `[newX, newY]`.
|
|
98
114
|
*/
|
|
99
|
-
apply(x: number | Vec2, y
|
|
115
|
+
apply(x: number | Vec2, y?: number): Vec2 | number[];
|
|
100
116
|
/**
|
|
101
117
|
* Obtain the inverse matrix of the current matrix
|
|
102
118
|
* @returns inverse matrix
|
|
@@ -112,7 +128,63 @@ export declare class MatrixStack extends DynamicArrayBuffer {
|
|
|
112
128
|
* @param array
|
|
113
129
|
*/
|
|
114
130
|
setTransform(array: Float32Array | number[]): void;
|
|
131
|
+
/**
|
|
132
|
+
* Get the global position in world space
|
|
133
|
+
* @returns The current matrix position in world space
|
|
134
|
+
*/
|
|
135
|
+
getGlobalPosition(): Vec2;
|
|
136
|
+
/**
|
|
137
|
+
* Set the global position in world space
|
|
138
|
+
* @param x - x coordinate or Vec2 object
|
|
139
|
+
* @param y - y coordinate (ignored if first parameter is Vec2)
|
|
140
|
+
*/
|
|
141
|
+
setGlobalPosition(x: number | Vec2, y?: number): void;
|
|
142
|
+
/**
|
|
143
|
+
* Get the global rotation angle
|
|
144
|
+
* @returns The current matrix rotation angle in radians
|
|
145
|
+
*/
|
|
146
|
+
getGlobalRotation(): number;
|
|
147
|
+
/**
|
|
148
|
+
* Set the global rotation angle
|
|
149
|
+
* @param angle - rotation angle in radians
|
|
150
|
+
*/
|
|
151
|
+
setGlobalRotation(angle: number): void;
|
|
152
|
+
/**
|
|
153
|
+
* Get the global scale
|
|
154
|
+
* @returns The current matrix scale values
|
|
155
|
+
*/
|
|
156
|
+
getGlobalScale(): Vec2;
|
|
157
|
+
/**
|
|
158
|
+
* Set the global scale
|
|
159
|
+
* @param x - x scale or Vec2 object
|
|
160
|
+
* @param y - y scale (ignored if first parameter is Vec2)
|
|
161
|
+
*/
|
|
162
|
+
setGlobalScale(x: number | Vec2, y?: number): void;
|
|
163
|
+
globalToLocal(global: Vec2): Vec2;
|
|
164
|
+
localToGlobal(local: Vec2): Vec2;
|
|
165
|
+
/**
|
|
166
|
+
* Convert the current matrix to a CSS transform string
|
|
167
|
+
* @returns CSS transform string representation of the matrix
|
|
168
|
+
*/
|
|
169
|
+
toCSSTransform(): string;
|
|
170
|
+
/**
|
|
171
|
+
* Reset the current matrix to identity matrix
|
|
172
|
+
*/
|
|
173
|
+
identity(): void;
|
|
174
|
+
/**
|
|
175
|
+
* Apply the transform to the current matrix
|
|
176
|
+
* @param transform - The transform to apply
|
|
177
|
+
* @returns offset position
|
|
178
|
+
*/
|
|
179
|
+
applyTransform(transform: ITransformOptions, width?: number, height?: number): {
|
|
180
|
+
offsetX: number;
|
|
181
|
+
offsetY: number;
|
|
182
|
+
};
|
|
183
|
+
applyTransformAfter(transform: ITransformOptions): void;
|
|
115
184
|
}
|
|
185
|
+
/**
|
|
186
|
+
* @ignore
|
|
187
|
+
*/
|
|
116
188
|
export declare class WebglElementBufferArray extends WebglBufferArray {
|
|
117
189
|
constructor(gl: WebGLContext, elemVertPerObj: number, vertexPerObject: number, maxBatch: number);
|
|
118
190
|
protected addObject(_vertex?: number): void;
|
|
@@ -120,7 +192,7 @@ export declare class WebglElementBufferArray extends WebglBufferArray {
|
|
|
120
192
|
/**
|
|
121
193
|
* Represents a color with red, green, blue, and alpha (transparency) components.
|
|
122
194
|
*/
|
|
123
|
-
export declare class Color {
|
|
195
|
+
export declare class Color implements IMathObject<Color> {
|
|
124
196
|
private _r;
|
|
125
197
|
private _g;
|
|
126
198
|
private _b;
|
|
@@ -133,7 +205,7 @@ export declare class Color {
|
|
|
133
205
|
* @param b - The blue component (0-255).
|
|
134
206
|
* @param a - The alpha component (0-255).
|
|
135
207
|
*/
|
|
136
|
-
constructor(r: number, g: number, b: number, a
|
|
208
|
+
constructor(r: number, g: number, b: number, a?: number);
|
|
137
209
|
/**
|
|
138
210
|
* Gets the red component.
|
|
139
211
|
*/
|
|
@@ -188,12 +260,17 @@ export declare class Color {
|
|
|
188
260
|
* @param color - The color to copy from.
|
|
189
261
|
*/
|
|
190
262
|
copy(color: Color): void;
|
|
263
|
+
/**
|
|
264
|
+
* Clone the current color
|
|
265
|
+
* @returns A new `Color` instance with the same RGBA values.
|
|
266
|
+
*/
|
|
267
|
+
clone(): Color;
|
|
191
268
|
/**
|
|
192
269
|
* Checks if the current color is equal to another color.
|
|
193
270
|
* @param color - The color to compare with.
|
|
194
271
|
* @returns True if the colors are equal, otherwise false.
|
|
195
272
|
*/
|
|
196
|
-
|
|
273
|
+
equal(color: Color): boolean;
|
|
197
274
|
/**
|
|
198
275
|
* Creates a Color instance from a hexadecimal color string.
|
|
199
276
|
* @param hexString - The hexadecimal color string, e.g., '#RRGGBB' or '#RRGGBBAA'.
|
|
@@ -212,25 +289,102 @@ export declare class Color {
|
|
|
212
289
|
* @returns A new Color instance with the result of the subtraction.
|
|
213
290
|
*/
|
|
214
291
|
subtract(color: Color): Color;
|
|
292
|
+
divide(color: Color | number): Color;
|
|
293
|
+
multiply(color: Color | number): Color;
|
|
294
|
+
clamp(): void;
|
|
295
|
+
static Red: Color;
|
|
296
|
+
static Green: Color;
|
|
297
|
+
static Blue: Color;
|
|
298
|
+
static Yellow: Color;
|
|
299
|
+
static Purple: Color;
|
|
300
|
+
static Orange: Color;
|
|
301
|
+
static Pink: Color;
|
|
302
|
+
static Gray: Color;
|
|
303
|
+
static Brown: Color;
|
|
304
|
+
static Cyan: Color;
|
|
305
|
+
static Magenta: Color;
|
|
306
|
+
static Lime: Color;
|
|
307
|
+
static White: Color;
|
|
308
|
+
static Black: Color;
|
|
309
|
+
static TRANSPARENT: Color;
|
|
215
310
|
}
|
|
216
311
|
/**
|
|
217
312
|
* Represents a 2D vector with x and y components.
|
|
218
313
|
*/
|
|
219
|
-
export declare class Vec2 {
|
|
314
|
+
export declare class Vec2 implements IMathObject<Vec2> {
|
|
220
315
|
x: number;
|
|
221
316
|
y: number;
|
|
317
|
+
static ZERO: Vec2;
|
|
318
|
+
static ONE: Vec2;
|
|
319
|
+
static UP: Vec2;
|
|
320
|
+
static DOWN: Vec2;
|
|
321
|
+
static LEFT: Vec2;
|
|
322
|
+
static RIGHT: Vec2;
|
|
222
323
|
/**
|
|
223
324
|
* Creates an instance of Vec2.
|
|
224
325
|
* @param x - The x coordinate (default is 0).
|
|
225
326
|
* @param y - The y coordinate (default is 0).
|
|
226
327
|
*/
|
|
227
328
|
constructor(x?: number, y?: number);
|
|
329
|
+
set(x: number | number[], y?: number): this;
|
|
228
330
|
/**
|
|
229
|
-
*
|
|
230
|
-
* @param
|
|
231
|
-
* @returns
|
|
331
|
+
* Adds another vector to this vector.
|
|
332
|
+
* @param v - The vector to add.
|
|
333
|
+
* @returns A new Vec2 instance with the result of the addition.
|
|
334
|
+
*/
|
|
335
|
+
add(v: Vec2): Vec2;
|
|
336
|
+
/**
|
|
337
|
+
* Subtracts another vector from this vector.
|
|
338
|
+
* @param v - The vector to subtract.
|
|
339
|
+
* @returns A new Vec2 instance with the result of the subtraction.
|
|
340
|
+
*/
|
|
341
|
+
subtract(v: Vec2): Vec2;
|
|
342
|
+
/**
|
|
343
|
+
* Multiplies the vector by a scalar or another vector.
|
|
344
|
+
* @param f - The scalar value or vector to multiply by.
|
|
345
|
+
* @returns A new Vec2 instance with the result of the multiplication.
|
|
346
|
+
*/
|
|
347
|
+
multiply(f: number | Vec2): Vec2;
|
|
348
|
+
/**
|
|
349
|
+
* Divides the vector by a scalar or another vector.
|
|
350
|
+
* @param f - The scalar value or vector to divide by.
|
|
351
|
+
* @returns A new Vec2 instance with the result of the division.
|
|
352
|
+
*/
|
|
353
|
+
divide(f: number | Vec2): Vec2;
|
|
354
|
+
/**
|
|
355
|
+
* Calculates the dot product of this vector with another vector.
|
|
356
|
+
* @param v - The other vector.
|
|
357
|
+
* @returns The dot product result.
|
|
358
|
+
*/
|
|
359
|
+
dot(v: Vec2): number;
|
|
360
|
+
/**
|
|
361
|
+
* Calculates the cross product of this vector with another vector.
|
|
362
|
+
* @param v - The other vector.
|
|
363
|
+
* @returns The cross product result.
|
|
364
|
+
*/
|
|
365
|
+
cross(v: Vec2): number;
|
|
366
|
+
/**
|
|
367
|
+
* Calculates the distance to another point.
|
|
368
|
+
* @param v - The other point.
|
|
369
|
+
* @returns The distance between the two points.
|
|
370
|
+
*/
|
|
371
|
+
distanceTo(v: Vec2): number;
|
|
372
|
+
/**
|
|
373
|
+
* Clones the vector.
|
|
374
|
+
* @returns A new Vec2 instance with the same x and y values.
|
|
375
|
+
*/
|
|
376
|
+
clone(): Vec2;
|
|
377
|
+
/**
|
|
378
|
+
* Copy the vector
|
|
379
|
+
* @param vec - The vector to copy.
|
|
380
|
+
*/
|
|
381
|
+
copy(vec: Vec2): void;
|
|
382
|
+
/**
|
|
383
|
+
* Check if the vector is equal to another vector.
|
|
384
|
+
* @param vec - The vector to compare with.
|
|
385
|
+
* @returns True if the vectors are equal, otherwise false.
|
|
232
386
|
*/
|
|
233
|
-
|
|
387
|
+
equal(vec: Vec2): boolean;
|
|
234
388
|
/**
|
|
235
389
|
* Rotates the vector 90 degrees counterclockwise.
|
|
236
390
|
* @returns The current instance with updated values.
|
|
@@ -257,38 +411,111 @@ export declare class Vec2 {
|
|
|
257
411
|
*/
|
|
258
412
|
angle(): number;
|
|
259
413
|
/**
|
|
260
|
-
*
|
|
261
|
-
* @param
|
|
262
|
-
* @
|
|
263
|
-
|
|
414
|
+
* Calculates the middle point between the current vector and another vector.
|
|
415
|
+
* @param other - The other vector.
|
|
416
|
+
* @returns A new vector representing the middle point between the current vector and the other vector.
|
|
417
|
+
*/
|
|
418
|
+
middle(other: Vec2): Vec2;
|
|
419
|
+
/**
|
|
420
|
+
* Returns a new vector with the absolute values of the components.
|
|
421
|
+
* @returns A new vector with absolute values.
|
|
422
|
+
*/
|
|
423
|
+
abs(): Vec2;
|
|
424
|
+
/**
|
|
425
|
+
* Returns a new vector with floored components.
|
|
426
|
+
* @returns A new vector with components rounded down to the nearest integer.
|
|
264
427
|
*/
|
|
265
|
-
|
|
428
|
+
floor(): Vec2;
|
|
266
429
|
/**
|
|
267
|
-
*
|
|
268
|
-
* @
|
|
269
|
-
* @param p1 - The second vector.
|
|
270
|
-
* @returns A new vector representing the sum of p0 and p1.
|
|
430
|
+
* Returns a new vector with ceiled components.
|
|
431
|
+
* @returns A new vector with components rounded up to the nearest integer.
|
|
271
432
|
*/
|
|
272
|
-
|
|
433
|
+
ceil(): Vec2;
|
|
273
434
|
/**
|
|
274
|
-
*
|
|
275
|
-
* @param
|
|
276
|
-
* @
|
|
277
|
-
* @returns A new vector representing the difference between p1 and p0.
|
|
435
|
+
* Snaps the vector components to the nearest increment.
|
|
436
|
+
* @param increment - The increment to snap to.
|
|
437
|
+
* @returns A new vector with components snapped to the nearest increment.
|
|
278
438
|
*/
|
|
279
|
-
|
|
439
|
+
snap(increment: number): Vec2;
|
|
280
440
|
/**
|
|
281
|
-
*
|
|
282
|
-
* @
|
|
283
|
-
* @param p1 - The second vector.
|
|
284
|
-
* @returns A new vector representing the midpoint between p0 and p1.
|
|
441
|
+
* Converts the vector to a string representation.
|
|
442
|
+
* @returns A string containing the vector's x and y coordinates.
|
|
285
443
|
*/
|
|
286
|
-
|
|
444
|
+
stringify(): string;
|
|
287
445
|
/**
|
|
288
446
|
* Converts an array of coordinate pairs into an array of Vec2 instances.
|
|
289
447
|
* @param array - An array of [x, y] coordinate pairs.
|
|
290
448
|
* @returns An array of Vec2 instances.
|
|
291
449
|
*/
|
|
292
|
-
static
|
|
450
|
+
static FromArray(array: number[][]): Vec2[];
|
|
451
|
+
static fromAngle(angle: number): Vec2;
|
|
452
|
+
/**
|
|
453
|
+
* Calculates the angle between two vectors.
|
|
454
|
+
* @param v - The other vector.
|
|
455
|
+
* @returns The angle between the two vectors in radians.
|
|
456
|
+
*/
|
|
457
|
+
angleBetween(v: Vec2): number;
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Provides utility methods for mathematical conversions.
|
|
461
|
+
*/
|
|
462
|
+
export declare class MathUtils {
|
|
463
|
+
/**
|
|
464
|
+
* Converts degrees to radians.
|
|
465
|
+
* @param degrees - The angle in degrees.
|
|
466
|
+
* @returns The equivalent angle in radians.
|
|
467
|
+
*/
|
|
468
|
+
static deg2rad(degrees: number): number;
|
|
469
|
+
/**
|
|
470
|
+
* Converts radians to degrees.
|
|
471
|
+
* @param rad - The angle in radians.
|
|
472
|
+
* @returns The equivalent angle in degrees.
|
|
473
|
+
*/
|
|
474
|
+
static rad2deg(rad: number): number;
|
|
475
|
+
/**
|
|
476
|
+
* Normalizes an angle in degrees to be within the range of 0 to 360 degrees.
|
|
477
|
+
* @param degrees - The angle in degrees to be normalized.
|
|
478
|
+
* @returns The normalized angle in degrees.
|
|
479
|
+
*/
|
|
480
|
+
static normalizeDegrees(degrees: number): number;
|
|
481
|
+
}
|
|
482
|
+
export declare class Random {
|
|
483
|
+
/**
|
|
484
|
+
* 生成指定范围内的随机浮点数
|
|
485
|
+
* @param min - 最小值
|
|
486
|
+
* @param max - 最大值
|
|
487
|
+
* @returns 随机浮点数
|
|
488
|
+
*/
|
|
489
|
+
static float(min: number, max: number): number;
|
|
490
|
+
/**
|
|
491
|
+
* 生成指定范围内的随机整数
|
|
492
|
+
* @param min - 最小值
|
|
493
|
+
* @param max - 最大值
|
|
494
|
+
* @returns 随机整数
|
|
495
|
+
*/
|
|
496
|
+
static int(min: number, max: number): number;
|
|
497
|
+
/**
|
|
498
|
+
* 生成随机角度(0-360度)
|
|
499
|
+
* @returns 随机角度(弧度)
|
|
500
|
+
*/
|
|
501
|
+
static angle(): number;
|
|
502
|
+
/**
|
|
503
|
+
* 生成指定范围内的随机向量
|
|
504
|
+
* @param minX - 最小X值
|
|
505
|
+
* @param maxX - 最大X值
|
|
506
|
+
* @param minY - 最小Y值
|
|
507
|
+
* @param maxY - 最大Y值
|
|
508
|
+
* @returns 随机向量
|
|
509
|
+
*/
|
|
510
|
+
static vector(minX: number, maxX: number, minY: number, maxY: number): Vec2;
|
|
511
|
+
/**
|
|
512
|
+
* 生成具有随机方向和指定长度的向量
|
|
513
|
+
* @param length - 向量长度
|
|
514
|
+
* @returns 随机方向向量
|
|
515
|
+
*/
|
|
516
|
+
static direction(length: number): Vec2;
|
|
517
|
+
static randomColor(minColor: Color, maxColor: Color): Color;
|
|
518
|
+
static pick(array: any[]): any;
|
|
519
|
+
static pickWeight(array: [any, number][]): any;
|
|
520
|
+
static scalarOrRange<T extends number | Vec2 | Color>(range?: T | [T, T], defaultValue?: T): T;
|
|
293
521
|
}
|
|
294
|
-
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import Rapid from "./render";
|
|
2
|
+
import { IParticleOptions, ITransformOptions } from "./interface";
|
|
3
|
+
import { Vec2 } from "./math";
|
|
4
|
+
/**
|
|
5
|
+
* Particle emitter for creating and managing particle systems
|
|
6
|
+
*/
|
|
7
|
+
export declare class ParticleEmitter {
|
|
8
|
+
private rapid;
|
|
9
|
+
private particles;
|
|
10
|
+
private options;
|
|
11
|
+
private emitting;
|
|
12
|
+
private emitTimer;
|
|
13
|
+
private emitRate;
|
|
14
|
+
private emitTime;
|
|
15
|
+
private emitTimeCounter;
|
|
16
|
+
localSpace: boolean;
|
|
17
|
+
position: Vec2;
|
|
18
|
+
/**
|
|
19
|
+
* Creates a new particle emitter
|
|
20
|
+
* @param rapid - The Rapid renderer instance
|
|
21
|
+
* @param options - Emitter configuration options
|
|
22
|
+
*/
|
|
23
|
+
constructor(rapid: Rapid, options: IParticleOptions);
|
|
24
|
+
/**
|
|
25
|
+
* Gets the transform options
|
|
26
|
+
*/
|
|
27
|
+
getTransform(): ITransformOptions;
|
|
28
|
+
/**
|
|
29
|
+
* Sets particle emission rate
|
|
30
|
+
* @param rate - Particles per second
|
|
31
|
+
*/
|
|
32
|
+
setEmitRate(rate: number): void;
|
|
33
|
+
/**
|
|
34
|
+
* Sets time interval between emissions
|
|
35
|
+
* @param time - Time interval in seconds
|
|
36
|
+
*/
|
|
37
|
+
setEmitTime(time: number): void;
|
|
38
|
+
/**
|
|
39
|
+
* Starts emitting particles
|
|
40
|
+
*/
|
|
41
|
+
start(): void;
|
|
42
|
+
/**
|
|
43
|
+
* Stops emitting new particles but allows existing ones to complete their lifecycle
|
|
44
|
+
*/
|
|
45
|
+
stop(): void;
|
|
46
|
+
/**
|
|
47
|
+
* Clears all particles and resets the emitter
|
|
48
|
+
*/
|
|
49
|
+
clear(): void;
|
|
50
|
+
/**
|
|
51
|
+
* Emits specified number of particles
|
|
52
|
+
* @param count - Number of particles to emit
|
|
53
|
+
*/
|
|
54
|
+
emit(count: number): void;
|
|
55
|
+
/**
|
|
56
|
+
* Updates particle emitter state
|
|
57
|
+
* @param deltaTime - Time in seconds since last update
|
|
58
|
+
*/
|
|
59
|
+
update(deltaTime: number): void;
|
|
60
|
+
/**
|
|
61
|
+
* Renders all particles
|
|
62
|
+
*/
|
|
63
|
+
render(): void;
|
|
64
|
+
/**
|
|
65
|
+
* Gets current particle count
|
|
66
|
+
*/
|
|
67
|
+
getParticleCount(): number;
|
|
68
|
+
/**
|
|
69
|
+
* Checks if the particle emitter is active (has particles or is emitting)
|
|
70
|
+
*/
|
|
71
|
+
isActive(): boolean;
|
|
72
|
+
oneShot(): void;
|
|
73
|
+
}
|