@galacean/engine-core 2.0.0-alpha.35 → 2.0.0-alpha.37
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/dist/main.js +582 -7
- package/dist/main.js.map +1 -1
- package/dist/module.js +579 -8
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/particle/ParticleGenerator.d.ts +17 -1
- package/types/particle/enums/ParticleSubEmitterInheritProperty.d.ts +17 -0
- package/types/particle/enums/ParticleSubEmitterType.d.ts +9 -0
- package/types/particle/index.d.ts +4 -0
- package/types/particle/modules/ParticleCompositeGradient.d.ts +1 -0
- package/types/particle/modules/ParticleGeneratorModule.d.ts +0 -2
- package/types/particle/modules/SubEmitter.d.ts +27 -0
- package/types/particle/modules/SubEmittersModule.d.ts +36 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@galacean/engine-core",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.37",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
"types/**/*"
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@galacean/engine-math": "2.0.0-alpha.
|
|
21
|
+
"@galacean/engine-math": "2.0.0-alpha.37"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@galacean/engine-design": "2.0.0-alpha.
|
|
24
|
+
"@galacean/engine-design": "2.0.0-alpha.37"
|
|
25
25
|
},
|
|
26
26
|
"scripts": {
|
|
27
27
|
"b:types": "tsc"
|
|
@@ -10,6 +10,7 @@ import { SizeOverLifetimeModule } from "./modules/SizeOverLifetimeModule";
|
|
|
10
10
|
import { TextureSheetAnimationModule } from "./modules/TextureSheetAnimationModule";
|
|
11
11
|
import { NoiseModule } from "./modules/NoiseModule";
|
|
12
12
|
import { VelocityOverLifetimeModule } from "./modules/VelocityOverLifetimeModule";
|
|
13
|
+
import { SubEmittersModule } from "./modules/SubEmittersModule";
|
|
13
14
|
/**
|
|
14
15
|
* Particle Generator.
|
|
15
16
|
*/
|
|
@@ -21,7 +22,8 @@ export declare class ParticleGenerator {
|
|
|
21
22
|
private static _tempVector31;
|
|
22
23
|
private static _tempVector32;
|
|
23
24
|
private static _tempMat;
|
|
24
|
-
private static
|
|
25
|
+
private static _tempColor;
|
|
26
|
+
private static _tempQuat0;
|
|
25
27
|
private static _tempParticleRenderers;
|
|
26
28
|
private static readonly _particleIncreaseCount;
|
|
27
29
|
private static readonly _transformedBoundsIncreaseCount;
|
|
@@ -48,8 +50,11 @@ export declare class ParticleGenerator {
|
|
|
48
50
|
readonly textureSheetAnimation: TextureSheetAnimationModule;
|
|
49
51
|
/** Noise module. */
|
|
50
52
|
readonly noise: NoiseModule;
|
|
53
|
+
/** Sub emitters module. */
|
|
54
|
+
readonly subEmitters: SubEmittersModule;
|
|
51
55
|
/** Custom data module. */
|
|
52
56
|
readonly customData: CustomDataModule;
|
|
57
|
+
private _feedbackReadback;
|
|
53
58
|
private _isPlaying;
|
|
54
59
|
private _instanceBufferResized;
|
|
55
60
|
private _waitProcessRetiredElementCount;
|
|
@@ -61,6 +66,13 @@ export declare class ParticleGenerator {
|
|
|
61
66
|
private _firstActiveTransformedBoundingBox;
|
|
62
67
|
private _firstFreeTransformedBoundingBox;
|
|
63
68
|
private _playStartDelay;
|
|
69
|
+
private _eventPos;
|
|
70
|
+
private _eventColor;
|
|
71
|
+
private _eventSize;
|
|
72
|
+
private _eventRotation;
|
|
73
|
+
private _eventDir;
|
|
74
|
+
private _emitLocalPos;
|
|
75
|
+
private _emitDirection;
|
|
64
76
|
/**
|
|
65
77
|
* Whether the particle generator is contain alive or is still creating particles.
|
|
66
78
|
*/
|
|
@@ -91,9 +103,13 @@ export declare class ParticleGenerator {
|
|
|
91
103
|
*/
|
|
92
104
|
emit(count: number): void;
|
|
93
105
|
private _addNewParticle;
|
|
106
|
+
private _onParticleBirth;
|
|
94
107
|
private _addFeedbackParticle;
|
|
95
108
|
private _clearActiveParticles;
|
|
96
109
|
private _retireActiveParticles;
|
|
110
|
+
private _readbackFeedback;
|
|
111
|
+
private _onParticleDeath;
|
|
112
|
+
private _evaluateOverLifetime;
|
|
97
113
|
private _freeRetiredParticles;
|
|
98
114
|
private _addActiveParticlesToVertexBuffer;
|
|
99
115
|
private _addVertexBufferBindingsFilterDuplicate;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Optional parent properties a sub-emitter inherits
|
|
3
|
+
* Sub particles are always emitted at the parent particle's position; these flags only select
|
|
4
|
+
* which additional properties are inherited on top of that.
|
|
5
|
+
*/
|
|
6
|
+
export declare enum ParticleSubEmitterInheritProperty {
|
|
7
|
+
/** Inherit no additional properties; sub particles are still emitted at the parent's position. */
|
|
8
|
+
None = 0,
|
|
9
|
+
/** Multiply parent's current color into the sub particle's start color. */
|
|
10
|
+
Color = 1,
|
|
11
|
+
/** Multiply parent's current size into the sub particle's start size. */
|
|
12
|
+
Size = 2,
|
|
13
|
+
/** Add parent's current rotation onto the sub particle's start rotation. */
|
|
14
|
+
Rotation = 4,
|
|
15
|
+
/** Emit the sub particle along the parent's velocity direction. */
|
|
16
|
+
Velocity = 8
|
|
17
|
+
}
|
|
@@ -7,6 +7,8 @@ export { ParticleRenderMode } from "./enums/ParticleRenderMode";
|
|
|
7
7
|
export { ParticleScaleMode } from "./enums/ParticleScaleMode";
|
|
8
8
|
export { ParticleSimulationSpace } from "./enums/ParticleSimulationSpace";
|
|
9
9
|
export { ParticleStopMode } from "./enums/ParticleStopMode";
|
|
10
|
+
export { ParticleSubEmitterType } from "./enums/ParticleSubEmitterType";
|
|
11
|
+
export { ParticleSubEmitterInheritProperty } from "./enums/ParticleSubEmitterInheritProperty";
|
|
10
12
|
export { Burst } from "./modules/Burst";
|
|
11
13
|
export { ColorOverLifetimeModule } from "./modules/ColorOverLifetimeModule";
|
|
12
14
|
export { CustomDataModule } from "./modules/CustomDataModule";
|
|
@@ -22,4 +24,6 @@ export { TextureSheetAnimationModule } from "./modules/TextureSheetAnimationModu
|
|
|
22
24
|
export { VelocityOverLifetimeModule } from "./modules/VelocityOverLifetimeModule";
|
|
23
25
|
export { LimitVelocityOverLifetimeModule } from "./modules/LimitVelocityOverLifetimeModule";
|
|
24
26
|
export { NoiseModule } from "./modules/NoiseModule";
|
|
27
|
+
export { SubEmitter } from "./modules/SubEmitter";
|
|
28
|
+
export { SubEmittersModule } from "./modules/SubEmittersModule";
|
|
25
29
|
export * from "./modules/shape/index";
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { ShaderData, ShaderMacro } from "../../shader";
|
|
2
|
-
import { ParticleGenerator } from "../ParticleGenerator";
|
|
3
2
|
import { ParticleCompositeCurve } from "./ParticleCompositeCurve";
|
|
4
3
|
/**
|
|
5
4
|
* Particle generator module.
|
|
6
5
|
*/
|
|
7
6
|
export declare abstract class ParticleGeneratorModule {
|
|
8
|
-
protected _generator: ParticleGenerator;
|
|
9
7
|
protected _enabled: boolean;
|
|
10
8
|
/**
|
|
11
9
|
* Specifies whether the module is enabled or not.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ParticleRenderer } from "../ParticleRenderer";
|
|
2
|
+
import { ParticleSubEmitterInheritProperty } from "../enums/ParticleSubEmitterInheritProperty";
|
|
3
|
+
import { ParticleSubEmitterType } from "../enums/ParticleSubEmitterType";
|
|
4
|
+
/**
|
|
5
|
+
* One slot in `SubEmittersModule.subEmitters`. Configures which sub-emitter
|
|
6
|
+
* fires, on which parent event, with what inheritance, probability, and count.
|
|
7
|
+
*/
|
|
8
|
+
export declare class SubEmitter {
|
|
9
|
+
/** Bitmask of properties inherited from the parent particle. */
|
|
10
|
+
inheritProperties: ParticleSubEmitterInheritProperty;
|
|
11
|
+
/** Probability (0..1) the sub-emitter fires for any given event. */
|
|
12
|
+
emitProbability: number;
|
|
13
|
+
/** Number of sub particles emitted per parent event. */
|
|
14
|
+
emitCount: number;
|
|
15
|
+
private _emitter;
|
|
16
|
+
private _type;
|
|
17
|
+
/**
|
|
18
|
+
* Target particle renderer the sub particles emit into.
|
|
19
|
+
*/
|
|
20
|
+
get emitter(): ParticleRenderer;
|
|
21
|
+
set emitter(value: ParticleRenderer);
|
|
22
|
+
/**
|
|
23
|
+
* Which parent-particle event drives this slot.
|
|
24
|
+
*/
|
|
25
|
+
get type(): ParticleSubEmitterType;
|
|
26
|
+
set type(value: ParticleSubEmitterType);
|
|
27
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ParticleSubEmitterInheritProperty } from "../enums/ParticleSubEmitterInheritProperty";
|
|
2
|
+
import { ParticleSubEmitterType } from "../enums/ParticleSubEmitterType";
|
|
3
|
+
import { ParticleRenderer } from "../ParticleRenderer";
|
|
4
|
+
import { ParticleGeneratorModule } from "./ParticleGeneratorModule";
|
|
5
|
+
import { SubEmitter } from "./SubEmitter";
|
|
6
|
+
/**
|
|
7
|
+
* Fires sub-emitters on parent particle lifecycle events (Birth / Death).
|
|
8
|
+
* @remarks Requires WebGL2; the module stays inactive on WebGL1.
|
|
9
|
+
*/
|
|
10
|
+
export declare class SubEmittersModule extends ParticleGeneratorModule {
|
|
11
|
+
private static _cycleVisited;
|
|
12
|
+
private static _cycleStack;
|
|
13
|
+
private static _wouldCreateCycle;
|
|
14
|
+
private _subEmitters;
|
|
15
|
+
/**
|
|
16
|
+
* The configured sub-emitters.
|
|
17
|
+
*/
|
|
18
|
+
get subEmitters(): readonly SubEmitter[];
|
|
19
|
+
private _probabilityRand;
|
|
20
|
+
/**
|
|
21
|
+
* Add a sub-emitter slot.
|
|
22
|
+
* @param emitter - Target particle renderer
|
|
23
|
+
* @param type - Trigger event (`Birth` / `Death`)
|
|
24
|
+
* @param inheritProperties - Bitmask of properties inherited from the parent particle
|
|
25
|
+
* @param emitProbability - Per-event fire probability [0, 1]
|
|
26
|
+
* @param emitCount - Number of sub particles emitted per parent event
|
|
27
|
+
*/
|
|
28
|
+
addSubEmitter(emitter: ParticleRenderer, type: ParticleSubEmitterType, inheritProperties?: ParticleSubEmitterInheritProperty, emitProbability?: number, emitCount?: number): void;
|
|
29
|
+
/**
|
|
30
|
+
* Remove the sub-emitter at the given index.
|
|
31
|
+
* @param index - Index of the sub-emitter to remove
|
|
32
|
+
*/
|
|
33
|
+
removeSubEmitterByIndex(index: number): void;
|
|
34
|
+
get enabled(): boolean;
|
|
35
|
+
set enabled(value: boolean);
|
|
36
|
+
}
|