@galacean/engine-core 2.0.0-alpha.37 → 2.0.0-alpha.39
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 +802 -306
- package/dist/main.js.map +1 -1
- package/dist/module.js +802 -306
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/Canvas.d.ts +23 -7
- package/types/Engine.d.ts +1 -0
- package/types/Entity.d.ts +2 -1
- package/types/Signal.d.ts +6 -2
- package/types/animation/AnimationClip.d.ts +7 -1
- package/types/animation/Animator.d.ts +2 -0
- package/types/animation/AnimatorController.d.ts +1 -0
- package/types/animation/AnimatorControllerLayer.d.ts +8 -2
- package/types/animation/AnimatorStateMachine.d.ts +1 -0
- package/types/asset/ResourceManager.d.ts +17 -1
- package/types/audio/AudioManager.d.ts +4 -0
- package/types/audio/AudioSource.d.ts +1 -0
- package/types/index.d.ts +1 -1
- package/types/particle/ParticleGenerator.d.ts +7 -0
- package/types/particle/modules/ParticleCompositeCurve.d.ts +2 -2
- package/types/particle/modules/VelocityOverLifetimeModule.d.ts +62 -0
- package/types/physics/DynamicCollider.d.ts +6 -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.39",
|
|
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.39"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@galacean/engine-design": "2.0.0-alpha.
|
|
24
|
+
"@galacean/engine-design": "2.0.0-alpha.39"
|
|
25
25
|
},
|
|
26
26
|
"scripts": {
|
|
27
27
|
"b:types": "tsc"
|
package/types/Canvas.d.ts
CHANGED
|
@@ -1,19 +1,35 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* The canvas the engine renders to; owns the render-buffer resolution.
|
|
3
3
|
*/
|
|
4
4
|
export declare abstract class Canvas {
|
|
5
5
|
private _width;
|
|
6
6
|
private _height;
|
|
7
7
|
/**
|
|
8
|
-
* The width of the canvas.
|
|
8
|
+
* The width component of the canvas resolution, in pixels.
|
|
9
9
|
*/
|
|
10
10
|
get width(): number;
|
|
11
|
-
set width(value: number);
|
|
12
11
|
/**
|
|
13
|
-
*The height of the canvas.
|
|
12
|
+
* The height component of the canvas resolution, in pixels.
|
|
14
13
|
*/
|
|
15
14
|
get height(): number;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Lock the render buffer to an explicit resolution and stop following the display size.
|
|
17
|
+
* @param width - Render buffer width in pixels
|
|
18
|
+
* @param height - Render buffer height in pixels
|
|
19
|
+
*
|
|
20
|
+
* @throws
|
|
21
|
+
* Throw an error if width or height is not a positive finite number.
|
|
22
|
+
*/
|
|
23
|
+
setResolution(width: number, height: number): void;
|
|
24
|
+
/**
|
|
25
|
+
* Make the render buffer automatically follow the canvas display size.
|
|
26
|
+
* @param scale - Multiplier applied to the device pixel ratio (1 = native sharpness, 0.7 = save GPU, 2 = supersample), defaults to `1`
|
|
27
|
+
*
|
|
28
|
+
* @throws
|
|
29
|
+
* Throw an error if scale is not a positive finite number.
|
|
30
|
+
*/
|
|
31
|
+
abstract setAutoResolution(scale?: number): void;
|
|
32
|
+
protected _setResolution(width: number, height: number): void;
|
|
33
|
+
protected _exitAutoResolution(): void;
|
|
34
|
+
protected abstract _onResolutionChanged(width: number, height: number): void;
|
|
19
35
|
}
|
package/types/Engine.d.ts
CHANGED
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
|
|
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;
|
|
@@ -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
|
|
103
|
+
private _resolveLoadItemOptions;
|
|
104
104
|
private _loadSingleItem;
|
|
105
105
|
private _loadSubpackageAndMainAsset;
|
|
106
106
|
private _loadMainAsset;
|
|
@@ -110,6 +110,12 @@ export declare class ResourceManager {
|
|
|
110
110
|
private _parseURL;
|
|
111
111
|
private _parseQueryPath;
|
|
112
112
|
private _releaseSubAssetPromiseCallback;
|
|
113
|
+
/**
|
|
114
|
+
* Register virtual asset paths and their load descriptors.
|
|
115
|
+
* @remarks References inside runtime scenes and Prefabs can keep stable virtual paths while the backing URLs
|
|
116
|
+
* are generated dynamically, such as object URLs created from a resource package.
|
|
117
|
+
*/
|
|
118
|
+
registerVirtualResources(resources: readonly VirtualResource[]): void;
|
|
113
119
|
}
|
|
114
120
|
/**
|
|
115
121
|
* Declare ResourceLoader's decorator.
|
|
@@ -119,3 +125,13 @@ export declare class ResourceManager {
|
|
|
119
125
|
export declare function resourceLoader(assetType: string, extNames: string[], useCache?: boolean): <T extends Loader<any>>(Target: {
|
|
120
126
|
new (useCache: boolean): T;
|
|
121
127
|
}) => void;
|
|
128
|
+
export interface VirtualResource {
|
|
129
|
+
virtualPath: string;
|
|
130
|
+
path: string;
|
|
131
|
+
type: string;
|
|
132
|
+
dependentAssetMap?: {
|
|
133
|
+
[key: string]: string;
|
|
134
|
+
};
|
|
135
|
+
subpackageName?: string;
|
|
136
|
+
params?: Record<string, any>;
|
|
137
|
+
}
|
|
@@ -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
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export type { RequestConfig } from "./asset/request";
|
|
|
23
23
|
export { Loader } from "./asset/Loader";
|
|
24
24
|
export { ContentRestorer } from "./asset/ContentRestorer";
|
|
25
25
|
export { RenderingStatistics } from "./asset/RenderingStatistics";
|
|
26
|
-
export { ResourceManager, resourceLoader } from "./asset/ResourceManager";
|
|
26
|
+
export { ResourceManager, resourceLoader, type VirtualResource } from "./asset/ResourceManager";
|
|
27
27
|
export { AssetPromise } from "./asset/AssetPromise";
|
|
28
28
|
export type { LoadItem } from "./asset/LoadItem";
|
|
29
29
|
export { AssetType } from "./asset/AssetType";
|
|
@@ -21,6 +21,7 @@ export declare class ParticleGenerator {
|
|
|
21
21
|
private static _tempVector30;
|
|
22
22
|
private static _tempVector31;
|
|
23
23
|
private static _tempVector32;
|
|
24
|
+
private static _tempVector33;
|
|
24
25
|
private static _tempMat;
|
|
25
26
|
private static _tempColor;
|
|
26
27
|
private static _tempQuat0;
|
|
@@ -118,6 +119,12 @@ export declare class ParticleGenerator {
|
|
|
118
119
|
private _calculateGeneratorBounds;
|
|
119
120
|
private _mergeTransformedBounds;
|
|
120
121
|
private _calculateTransformedBounds;
|
|
122
|
+
private _useOrbitalBounds;
|
|
123
|
+
private _getNoiseBoundsExtents;
|
|
124
|
+
private _getGravityBoundsReach;
|
|
125
|
+
private _getRangeReach;
|
|
126
|
+
private _getVectorReach;
|
|
127
|
+
private _getCurveMagnitudeFromZero;
|
|
121
128
|
private _addGravityToBounds;
|
|
122
129
|
private _getExtremeValueFromZero;
|
|
123
130
|
}
|
|
@@ -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
|
|
79
|
-
private _getMinKeyValue;
|
|
79
|
+
private _getKeyMinMax;
|
|
80
80
|
private _onCurveChange;
|
|
81
81
|
}
|
|
@@ -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
|