@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,32 +1,53 @@
1
- import { Color, Vector3 } from "@galacean/engine-math";
1
+ import type { ICloneHook } from "../../clone/ICloneHook";
2
+ import type { ElementRangeMapping } from "../../graphic/ElementRangeMapping";
2
3
  import { ParticleSubEmitterInheritProperty } from "../enums/ParticleSubEmitterInheritProperty";
3
4
  import { ParticleSubEmitterType } from "../enums/ParticleSubEmitterType";
4
- import { ParticleRenderer } from "../ParticleRenderer";
5
+ import type { ParticleRenderer } from "../ParticleRenderer";
6
+ import { BirthSubEmitterCommand } from "./BirthSubEmitterCommand";
7
+ import { DeathSubEmitterCommand } from "./DeathSubEmitterCommand";
5
8
  import { ParticleGeneratorModule } from "./ParticleGeneratorModule";
6
9
  import { SubEmitter } from "./SubEmitter";
7
10
  /**
8
- * Fires sub-emitters on parent particle lifecycle events (Birth / Death).
9
- * @remarks Requires WebGL2; the module stays inactive on WebGL1.
11
+ * @internal
10
12
  */
11
- export declare class SubEmittersModule extends ParticleGeneratorModule {
12
- private static _cycleVisited;
13
- private static _cycleStack;
14
- private static _wouldCreateCycle;
13
+ export type ParticleSubEmitterCommand = BirthSubEmitterCommand | DeathSubEmitterCommand;
14
+ /**
15
+ * Fires sub-emitters on parent particle birth or death.
16
+ * @remarks
17
+ * Birth uses the target's emission settings on each parent particle's simulated age.
18
+ * The target's `simulationSpeed` affects only spawned particles.
19
+ * Requires WebGL2. Birth does not support Rate over Distance.
20
+ */
21
+ export declare class SubEmittersModule extends ParticleGeneratorModule implements ICloneHook<SubEmittersModule> {
22
+ private static readonly _cycleVisited;
23
+ private static readonly _cycleStack;
15
24
  private _subEmitters;
25
+ private readonly _probabilityRand;
26
+ private readonly _startDelayRand;
27
+ private readonly _birthStatePool;
28
+ private readonly _birthCommandPool;
29
+ private readonly _deathCommandPool;
30
+ private _birthCommandScratch;
31
+ private _birthRequests;
32
+ private _birthRequestCount;
33
+ private _birthStatesByParticle;
34
+ private _particleSequence;
35
+ get enabled(): boolean;
36
+ set enabled(value: boolean);
16
37
  /**
17
38
  * The configured sub-emitters.
18
39
  */
19
40
  get subEmitters(): readonly SubEmitter[];
20
- private _probabilityRand;
21
41
  /**
22
42
  * Add a sub-emitter slot.
23
43
  * @param emitter - Target particle renderer
24
44
  * @param type - Trigger event (`Birth` / `Death`)
25
45
  * @param inheritProperties - Bitmask of properties inherited from the parent particle
26
- * @param emitProbability - Per-event fire probability [0, 1]
27
- * @param emitCount - Number of sub particles emitted per parent event
46
+ * @param emitProbability - Per-parent-particle probability [0, 1]
47
+ * @param deathEmitCount - Number of sub particles emitted when the parent dies
48
+ * @returns The created sub-emitter slot.
28
49
  */
29
- addSubEmitter(emitter: ParticleRenderer, type: ParticleSubEmitterType, inheritProperties?: ParticleSubEmitterInheritProperty, emitProbability?: number, emitCount?: number): void;
50
+ addSubEmitter(emitter: ParticleRenderer, type: ParticleSubEmitterType, inheritProperties?: ParticleSubEmitterInheritProperty, emitProbability?: number, deathEmitCount?: number): SubEmitter;
30
51
  /**
31
52
  * Remove the sub-emitter at the given index.
32
53
  * @param index - Index of the sub-emitter to remove
@@ -36,12 +57,30 @@ export declare class SubEmittersModule extends ParticleGeneratorModule {
36
57
  * Remove all sub-emitter slots.
37
58
  */
38
59
  clear(): void;
39
- get enabled(): boolean;
40
- set enabled(value: boolean);
41
60
  /**
42
61
  * @internal
43
62
  */
44
- _dispatchEvent(type: ParticleSubEmitterType, worldPosition: Vector3, parentColor: Color, parentSize: Vector3, parentRotation: Vector3, worldDirection?: Vector3): void;
63
+ _prepareDeathCommands(ringIndex: number, frameTime: number, trajectoryDuration: number): void;
64
+ /**
65
+ * @internal
66
+ */
67
+ _beginBirthCommands(): void;
68
+ /**
69
+ * @internal
70
+ */
71
+ _prepareBirthCommandsForParticle(ringIndex: number, bornTime: number, lifetime: number, frameLastPlayTime: number, framePlayTime: number, frameSimulationStart: number): void;
72
+ /**
73
+ * @internal
74
+ */
75
+ _retireParticle(ringIndex: number): void;
76
+ /**
77
+ * @internal
78
+ */
79
+ _retireAllBirthStates(): void;
80
+ /**
81
+ * @internal
82
+ */
83
+ _remapBirthStates(newParticleCount: number, mappings: ReadonlyArray<ElementRangeMapping>): void;
45
84
  /**
46
85
  * @internal
47
86
  */
@@ -49,9 +88,24 @@ export declare class SubEmittersModule extends ParticleGeneratorModule {
49
88
  /**
50
89
  * @internal
51
90
  */
52
- _hasSubEmitterOfType(type: ParticleSubEmitterType): boolean;
91
+ _hasSubEmitterOfType(type: ParticleSubEmitterType, scheduledOnly: boolean): boolean;
92
+ /**
93
+ * @inheritdoc
94
+ */
95
+ _onClone(target: SubEmittersModule): void;
53
96
  /**
54
97
  * @internal
55
98
  */
56
99
  _validateEmitter(emitter: ParticleRenderer): void;
100
+ /**
101
+ * @internal
102
+ */
103
+ _onSlotChanged(slot: SubEmitter): void;
104
+ private _resetBirthSubEmitterState;
105
+ private _recycleBirthState;
106
+ private _notifyTopologyChanged;
107
+ private _isTargetInSourceUpdateGraph;
108
+ private _validateEmitterScenes;
109
+ private _validateEmitterScene;
110
+ private static _wouldCreateCycle;
57
111
  }
@@ -1,9 +1,9 @@
1
1
  import { Rand, Vector3 } from "@galacean/engine-math";
2
2
  import { ShaderMacro } from "../../shader";
3
- import { ShaderData } from "../../shader/ShaderData";
3
+ import type { ShaderData } from "../../shader/ShaderData";
4
4
  import { ShaderProperty } from "../../shader/ShaderProperty";
5
5
  import { ParticleSimulationSpace } from "../enums/ParticleSimulationSpace";
6
- import { ParticleGenerator } from "../ParticleGenerator";
6
+ import type { ParticleGenerator } from "../ParticleGenerator";
7
7
  import { ParticleCompositeCurve } from "./ParticleCompositeCurve";
8
8
  import { ParticleGeneratorModule } from "./ParticleGeneratorModule";
9
9
  /**
@@ -71,7 +71,7 @@ export declare class VelocityOverLifetimeModule extends ParticleGeneratorModule
71
71
  /** @internal */
72
72
  static readonly _radialMaxCurveProperty: ShaderProperty;
73
73
  /** @internal */
74
- static readonly _offsetProperty: ShaderProperty;
74
+ static readonly _centerOffsetProperty: ShaderProperty;
75
75
  /** @internal */
76
76
  _velocityRand: Rand;
77
77
  private _velocityMinConstant;
@@ -79,7 +79,7 @@ export declare class VelocityOverLifetimeModule extends ParticleGeneratorModule
79
79
  private _velocityMacro;
80
80
  private _randomModeMacro;
81
81
  private _orbitalMinConstant;
82
- private _orbitalConstant;
82
+ private _orbitalMaxConstant;
83
83
  private _orbitalMacro;
84
84
  private _orbitalRandomModeMacro;
85
85
  private _radialMacro;
@@ -91,9 +91,11 @@ export declare class VelocityOverLifetimeModule extends ParticleGeneratorModule
91
91
  private _orbitalY;
92
92
  private _orbitalZ;
93
93
  private _radial;
94
- private _offset;
94
+ private _centerOffset;
95
95
  private _space;
96
96
  private readonly _onTransformFeedbackDirty;
97
+ get enabled(): boolean;
98
+ set enabled(value: boolean);
97
99
  /**
98
100
  * Velocity over lifetime for x axis.
99
101
  */
@@ -143,8 +145,6 @@ export declare class VelocityOverLifetimeModule extends ParticleGeneratorModule
143
145
  */
144
146
  get space(): ParticleSimulationSpace;
145
147
  set space(value: ParticleSimulationSpace);
146
- get enabled(): boolean;
147
- set enabled(value: boolean);
148
148
  constructor(generator: ParticleGenerator);
149
149
  /**
150
150
  * @internal
@@ -170,5 +170,6 @@ export declare class VelocityOverLifetimeModule extends ParticleGeneratorModule
170
170
  * @internal
171
171
  */
172
172
  _isRandomMode(): boolean;
173
+ private _createOrbitalRadialCurve;
173
174
  private _onOrbitalRadialChange;
174
175
  }
@@ -52,26 +52,26 @@ export declare class DynamicCollider extends Collider {
52
52
  get mass(): number;
53
53
  set mass(value: number);
54
54
  /**
55
- * Whether or not to calculate the center of mass automatically, if true, the center of mass will be calculated based on the associated shapes.
56
- * @remarks Affected by the position, rotation of the shapes.
55
+ * Whether the center of mass is calculated automatically from the attached shapes.
56
+ * @remarks Disabling this preserves the current value.
57
57
  */
58
58
  get automaticCenterOfMass(): boolean;
59
59
  set automaticCenterOfMass(value: boolean);
60
60
  /**
61
61
  * The center of mass relative to the transform's origin.
62
- * @remarks The center of mass is automatically calculated, if you want to set it manually, please set automaticCenterOfMass to false.
62
+ * @remarks Set `automaticCenterOfMass` to false before changing this value.
63
63
  */
64
64
  get centerOfMass(): Vector3;
65
65
  set centerOfMass(value: Vector3);
66
66
  /**
67
- * Whether or not to calculate the inertia tensor automatically, if true, the inertia tensor will be calculated based on the associated shapes and mass.
68
- * @remarks Affected by the position, rotation of the shapes and the mass of the collider.
67
+ * Whether the inertia tensor is calculated automatically from the attached shapes and mass.
68
+ * @remarks Disabling this preserves the current value.
69
69
  */
70
70
  get automaticInertiaTensor(): boolean;
71
71
  set automaticInertiaTensor(value: boolean);
72
72
  /**
73
73
  * The diagonal inertia tensor of mass relative to the center of mass.
74
- * @remarks The inertia tensor is automatically calculated, if you want to set it manually, please set automaticInertiaTensor to false.
74
+ * @remarks Set `automaticInertiaTensor` to false before changing this value.
75
75
  */
76
76
  get inertiaTensor(): Vector3;
77
77
  set inertiaTensor(value: Vector3);
@@ -1,23 +1,22 @@
1
+ import type { IPlatformShaderProgram } from "@galacean/engine-design";
2
+ import type { VertexBufferBinding } from "../graphic/VertexBufferBinding";
3
+ import type { VertexElement } from "../graphic/VertexElement";
1
4
  /**
2
5
  * Platform interface for Transform Feedback primitive operations.
3
6
  * @internal
4
7
  */
5
8
  export interface IPlatformTransformFeedbackPrimitive {
6
9
  /**
7
- * Update vertex layout. Auto-rebuilds when program changes.
10
+ * Bind the read layout, rebuilding cached state when its inputs change.
8
11
  * @param program - Shader program (for attribute locations)
9
- * @param readBinding - Current read buffer binding
10
- * @param writeBinding - Current write buffer binding
12
+ * @param bindingA - First feedback buffer binding
13
+ * @param bindingB - Second feedback buffer binding
11
14
  * @param feedbackElements - Vertex elements for feedback buffer
12
- * @param inputBinding - Input buffer binding
13
- * @param inputElements - Vertex elements for input buffer
14
- */
15
- updateVertexLayout(program: any, readBinding: any, writeBinding: any, feedbackElements: any[], inputBinding: any, inputElements: any[]): void;
16
- /**
17
- * Bind attribute state for the given read direction.
15
+ * @param inputBindings - Input buffer bindings
16
+ * @param inputElements - Vertex elements for input buffers
18
17
  * @param readIsA - Whether to use direction A as read
19
18
  */
20
- bind(readIsA: boolean): void;
19
+ bind(program: IPlatformShaderProgram, bindingA: VertexBufferBinding, bindingB: VertexBufferBinding, feedbackElements: VertexElement[], inputBindings: VertexBufferBinding[], inputElements: VertexElement[], readIsA: boolean): void;
21
20
  /**
22
21
  * Unbind attribute state.
23
22
  */
@@ -30,7 +29,7 @@ export interface IPlatformTransformFeedbackPrimitive {
30
29
  */
31
30
  draw(mode: number, first: number, count: number): void;
32
31
  /**
33
- * Invalidate cached state, forcing rebuild on next updateVertexLayout.
32
+ * Invalidate cached state, forcing rebuild on next bind.
34
33
  */
35
34
  invalidate(): void;
36
35
  /**
@@ -86,11 +86,11 @@ export declare class Shader implements IReferable {
86
86
  * Compile shader variant by macro name list.
87
87
  *
88
88
  * @remarks
89
- * Usually a shader contains some macros,any combination of macros is called shader variant.
89
+ * Skips Transform Feedback passes, which require a runtime-provided output layout.
90
90
  *
91
91
  * @param engine - Engine to which the shader variant belongs
92
92
  * @param macros - Macro name list
93
- * @returns Is the compiled shader variant valid
93
+ * @returns Whether the variant is valid; false if all passes are skipped.
94
94
  */
95
95
  compileVariant(engine: Engine, macros: string[]): boolean;
96
96
  /**
@@ -15,6 +15,8 @@ export declare class ShaderPass extends ShaderPart {
15
15
  static _shaderPassCounter: number;
16
16
  /** @internal */
17
17
  static _shaderRootPath: string;
18
+ private static _shaderMacroList;
19
+ private static _macroMap;
18
20
  /** @internal */
19
21
  _platformTarget: ShaderLanguage;
20
22
  /** @internal - Flat instruction array for vertex shader. */
@@ -29,10 +31,6 @@ export declare class ShaderPass extends ShaderPart {
29
31
  _renderStateDataMap: Record<number, ShaderProperty>;
30
32
  /** @internal */
31
33
  _shaderProgramMaps: ShaderProgramMap[];
32
- /** @internal Transform feedback output varyings (WebGL2 only). */
33
- _feedbackVaryings?: string[];
34
- private static _shaderMacroList;
35
- private static _macroMap;
36
34
  /**
37
35
  * Create a shader pass from precompiled instructions.
38
36
  * @param name - Shader pass name
@@ -45,7 +43,7 @@ export declare class ShaderPass extends ShaderPart {
45
43
  /**
46
44
  * @internal
47
45
  */
48
- _getShaderProgram(engine: Engine, macroCollection: ShaderMacroCollection): ShaderProgram;
46
+ _getShaderProgram(engine: Engine, macroCollection: ShaderMacroCollection, feedbackVaryings?: string[]): ShaderProgram;
49
47
  /**
50
48
  * @internal
51
49
  */
@@ -53,6 +51,6 @@ export declare class ShaderPass extends ShaderPart {
53
51
  /**
54
52
  * @internal
55
53
  */
56
- _compileShaderProgram(engine: Engine, macroCollection: ShaderMacroCollection): ShaderProgram;
54
+ _compileShaderProgram(engine: Engine, macroCollection: ShaderMacroCollection, feedbackVaryings?: string[]): ShaderProgram;
57
55
  private _compileShaderSource;
58
56
  }
@@ -21,7 +21,7 @@ export declare class BlendState extends DataObject {
21
21
  /**
22
22
  * @internal
23
23
  */
24
- _applyShaderDataValue(renderStateDataMap: Record<number, ShaderProperty>, shaderData: ShaderData): void;
24
+ _applyShaderDataValue(renderStateDataMap: Record<number, ShaderProperty>, shaderData: ShaderData, renderElementData?: ShaderData): void;
25
25
  /**
26
26
  * @internal
27
27
  * Apply the current blend state by comparing with the last blend state.
@@ -24,7 +24,7 @@ export declare class RenderState extends DataObject {
24
24
  /**
25
25
  * @internal
26
26
  */
27
- _applyStates(engine: Engine, frontFaceInvert: boolean, renderStateDataMap: Record<number, ShaderProperty>, shaderData: ShaderData, customRenderStates?: RenderStateElementMap | null): void;
27
+ _applyStates(engine: Engine, frontFaceInvert: boolean, renderStateDataMap: Record<number, ShaderProperty>, shaderData: ShaderData, customRenderStates?: RenderStateElementMap | null, renderElementData?: ShaderData): void;
28
28
  /**
29
29
  * @internal
30
30
  */