@galacean/engine-core 2.0.0-alpha.36 → 2.0.0-alpha.38

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacean/engine-core",
3
- "version": "2.0.0-alpha.36",
3
+ "version": "2.0.0-alpha.38",
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.36"
21
+ "@galacean/engine-math": "2.0.0-alpha.38"
22
22
  },
23
23
  "devDependencies": {
24
- "@galacean/engine-design": "2.0.0-alpha.36"
24
+ "@galacean/engine-design": "2.0.0-alpha.38"
25
25
  },
26
26
  "scripts": {
27
27
  "b:types": "tsc"
package/types/Engine.d.ts CHANGED
@@ -35,6 +35,7 @@ export declare class Engine extends EventDispatcher {
35
35
  private _waitingGC;
36
36
  private _postProcessPasses;
37
37
  private _activePostProcessPasses;
38
+ private _onCanvasResize;
38
39
  private _animate;
39
40
  /**
40
41
  * Settings of Engine.
package/types/Entity.d.ts CHANGED
@@ -84,9 +84,10 @@ export declare class Entity extends EngineObject {
84
84
  getComponents<T extends Component>(type: ComponentConstructor<T>, results: T[]): T[];
85
85
  /**
86
86
  * Get the components which match the type of the entity and it's children.
87
+ * @remarks The components are returned in depth-first pre-order: the entity itself first, then each child's subtree in sibling order.
87
88
  * @param type - The component type
88
89
  * @param results - The components collection
89
- * @returns The components collection which match the type
90
+ * @returns The components collection which match the type
90
91
  */
91
92
  getComponentsIncludeChildren<T extends Component>(type: ComponentConstructor<T>, results: T[]): T[];
92
93
  /**
package/types/Signal.d.ts CHANGED
@@ -13,9 +13,11 @@ export declare class Signal<T extends any[] = []> {
13
13
  on(fn: (...args: T) => void, target?: any): void;
14
14
  /**
15
15
  * Add a structured binding listener. Structured bindings support clone remapping.
16
+ * The target method will be invoked as `method(...signalArgs, ...args)` —
17
+ * runtime signal arguments come first, bound arguments are appended.
16
18
  * @param target - The target component
17
19
  * @param methodName - The method name to invoke on the target
18
- * @param args - Pre-resolved arguments
20
+ * @param args - Pre-resolved arguments appended after the runtime signal arguments
19
21
  */
20
22
  on(target: Component, methodName: string, ...args: any[]): void;
21
23
  /**
@@ -26,9 +28,11 @@ export declare class Signal<T extends any[] = []> {
26
28
  once(fn: (...args: T) => void, target?: any): void;
27
29
  /**
28
30
  * Add a one-time structured binding listener.
31
+ * The target method will be invoked as `method(...signalArgs, ...args)` —
32
+ * runtime signal arguments come first, bound arguments are appended.
29
33
  * @param target - The target component
30
34
  * @param methodName - The method name to invoke on the target
31
- * @param args - Pre-resolved arguments
35
+ * @param args - Pre-resolved arguments appended after the runtime signal arguments
32
36
  */
33
37
  once(target: Component, methodName: string, ...args: any[]): void;
34
38
  /**
@@ -1,6 +1,6 @@
1
1
  import { EngineObject } from "../base/EngineObject";
2
2
  import { Component } from "../Component";
3
- import { ComponentConstructor } from "../Entity";
3
+ import { ComponentConstructor, Entity } from "../Entity";
4
4
  import { AnimationClipCurveBinding } from "./AnimationClipCurveBinding";
5
5
  import { AnimationCurve } from "./animationCurve/AnimationCurve";
6
6
  import { AnimationEvent } from "./AnimationEvent";
@@ -84,4 +84,10 @@ export declare class AnimationClip extends EngineObject {
84
84
  * Clears all curve bindings from the clip.
85
85
  */
86
86
  clearCurveBindings(): void;
87
+ /**
88
+ * Samples an animation at a given time.
89
+ * @param entity - The animated entity
90
+ * @param time - The time to sample an animation
91
+ */
92
+ sampleAnimation(entity: Entity, time: number): void;
87
93
  }
@@ -15,6 +15,8 @@ export declare class Animator extends Component {
15
15
  cullingMode: AnimatorCullingMode;
16
16
  /** The playback speed of the Animator, 1.0 is normal playback speed. */
17
17
  speed: number;
18
+ /** Whether the Animator sends AnimationEvent callbacks. */
19
+ fireEvents: boolean;
18
20
  protected _animatorController: AnimatorController;
19
21
  protected _controllerUpdateFlag: BoolUpdateFlag;
20
22
  protected _updateMark: number;
@@ -7,6 +7,7 @@ import { Engine } from "../Engine";
7
7
  */
8
8
  export declare class AnimatorController extends ReferResource {
9
9
  private _updateFlagManager;
10
+ private _onStatesInvalidate;
10
11
  /**
11
12
  * The layers in the controller.
12
13
  */
@@ -10,10 +10,16 @@ export declare class AnimatorControllerLayer {
10
10
  weight: number;
11
11
  /** The blending mode used by the layer. It is not taken into account for the first layer. */
12
12
  blendingMode: AnimatorLayerBlendingMode;
13
- /** The state machine for the layer. */
14
- stateMachine: AnimatorStateMachine;
15
13
  /** The AnimatorLayerMask is used to mask out certain entities from being animated by an AnimatorLayer. */
16
14
  mask: AnimatorLayerMask;
15
+ private _stateMachine;
16
+ private _engine;
17
+ private _onStatesInvalidate;
18
+ /**
19
+ * The state machine for the layer.
20
+ */
21
+ get stateMachine(): AnimatorStateMachine;
22
+ set stateMachine(value: AnimatorStateMachine);
17
23
  /**
18
24
  * @param name - The layer's name
19
25
  */
@@ -10,6 +10,7 @@ export declare class AnimatorStateMachine {
10
10
  /** The list of states. */
11
11
  readonly states: AnimatorState[];
12
12
  private _engine;
13
+ private _onStatesInvalidate;
13
14
  /**
14
15
  * The state will be played automatically.
15
16
  * @remarks When the Animator's AnimatorController changed or the Animator's onEnable be triggered. Cleared to `null` if the state is removed via `removeState`.
@@ -100,7 +100,7 @@ export declare class ResourceManager {
100
100
  * @param restorer - The restorer
101
101
  */
102
102
  addContentRestorer<T extends EngineObject>(restorer: ContentRestorer<T>): void;
103
- private _assignDefaultOptions;
103
+ private _resolveLoadItemOptions;
104
104
  private _loadSingleItem;
105
105
  private _loadSubpackageAndMainAsset;
106
106
  private _loadMainAsset;
@@ -6,6 +6,8 @@ export declare class AudioManager {
6
6
  private static _gainNode;
7
7
  private static _resumePromise;
8
8
  private static _needsUserGestureResume;
9
+ private static _suspendedByCaller;
10
+ private static _recovering;
9
11
  /**
10
12
  * Suspend the audio context.
11
13
  * @returns A promise that resolves when the audio context is suspended
@@ -18,5 +20,7 @@ export declare class AudioManager {
18
20
  */
19
21
  static resume(): Promise<void>;
20
22
  private static _onVisibilityChange;
23
+ private static _recoverPlaybackContext;
24
+ private static _onPageShow;
21
25
  private static _resumeAfterInterruption;
22
26
  }
@@ -67,6 +67,7 @@ export declare class AudioSource extends Component {
67
67
  */
68
68
  pause(): void;
69
69
  private _onPlayEnd;
70
+ private _ensureGainNode;
70
71
  private _startPlayback;
71
72
  private _initSourceNode;
72
73
  private _clearSourceNode;
@@ -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
  */
@@ -20,8 +21,10 @@ export declare class ParticleGenerator {
20
21
  private static _tempVector30;
21
22
  private static _tempVector31;
22
23
  private static _tempVector32;
24
+ private static _tempVector33;
23
25
  private static _tempMat;
24
- private static _tempColor0;
26
+ private static _tempColor;
27
+ private static _tempQuat0;
25
28
  private static _tempParticleRenderers;
26
29
  private static readonly _particleIncreaseCount;
27
30
  private static readonly _transformedBoundsIncreaseCount;
@@ -48,8 +51,11 @@ export declare class ParticleGenerator {
48
51
  readonly textureSheetAnimation: TextureSheetAnimationModule;
49
52
  /** Noise module. */
50
53
  readonly noise: NoiseModule;
54
+ /** Sub emitters module. */
55
+ readonly subEmitters: SubEmittersModule;
51
56
  /** Custom data module. */
52
57
  readonly customData: CustomDataModule;
58
+ private _feedbackReadback;
53
59
  private _isPlaying;
54
60
  private _instanceBufferResized;
55
61
  private _waitProcessRetiredElementCount;
@@ -61,6 +67,13 @@ export declare class ParticleGenerator {
61
67
  private _firstActiveTransformedBoundingBox;
62
68
  private _firstFreeTransformedBoundingBox;
63
69
  private _playStartDelay;
70
+ private _eventPos;
71
+ private _eventColor;
72
+ private _eventSize;
73
+ private _eventRotation;
74
+ private _eventDir;
75
+ private _emitLocalPos;
76
+ private _emitDirection;
64
77
  /**
65
78
  * Whether the particle generator is contain alive or is still creating particles.
66
79
  */
@@ -91,9 +104,13 @@ export declare class ParticleGenerator {
91
104
  */
92
105
  emit(count: number): void;
93
106
  private _addNewParticle;
107
+ private _onParticleBirth;
94
108
  private _addFeedbackParticle;
95
109
  private _clearActiveParticles;
96
110
  private _retireActiveParticles;
111
+ private _readbackFeedback;
112
+ private _onParticleDeath;
113
+ private _evaluateOverLifetime;
97
114
  private _freeRetiredParticles;
98
115
  private _addActiveParticlesToVertexBuffer;
99
116
  private _addVertexBufferBindingsFilterDuplicate;
@@ -102,6 +119,12 @@ export declare class ParticleGenerator {
102
119
  private _calculateGeneratorBounds;
103
120
  private _mergeTransformedBounds;
104
121
  private _calculateTransformedBounds;
122
+ private _useOrbitalBounds;
123
+ private _getNoiseBoundsExtents;
124
+ private _getGravityBoundsReach;
125
+ private _getRangeReach;
126
+ private _getVectorReach;
127
+ private _getCurveMagnitudeFromZero;
105
128
  private _addGravityToBounds;
106
129
  private _getExtremeValueFromZero;
107
130
  }
@@ -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
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Particle sub emitter trigger type.
3
+ */
4
+ export declare enum ParticleSubEmitterType {
5
+ /** Triggered when a parent particle is born. */
6
+ Birth = 0,
7
+ /** Triggered when a parent particle dies (lifetime expired). */
8
+ Death = 1
9
+ }
@@ -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";
@@ -4,6 +4,7 @@ import { ParticleCurve } from "./ParticleCurve";
4
4
  * Particle composite curve.
5
5
  */
6
6
  export declare class ParticleCompositeCurve {
7
+ private static _minMaxRange;
7
8
  private _updateManager;
8
9
  private _mode;
9
10
  private _constantMin;
@@ -75,7 +76,6 @@ export declare class ParticleCompositeCurve {
75
76
  * @returns - The result curve value
76
77
  */
77
78
  evaluate(time: number, lerpFactor: number): number;
78
- private _getMaxKeyValue;
79
- private _getMinKeyValue;
79
+ private _getKeyMinMax;
80
80
  private _onCurveChange;
81
81
  }
@@ -5,6 +5,7 @@ import { ParticleGradient } from "./ParticleGradient";
5
5
  * Particle composite gradient.
6
6
  */
7
7
  export declare class ParticleCompositeGradient {
8
+ private static _tempColor;
8
9
  /** The gradient mode. */
9
10
  mode: ParticleGradientMode;
10
11
  constantMin: Color;
@@ -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
+ }
@@ -1,3 +1,4 @@
1
+ import { Vector3 } from "@galacean/engine-math";
1
2
  import { ShaderMacro } from "../../shader";
2
3
  import { ShaderProperty } from "../../shader/ShaderProperty";
3
4
  import { ParticleSimulationSpace } from "../enums/ParticleSimulationSpace";
@@ -20,14 +21,45 @@ export declare class VelocityOverLifetimeModule extends ParticleGeneratorModule
20
21
  static readonly _maxGradientYProperty: ShaderProperty;
21
22
  static readonly _maxGradientZProperty: ShaderProperty;
22
23
  static readonly _spaceProperty: ShaderProperty;
24
+ static readonly _orbitalConstantModeMacro: ShaderMacro;
25
+ static readonly _orbitalCurveModeMacro: ShaderMacro;
26
+ static readonly _orbitalRandomModeMacro: ShaderMacro;
27
+ static readonly _radialConstantModeMacro: ShaderMacro;
28
+ static readonly _radialCurveModeMacro: ShaderMacro;
29
+ static readonly _radialRandomModeMacro: ShaderMacro;
30
+ static readonly _orbitalMinConstantProperty: ShaderProperty;
31
+ static readonly _orbitalMaxConstantProperty: ShaderProperty;
32
+ static readonly _orbitalMinCurveXProperty: ShaderProperty;
33
+ static readonly _orbitalMinCurveYProperty: ShaderProperty;
34
+ static readonly _orbitalMinCurveZProperty: ShaderProperty;
35
+ static readonly _orbitalMaxCurveXProperty: ShaderProperty;
36
+ static readonly _orbitalMaxCurveYProperty: ShaderProperty;
37
+ static readonly _orbitalMaxCurveZProperty: ShaderProperty;
38
+ static readonly _radialMinConstantProperty: ShaderProperty;
39
+ static readonly _radialMaxConstantProperty: ShaderProperty;
40
+ static readonly _radialMinCurveProperty: ShaderProperty;
41
+ static readonly _radialMaxCurveProperty: ShaderProperty;
42
+ static readonly _offsetProperty: ShaderProperty;
23
43
  private _velocityMinConstant;
24
44
  private _velocityMaxConstant;
25
45
  private _velocityMacro;
26
46
  private _randomModeMacro;
47
+ private _orbitalMinConstant;
48
+ private _orbitalConstant;
49
+ private _orbitalMacro;
50
+ private _orbitalRandomModeMacro;
51
+ private _radialMacro;
52
+ private _radialRandomModeMacro;
27
53
  private _velocityX;
28
54
  private _velocityY;
29
55
  private _velocityZ;
56
+ private _orbitalX;
57
+ private _orbitalY;
58
+ private _orbitalZ;
59
+ private _radial;
60
+ private _offset;
30
61
  private _space;
62
+ private readonly _onTransformFeedbackDirty;
31
63
  /**
32
64
  * Velocity over lifetime for x axis.
33
65
  */
@@ -43,6 +75,35 @@ export declare class VelocityOverLifetimeModule extends ParticleGeneratorModule
43
75
  */
44
76
  get velocityZ(): ParticleCompositeCurve;
45
77
  set velocityZ(value: ParticleCompositeCurve);
78
+ /**
79
+ * Orbital velocity (radians/second) around the x axis of the system.
80
+ * @remarks Requires WebGL2.
81
+ */
82
+ get orbitalX(): ParticleCompositeCurve;
83
+ set orbitalX(value: ParticleCompositeCurve);
84
+ /**
85
+ * Orbital velocity (radians/second) around the y axis of the system.
86
+ * @remarks Requires WebGL2.
87
+ */
88
+ get orbitalY(): ParticleCompositeCurve;
89
+ set orbitalY(value: ParticleCompositeCurve);
90
+ /**
91
+ * Orbital velocity (radians/second) around the z axis of the system.
92
+ * @remarks Requires WebGL2.
93
+ */
94
+ get orbitalZ(): ParticleCompositeCurve;
95
+ set orbitalZ(value: ParticleCompositeCurve);
96
+ /**
97
+ * Radial velocity moving particles away from (or towards) the center.
98
+ * @remarks Requires WebGL2.
99
+ */
100
+ get radial(): ParticleCompositeCurve;
101
+ set radial(value: ParticleCompositeCurve);
102
+ /**
103
+ * The center offset of orbital/radial motion from the particle system origin.
104
+ */
105
+ get centerOffset(): Vector3;
106
+ set centerOffset(value: Vector3);
46
107
  /**
47
108
  * Velocity space.
48
109
  */
@@ -51,4 +112,5 @@ export declare class VelocityOverLifetimeModule extends ParticleGeneratorModule
51
112
  get enabled(): boolean;
52
113
  set enabled(value: boolean);
53
114
  constructor(generator: ParticleGenerator);
115
+ private _onOrbitalRadialChange;
54
116
  }
@@ -118,6 +118,12 @@ export declare class DynamicCollider extends Collider {
118
118
  * @param force - The force make the collider move
119
119
  */
120
120
  applyForce(force: Vector3): void;
121
+ /**
122
+ * Apply a force to the DynamicCollider at a given position in world space.
123
+ * @param force - The force to apply, in world space
124
+ * @param position - The position where the force is applied, in world space
125
+ */
126
+ applyForceAtPosition(force: Vector3, position: Vector3): void;
121
127
  /**
122
128
  * Apply a torque to the DynamicCollider.
123
129
  * @param torque - The force make the collider rotate