@galacean/engine-core 2.0.0-alpha.50 → 2.0.0-alpha.52

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.
Files changed (43) hide show
  1. package/dist/main.js +8590 -7019
  2. package/dist/main.js.map +1 -1
  3. package/dist/module.js +8590 -7021
  4. package/dist/module.js.map +1 -1
  5. package/package.json +3 -3
  6. package/types/ComponentsManager.d.ts +3 -0
  7. package/types/RenderPipeline/RenderElement.d.ts +1 -1
  8. package/types/Renderer.d.ts +1 -1
  9. package/types/Scene.d.ts +1 -1
  10. package/types/Signal.d.ts +2 -0
  11. package/types/graphic/ElementRangeMapping.d.ts +9 -0
  12. package/types/graphic/TransformFeedbackPrimitive.d.ts +18 -28
  13. package/types/graphic/TransformFeedbackSimulator.d.ts +18 -18
  14. package/types/particle/ParticleBounds.d.ts +87 -0
  15. package/types/particle/ParticleBufferUtils.d.ts +18 -11
  16. package/types/particle/ParticleGenerator.d.ts +58 -85
  17. package/types/particle/ParticleRenderer.d.ts +22 -21
  18. package/types/particle/ParticleSubEmitterSpawnState.d.ts +35 -0
  19. package/types/particle/ParticleSystemManager.d.ts +17 -0
  20. package/types/particle/ParticleTransformFeedbackSimulator.d.ts +29 -29
  21. package/types/particle/enums/ParticleInheritVelocityMode.d.ts +14 -0
  22. package/types/particle/enums/ParticleRandomSubSeeds.d.ts +2 -1
  23. package/types/particle/enums/ParticleSubEmitterType.d.ts +4 -1
  24. package/types/particle/enums/attributes/ParticleFeedbackVertexAttribute.d.ts +3 -1
  25. package/types/particle/enums/attributes/ParticleInstanceVertexAttribute.d.ts +10 -8
  26. package/types/particle/index.d.ts +2 -0
  27. package/types/particle/modules/BirthSubEmitterCommand.d.ts +29 -0
  28. package/types/particle/modules/BirthSubEmitterState.d.ts +9 -0
  29. package/types/particle/modules/DeathSubEmitterCommand.d.ts +19 -0
  30. package/types/particle/modules/EmissionModule.d.ts +23 -12
  31. package/types/particle/modules/EmissionState.d.ts +13 -0
  32. package/types/particle/modules/InheritVelocityModule.d.ts +86 -0
  33. package/types/particle/modules/MainModule.d.ts +13 -7
  34. package/types/particle/modules/ParticleCompositeCurve.d.ts +4 -0
  35. package/types/particle/modules/SubEmitter.d.ts +5 -4
  36. package/types/particle/modules/SubEmittersModule.d.ts +70 -16
  37. package/types/particle/modules/VelocityOverLifetimeModule.d.ts +8 -7
  38. package/types/physics/DynamicCollider.d.ts +6 -6
  39. package/types/renderingHardwareInterface/IPlatformTransformFeedbackPrimitive.d.ts +10 -11
  40. package/types/shader/Shader.d.ts +2 -2
  41. package/types/shader/ShaderPass.d.ts +4 -6
  42. package/types/shader/state/BlendState.d.ts +1 -1
  43. package/types/shader/state/RenderState.d.ts +1 -1
@@ -1,11 +1,11 @@
1
1
  import { BoundingBox, Vector3 } from "@galacean/engine-math";
2
- import { Entity } from "../Entity";
3
- import { RenderContext } from "../RenderPipeline/RenderContext";
2
+ import type { Entity } from "../Entity";
3
+ import type { RenderContext } from "../RenderPipeline/RenderContext";
4
4
  import { Renderer } from "../Renderer";
5
- import { TransformModifyFlags } from "../Transform";
6
- import { ModelMesh } from "../mesh/ModelMesh";
5
+ import type { ModelMesh } from "../mesh/ModelMesh";
7
6
  import { ParticleGenerator } from "./ParticleGenerator";
8
7
  import { ParticleRenderMode } from "./enums/ParticleRenderMode";
8
+ import type { ParticleSystemManager } from "./ParticleSystemManager";
9
9
  /**
10
10
  * Particle Renderer Component.
11
11
  */
@@ -13,12 +13,10 @@ export declare class ParticleRenderer extends Renderer {
13
13
  private static readonly _billboardModeMacro;
14
14
  private static readonly _stretchedBillboardModeMacro;
15
15
  private static readonly _horizontalBillboardModeMacro;
16
- private static readonly _verticalBillboardModeMacro;
17
16
  private static readonly _meshModeMacro;
18
17
  private static readonly _pivotOffsetProperty;
19
18
  private static readonly _lengthScale;
20
19
  private static readonly _speedScale;
21
- private static readonly _currentTime;
22
20
  /** Particle generator. */
23
21
  readonly generator: ParticleGenerator;
24
22
  /** Specifies how much particles stretch depending on their velocity. */
@@ -28,13 +26,17 @@ export declare class ParticleRenderer extends Renderer {
28
26
  /** The pivot of particle. */
29
27
  pivot: Vector3;
30
28
  /** @internal */
31
- _generatorBounds: BoundingBox;
29
+ _particleSystemManager: ParticleSystemManager | null;
32
30
  /** @internal */
33
- _transformedBounds: BoundingBox;
31
+ _particleSystemIndex: number;
32
+ /** @internal */
33
+ _particleUpdateIndegree: number;
34
+ /** @internal */
35
+ _subEmitterDependencyFrame: number;
34
36
  private _mesh;
35
37
  private _renderMode;
36
38
  private _currentRenderModeMacro;
37
- private _supportInstancedArrays;
39
+ private readonly _supportInstancedArrays;
38
40
  /**
39
41
  * Specifies how particles are rendered.
40
42
  */
@@ -58,6 +60,14 @@ export declare class ParticleRenderer extends Renderer {
58
60
  * @internal
59
61
  */
60
62
  _onDisable(): void;
63
+ /**
64
+ * @internal
65
+ */
66
+ _onEnableInScene(): void;
67
+ /**
68
+ * @internal
69
+ */
70
+ _onDisableInScene(): void;
61
71
  /**
62
72
  * @internal
63
73
  */
@@ -78,11 +88,11 @@ export declare class ParticleRenderer extends Renderer {
78
88
  /**
79
89
  * @internal
80
90
  */
81
- _isContainDirtyFlag(type: number): boolean;
91
+ _hasDirtyFlag(type: number): boolean;
82
92
  /**
83
93
  * @internal
84
94
  */
85
- _setDirtyFlagFalse(type: number): void;
95
+ _clearDirtyFlag(type: number): void;
86
96
  /**
87
97
  * @internal
88
98
  */
@@ -94,14 +104,5 @@ export declare class ParticleRenderer extends Renderer {
94
104
  /**
95
105
  * @internal
96
106
  */
97
- _onTransformChanged(type: TransformModifyFlags): void;
98
- }
99
- /**
100
- * @internal
101
- */
102
- export declare enum ParticleUpdateFlags {
103
- /** On World Transform Changed */
104
- TransformVolume = 2,
105
- /** On Generator Bounds Related Params Changed */
106
- GeneratorVolume = 4
107
+ _onTransformChanged(): void;
107
108
  }
@@ -0,0 +1,35 @@
1
+ import type { Engine } from "../Engine";
2
+ import { VertexBufferBinding } from "../graphic/VertexBufferBinding";
3
+ import type { ElementRangeMapping } from "../graphic/ElementRangeMapping";
4
+ /**
5
+ * Maintains parent trajectory state aligned with sub-emitted particle slots.
6
+ * @internal
7
+ */
8
+ export declare class ParticleSubEmitterSpawnState {
9
+ private static readonly _gatherVaryings;
10
+ private static readonly _gatherMacros;
11
+ private readonly _gatherPass;
12
+ private readonly _primitive;
13
+ private readonly _subPrimitive;
14
+ private readonly _transformFeedback;
15
+ private _simulationBinding;
16
+ private _renderBinding;
17
+ private _pendingParentTrajectoryBinding;
18
+ private _pendingParentStart;
19
+ private _pendingChildStart;
20
+ private _pendingChildrenPerParent;
21
+ private _pendingParentCount;
22
+ private _activeGatherProgram;
23
+ get simulationBinding(): VertexBufferBinding;
24
+ get renderBinding(): VertexBufferBinding;
25
+ constructor(engine: Engine, particleCapacity: number, needsRenderBinding: boolean);
26
+ resize(particleCapacity: number, mappings: ReadonlyArray<ElementRangeMapping>): void;
27
+ copyActiveRangeForRendering(firstActiveIndex: number, firstFreeIndex: number): void;
28
+ enqueueParentTrajectory(parentTrajectoryBinding: VertexBufferBinding, parentIndex: number, firstChildIndex: number, childCount: number): void;
29
+ flush(): void;
30
+ destroy(): void;
31
+ private _createSpawnStateBinding;
32
+ private _drawPendingBatch;
33
+ private _drawBatch;
34
+ private _beginGatherScope;
35
+ }
@@ -0,0 +1,17 @@
1
+ import type { ParticleRenderer } from "./ParticleRenderer";
2
+ /**
3
+ * @internal
4
+ */
5
+ export declare class ParticleSystemManager {
6
+ private readonly _renderers;
7
+ private readonly _orderedRenderers;
8
+ private _topologyDirty;
9
+ add(renderer: ParticleRenderer): void;
10
+ remove(renderer: ParticleRenderer): void;
11
+ update(deltaTime: number): void;
12
+ /**
13
+ * @internal
14
+ */
15
+ _markTopologyDirty(): void;
16
+ private _rebuildTopology;
17
+ }
@@ -1,52 +1,52 @@
1
- import { Vector3 } from "@galacean/engine-math";
2
- import { Engine } from "../Engine";
3
- import { VertexBufferBinding } from "../graphic/VertexBufferBinding";
4
- import { ShaderData } from "../shader/ShaderData";
1
+ import type { Engine } from "../Engine";
2
+ import type { ElementRangeMapping } from "../graphic/ElementRangeMapping";
3
+ import type { VertexBufferBinding } from "../graphic/VertexBufferBinding";
4
+ import type { ShaderData } from "../shader/ShaderData";
5
5
  /**
6
6
  * @internal
7
7
  * Particle-specific Transform Feedback simulation.
8
8
  */
9
9
  export declare class ParticleTransformFeedbackSimulator {
10
10
  private static readonly _deltaTimeProperty;
11
- /** @internal */
12
- _instanceBinding: VertexBufferBinding;
13
- private _simulator;
14
- private _particleInitData;
15
- private _oldReadBuffer;
16
- private _oldWriteBuffer;
11
+ private static readonly _resetTrajectoryProperty;
12
+ private static readonly _firstNewParticleProperty;
13
+ private static readonly _firstFreeParticleProperty;
14
+ private static readonly _stateVaryings;
15
+ private static readonly _trajectoryStateVaryings;
16
+ private static readonly _inputBindings;
17
+ /** Whether parent trajectory data is captured for sub-emitters. */
18
+ readonly trajectoryEnabled: boolean;
19
+ private readonly _simulator;
20
+ private readonly _stateInputVertexElements;
17
21
  /**
18
22
  * The current read buffer binding for the render pass.
19
23
  */
20
24
  get readBinding(): VertexBufferBinding;
21
- constructor(engine: Engine);
22
25
  /**
23
- * Resize feedback buffers.
24
- * Saves pre-resize buffers internally for subsequent `copyOldBufferData` / `destroyOldBuffers` calls.
25
- * @param particleCount - Number of particles to allocate
26
- * @param instanceBinding - New instance vertex buffer binding
27
- */
28
- resize(particleCount: number, instanceBinding: VertexBufferBinding): void;
29
- /**
30
- * Write initial position and velocity for a newly emitted particle.
26
+ * @param engine - Engine instance
27
+ * @param trajectoryEnabled - Whether parent trajectory data is captured for sub-emitters
28
+ * @param particleCount - Number of particle slots to allocate
31
29
  */
32
- writeParticleData(index: number, position: Vector3, vx: number, vy: number, vz: number): void;
30
+ constructor(engine: Engine, trajectoryEnabled: boolean, particleCount: number);
33
31
  /**
34
- * Copy data from pre-resize buffers to current buffers.
35
- * Must be called after `resize` which saves the old buffers.
36
- */
37
- copyOldBufferData(srcByteOffset: number, dstByteOffset: number, byteLength: number): void;
38
- /**
39
- * Destroy pre-resize buffers saved during `resize`.
32
+ * Resize feedback buffers.
33
+ * @param particleCount - Number of particles to allocate
34
+ * @param mappings - Ranges to preserve from the previous buffers
40
35
  */
41
- destroyOldBuffers(): void;
36
+ resize(particleCount: number, mappings: ReadonlyArray<ElementRangeMapping>): void;
42
37
  /**
43
38
  * Run one simulation step.
44
39
  * @param shaderData - Shader data with current macros and uniforms
45
40
  * @param particleCount - Total particle slot count
46
- * @param firstActive - First active particle index in ring buffer
41
+ * @param firstElement - First particle index to update in the ring buffer
47
42
  * @param firstFree - First free particle index in ring buffer
43
+ * @param firstNew - First particle initialized during this update
48
44
  * @param deltaTime - Frame delta time
45
+ * @param resetTrajectory - Whether to discard the trajectory baseline from before a culling pause, or undefined when
46
+ * trajectory feedback is disabled
47
+ * @param particleInputBinding - Particle input vertex buffer binding
48
+ * @param subEmitterSpawnStateBinding - Resolved sub-emitter spawn state, when present
49
49
  */
50
- update(shaderData: ShaderData, particleCount: number, firstActive: number, firstFree: number, deltaTime: number): void;
50
+ update(shaderData: ShaderData, particleCount: number, firstElement: number, firstFree: number, firstNew: number, deltaTime: number, resetTrajectory: boolean | undefined, particleInputBinding: VertexBufferBinding, subEmitterSpawnStateBinding?: VertexBufferBinding): void;
51
51
  destroy(): void;
52
52
  }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Defines how emitter velocity is applied to particles.
3
+ */
4
+ export declare enum ParticleInheritVelocityMode {
5
+ /**
6
+ * Samples emitter velocity when each particle is emitted, then scales it over that particle's lifetime.
7
+ */
8
+ Initial = 0,
9
+ /**
10
+ * Samples the emitter's current velocity every frame and scales it over each particle's lifetime.
11
+ * Only effective in World simulation and requires WebGL2.
12
+ */
13
+ Current = 1
14
+ }
@@ -21,5 +21,6 @@ export declare enum ParticleRandomSubSeeds {
21
21
  LimitVelocityOverLifetime = 3047300990,
22
22
  Noise = 4105357473,
23
23
  SubEmitter = 2622110509,
24
- EmissionRate = 2625893077
24
+ EmissionRate = 2625893077,
25
+ InheritVelocity = 3401255
25
26
  }
@@ -2,7 +2,10 @@
2
2
  * Particle sub emitter trigger type.
3
3
  */
4
4
  export declare enum ParticleSubEmitterType {
5
- /** Triggered when a parent particle is born. */
5
+ /**
6
+ * Evaluates the target system's emission timeline independently for each living parent particle.
7
+ * @remarks Supports Rate over Time and Burst, but not Rate over Distance.
8
+ */
6
9
  Birth = 0,
7
10
  /** Triggered when a parent particle dies (lifetime expired). */
8
11
  Death = 1
@@ -4,5 +4,7 @@
4
4
  */
5
5
  export declare enum ParticleFeedbackVertexAttribute {
6
6
  Position = "a_FeedbackPosition",
7
- Velocity = "a_FeedbackVelocity"
7
+ Velocity = "a_FeedbackVelocity",
8
+ WorldPosition = "a_FeedbackWorldPosition",
9
+ TrajectoryVelocity = "a_FeedbackTrajectoryVelocity"
8
10
  }
@@ -5,13 +5,15 @@ export declare enum ParticleInstanceVertexAttribute {
5
5
  ShapePositionStartLifeTime = "a_ShapePositionStartLifeTime",
6
6
  DirectionTime = "a_DirectionTime",
7
7
  StartColor = "a_StartColor",
8
- StartSize = "a_StartSize",
9
- StartRotation0 = "a_StartRotation0",
10
- StartSpeed = "a_StartSpeed",
11
- Random0 = "a_Random0",
12
- Random1 = "a_Random1",
13
- SimulationWorldPosition = "a_SimulationWorldPosition",
8
+ StartSizeSpeed = "a_StartSizeSpeed",
9
+ StartRotationRandom = "a_StartRotationRandom",
10
+ WorldPositionGravity = "a_WorldPositionGravity",
14
11
  SimulationWorldRotation = "a_SimulationWorldRotation",
15
- SimulationUV = "a_SimulationUV",
16
- Random2 = "a_Random2"
12
+ VelocityRandomTSA = "a_VelocityRandomTSA",
13
+ ForceRandomColor = "a_ForceRandomColor",
14
+ UVTilingFrameRandom = "a_UVTilingFrameRandom",
15
+ InheritVelocity = "a_InheritVelocity",
16
+ LimitVelocityRandom = "a_LimitVelocityRandom",
17
+ ParentSampleWorldPosition = "a_ParentSampleWorldPosition",
18
+ ParentTrajectoryVelocity = "a_ParentTrajectoryVelocity"
17
19
  }
@@ -9,10 +9,12 @@ export { ParticleSimulationSpace } from "./enums/ParticleSimulationSpace";
9
9
  export { ParticleStopMode } from "./enums/ParticleStopMode";
10
10
  export { ParticleSubEmitterType } from "./enums/ParticleSubEmitterType";
11
11
  export { ParticleSubEmitterInheritProperty } from "./enums/ParticleSubEmitterInheritProperty";
12
+ export { ParticleInheritVelocityMode } from "./enums/ParticleInheritVelocityMode";
12
13
  export { Burst } from "./modules/Burst";
13
14
  export { ColorOverLifetimeModule } from "./modules/ColorOverLifetimeModule";
14
15
  export { CustomDataModule } from "./modules/CustomDataModule";
15
16
  export { EmissionModule } from "./modules/EmissionModule";
17
+ export { InheritVelocityModule } from "./modules/InheritVelocityModule";
16
18
  export { MainModule } from "./modules/MainModule";
17
19
  export { ParticleCompositeCurve } from "./modules/ParticleCompositeCurve";
18
20
  export { ParticleCompositeGradient } from "./modules/ParticleCompositeGradient";
@@ -0,0 +1,29 @@
1
+ import type { ParticleGenerator } from "../ParticleGenerator";
2
+ import type { ParticleSubEmitterInheritProperty } from "../enums/ParticleSubEmitterInheritProperty";
3
+ /**
4
+ * Stores one same-frame Birth emission command.
5
+ * @internal
6
+ */
7
+ export declare class BirthSubEmitterCommand {
8
+ readonly source: ParticleGenerator;
9
+ private readonly _pool;
10
+ readonly requests: number[];
11
+ readonly isBirth: true;
12
+ requestStart: number;
13
+ requestCount: number;
14
+ ringIndex: number;
15
+ inheritProperties: ParticleSubEmitterInheritProperty;
16
+ startDelay: number;
17
+ lifetime: number;
18
+ private _frameStartParentAge;
19
+ private _frameDuration;
20
+ private _frameSimulationStart;
21
+ constructor(source: ParticleGenerator, _pool: BirthSubEmitterCommand[], requests: number[]);
22
+ reset(startDelay: number, inheritProperties: ParticleSubEmitterInheritProperty, ringIndex: number, bornTime: number, lifetime: number, frameLastPlayTime: number, framePlayTime: number, frameSimulationStart: number): void;
23
+ addRequest(time: number, count: number): void;
24
+ sortRequests(): void;
25
+ getTrajectoryTimeOffset(emissionTime: number): number;
26
+ getFrameTime(emissionTime: number): number;
27
+ getTrajectoryDuration(): number;
28
+ release(): void;
29
+ }
@@ -0,0 +1,9 @@
1
+ import { EmissionState } from "./EmissionState";
2
+ /**
3
+ * Stores the Birth emission timeline owned by one parent particle and sub-emitter slot.
4
+ * @internal
5
+ */
6
+ export declare class BirthSubEmitterState extends EmissionState {
7
+ startDelay: number;
8
+ reset(seed: number, startDelay: number, initialEmissionTime: number): void;
9
+ }
@@ -0,0 +1,19 @@
1
+ import type { ParticleGenerator } from "../ParticleGenerator";
2
+ import type { ParticleSubEmitterInheritProperty } from "../enums/ParticleSubEmitterInheritProperty";
3
+ /**
4
+ * Stores one same-frame Death emission event.
5
+ * @internal
6
+ */
7
+ export declare class DeathSubEmitterCommand {
8
+ readonly source: ParticleGenerator;
9
+ private readonly _pool;
10
+ readonly isBirth: false;
11
+ ringIndex: number;
12
+ count: number;
13
+ inheritProperties: ParticleSubEmitterInheritProperty;
14
+ frameTime: number;
15
+ trajectoryDuration: number;
16
+ constructor(source: ParticleGenerator, _pool: DeathSubEmitterCommand[]);
17
+ reset(ringIndex: number, count: number, inheritProperties: ParticleSubEmitterInheritProperty, frameTime: number, trajectoryDuration: number): void;
18
+ release(): void;
19
+ }
@@ -1,16 +1,19 @@
1
1
  import { Rand } from "@galacean/engine-math";
2
- import { ShaderData, ShaderMacro } from "../../shader";
3
- import { Burst } from "./Burst";
2
+ import { ShaderMacro } from "../../shader";
3
+ import type { ShaderData } from "../../shader";
4
+ import type { BirthSubEmitterCommand } from "./BirthSubEmitterCommand";
5
+ import type { Burst } from "./Burst";
6
+ import { EmissionState } from "./EmissionState";
4
7
  import { ParticleCompositeCurve } from "./ParticleCompositeCurve";
5
8
  import { ParticleGeneratorModule } from "./ParticleGeneratorModule";
6
- import { BaseShape } from "./shape/BaseShape";
9
+ import type { BaseShape } from "./shape/BaseShape";
7
10
  /**
8
11
  * The EmissionModule of a Particle Generator.
9
12
  */
10
13
  export declare class EmissionModule extends ParticleGeneratorModule {
11
14
  /** @internal */
12
15
  static readonly _emissionShapeMacro: ShaderMacro;
13
- private static _tempEmitPosition;
16
+ private static readonly _tempEmitPosition;
14
17
  /** The rate of particle emission. */
15
18
  rateOverTime: ParticleCompositeCurve;
16
19
  /** The rate at which the emitter spawns new particles over distance. */
@@ -20,16 +23,11 @@ export declare class EmissionModule extends ParticleGeneratorModule {
20
23
  /** @internal */
21
24
  _shapeRand: Rand;
22
25
  private _shapeMacro;
23
- /** @internal */
24
- _rateRand: Rand;
25
- /** @internal */
26
- _frameRateTime: number;
26
+ private readonly _emissionState;
27
27
  private _distanceAccumulator;
28
28
  private _lastEmitPosition;
29
29
  private _hasLastEmitPosition;
30
30
  private _bursts;
31
- private _currentBurstIndex;
32
- private _burstRand;
33
31
  /**
34
32
  * @inheritdoc
35
33
  */
@@ -67,6 +65,12 @@ export declare class EmissionModule extends ParticleGeneratorModule {
67
65
  * @internal
68
66
  */
69
67
  _emit(lastPlayTime: number, playTime: number): void;
68
+ /**
69
+ * Collects Birth requests whose times are known on the CPU. Rate over Distance requires GPU-side particle allocation
70
+ * and is not part of this path.
71
+ * @internal
72
+ */
73
+ _prepareBirthTimedRequests(lastPlayTime: number, playTime: number, state: EmissionState, command: BirthSubEmitterCommand): void;
70
74
  /**
71
75
  * @internal
72
76
  */
@@ -75,15 +79,22 @@ export declare class EmissionModule extends ParticleGeneratorModule {
75
79
  * @internal
76
80
  */
77
81
  _resetRandomSeed(seed: number): void;
78
- /** @internal */
82
+ /**
83
+ * @internal
84
+ */
79
85
  _resyncCursors(playTime: number): void;
86
+ /**
87
+ * @internal
88
+ */
89
+ _shiftTimeOrigin(maxOffset: number): number;
80
90
  /**
81
91
  * @internal
82
92
  */
83
93
  _destroy(): void;
84
- private _emitByRateOverTime;
85
94
  private _emitByRateOverDistance;
95
+ private _emitByRateOverTime;
86
96
  private _evaluateRate;
87
97
  private _emitByBurst;
88
98
  private _emitBySubBurst;
99
+ private _emitOrAddRequest;
89
100
  }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @internal
3
+ */
4
+ export declare class EmissionState {
5
+ frameRateTime: number;
6
+ private _seed;
7
+ private _rateRand;
8
+ private _burstRand;
9
+ resetRandomSeed(seed: number): void;
10
+ randomRate(): number;
11
+ randomBurst(): number;
12
+ resyncTimeCursors(playTime: number): void;
13
+ }
@@ -0,0 +1,86 @@
1
+ import { Rand, Vector3 } from "@galacean/engine-math";
2
+ import type { ShaderData } from "../../shader";
3
+ import type { ParticleGenerator } from "../ParticleGenerator";
4
+ import { ParticleInheritVelocityMode } from "../enums/ParticleInheritVelocityMode";
5
+ import { ParticleCompositeCurve } from "./ParticleCompositeCurve";
6
+ import { ParticleGeneratorModule } from "./ParticleGeneratorModule";
7
+ /**
8
+ * Controls how emitter velocity is applied to particles.
9
+ */
10
+ export declare class InheritVelocityModule extends ParticleGeneratorModule {
11
+ private static readonly _currentMacro;
12
+ private static readonly _initialCurveMacro;
13
+ private static readonly _constantModeMacro;
14
+ private static readonly _curveModeMacro;
15
+ private static readonly _randomModeMacro;
16
+ private static readonly _velocityProperty;
17
+ private static readonly _minConstantProperty;
18
+ private static readonly _maxConstantProperty;
19
+ private static readonly _minCurveProperty;
20
+ private static readonly _maxCurveProperty;
21
+ /** @internal */
22
+ readonly _curveRand: Rand;
23
+ private _mode;
24
+ private _curve;
25
+ private readonly _emitterVelocity;
26
+ private readonly _previousWorldPosition;
27
+ private _hasPreviousWorldPosition;
28
+ private _applicationMacro;
29
+ private _curveMacro;
30
+ private _randomMacro;
31
+ /**
32
+ * @inheritdoc
33
+ */
34
+ get enabled(): boolean;
35
+ set enabled(value: boolean);
36
+ /**
37
+ * Whether to capture the emitter velocity at birth or follow it while the particle is alive.
38
+ */
39
+ get mode(): ParticleInheritVelocityMode;
40
+ set mode(value: ParticleInheritVelocityMode);
41
+ /**
42
+ * Scale applied to the inherited velocity over each particle's lifetime.
43
+ */
44
+ get curve(): ParticleCompositeCurve;
45
+ set curve(value: ParticleCompositeCurve);
46
+ /**
47
+ * @internal
48
+ */
49
+ constructor(generator: ParticleGenerator);
50
+ /**
51
+ * @internal
52
+ */
53
+ _updateEmitterVelocity(elapsedTime: number): void;
54
+ /**
55
+ * @internal
56
+ */
57
+ _resyncEmitterVelocity(): void;
58
+ /**
59
+ * @internal
60
+ */
61
+ _getInitialVelocity(out: Vector3): boolean;
62
+ /**
63
+ * @internal
64
+ */
65
+ _getTrajectoryInitialFactor(): number;
66
+ /**
67
+ * @internal
68
+ */
69
+ _getCurrentBoundsVelocity(out: Vector3): boolean;
70
+ /**
71
+ * @internal
72
+ */
73
+ _updateShaderData(shaderData: ShaderData, hasSubEmitterParticles: boolean): void;
74
+ /**
75
+ * @internal
76
+ */
77
+ _needTransformFeedback(): boolean;
78
+ /**
79
+ * @internal
80
+ */
81
+ _usesInitialCurve(isSubEmitterSpawned: boolean): boolean;
82
+ /**
83
+ * @internal
84
+ */
85
+ _resetRandomSeed(seed: number): void;
86
+ }
@@ -1,15 +1,14 @@
1
1
  import { DataObject } from "../../base/DataObject";
2
2
  import { Rand, Vector3 } from "@galacean/engine-math";
3
3
  import type { ICloneHook } from "../../clone/ICloneHook";
4
- import { ShaderData } from "../../shader/ShaderData";
5
- import { ParticleGenerator } from "../ParticleGenerator";
4
+ import type { ShaderData } from "../../shader/ShaderData";
5
+ import type { ParticleGenerator } from "../ParticleGenerator";
6
6
  import { ParticleScaleMode } from "../enums/ParticleScaleMode";
7
7
  import { ParticleSimulationSpace } from "../enums/ParticleSimulationSpace";
8
8
  import { ParticleCompositeCurve } from "./ParticleCompositeCurve";
9
9
  import { ParticleCompositeGradient } from "./ParticleCompositeGradient";
10
10
  export declare class MainModule extends DataObject implements ICloneHook<MainModule> {
11
- private _tempVector40;
12
- private static _vector3One;
11
+ private static readonly _vector3One;
13
12
  private static readonly _positionScale;
14
13
  private static readonly _sizeScale;
15
14
  private static readonly _worldPosition;
@@ -18,8 +17,6 @@ export declare class MainModule extends DataObject implements ICloneHook<MainMod
18
17
  private static readonly _simulationSpace;
19
18
  private static readonly _startRotation3D;
20
19
  private static readonly _scaleMode;
21
- /** The duration of the Particle Generator in seconds. */
22
- duration: number;
23
20
  /** Specifies whether the Particle Generator loops. */
24
21
  isLoop: boolean;
25
22
  /** Start delay in seconds. */
@@ -36,7 +33,6 @@ export declare class MainModule extends DataObject implements ICloneHook<MainMod
36
33
  flipRotation: number;
37
34
  /** The mode of start color */
38
35
  startColor: ParticleCompositeGradient;
39
- /** A scale that this Particle Generator applies to gravity, defined by Physics.gravity. */
40
36
  /** Override the default playback speed of the Particle Generator. */
41
37
  simulationSpeed: number;
42
38
  /** Control how the Particle Generator applies its Transform component to the particles it emits. */
@@ -59,6 +55,8 @@ export declare class MainModule extends DataObject implements ICloneHook<MainMod
59
55
  readonly _startRotationRand: Rand;
60
56
  /** @internal */
61
57
  readonly _gravityModifierRand: Rand;
58
+ private readonly _worldRotationValue;
59
+ private _duration;
62
60
  private _startLifetime;
63
61
  private _startSpeed;
64
62
  private _startSize3D;
@@ -68,6 +66,14 @@ export declare class MainModule extends DataObject implements ICloneHook<MainMod
68
66
  private _gravityModifier;
69
67
  private _simulationSpace;
70
68
  private _generator;
69
+ /**
70
+ * The emission cycle duration in seconds. Must be positive and finite.
71
+ *
72
+ * @throws
73
+ * Throw a RangeError if the value is not positive and finite. The previous value is preserved.
74
+ */
75
+ get duration(): number;
76
+ set duration(value: number);
71
77
  /**
72
78
  * The initial lifetime of particles when emitted.
73
79
  */
@@ -90,6 +90,10 @@ export declare class ParticleCompositeCurve extends DataObject {
90
90
  * @internal
91
91
  */
92
92
  _getMinMax(out: Vector2): void;
93
+ /**
94
+ * @internal
95
+ */
96
+ _getMaxMagnitude(): number;
93
97
  /**
94
98
  * @internal
95
99
  */
@@ -1,5 +1,5 @@
1
1
  import { DataObject } from "../../base/DataObject";
2
- import { ParticleRenderer } from "../ParticleRenderer";
2
+ import type { ParticleRenderer } from "../ParticleRenderer";
3
3
  import { ParticleSubEmitterInheritProperty } from "../enums/ParticleSubEmitterInheritProperty";
4
4
  import { ParticleSubEmitterType } from "../enums/ParticleSubEmitterType";
5
5
  import type { SubEmittersModule } from "./SubEmittersModule";
@@ -10,16 +10,17 @@ import type { SubEmittersModule } from "./SubEmittersModule";
10
10
  export declare class SubEmitter extends DataObject {
11
11
  /** Bitmask of properties inherited from the parent particle. */
12
12
  inheritProperties: ParticleSubEmitterInheritProperty;
13
- /** Probability (0..1) the sub-emitter fires for any given event. */
13
+ /** Probability (0..1) that the sub-emitter runs for a parent particle. */
14
14
  emitProbability: number;
15
- /** Number of sub particles emitted per parent event. */
16
- emitCount: number;
15
+ /** Number of sub particles emitted when this slot is triggered at Death. */
16
+ deathEmitCount: number;
17
17
  /** @internal */
18
18
  _module: SubEmittersModule | null;
19
19
  private _emitter;
20
20
  private _type;
21
21
  /**
22
22
  * Target particle renderer the sub particles emit into.
23
+ * Both particle renderers must belong to the same scene.
23
24
  */
24
25
  get emitter(): ParticleRenderer | null;
25
26
  set emitter(value: ParticleRenderer);