@galacean/engine-core 1.3.24 → 1.4.0-alpha.0

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": "1.3.24",
3
+ "version": "1.4.0-alpha.0",
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": "1.3.24"
21
+ "@galacean/engine-math": "1.4.0-alpha.0"
22
22
  },
23
23
  "devDependencies": {
24
- "@galacean/engine-design": "1.3.24"
24
+ "@galacean/engine-design": "1.4.0-alpha.0"
25
25
  },
26
26
  "scripts": {
27
27
  "b:types": "tsc"
@@ -1,5 +1,4 @@
1
1
  export { SpriteMaskInteraction } from "./enums/SpriteMaskInteraction";
2
- export { SpriteMaskLayer } from "./enums/SpriteMaskLayer";
3
2
  export { TextHorizontalAlignment, TextVerticalAlignment } from "./enums/TextAlignment";
4
3
  export { OverflowMode } from "./enums/TextOverflow";
5
4
  export { FontStyle } from "./enums/FontStyle";
@@ -1,13 +1,14 @@
1
1
  import { BoundingBox } from "@galacean/engine-math";
2
2
  import { RenderContext } from "../../RenderPipeline/RenderContext";
3
3
  import { Renderer } from "../../Renderer";
4
+ import { SpriteMaskLayer } from "../../enums/SpriteMaskLayer";
4
5
  import { Sprite } from "./Sprite";
5
6
  /**
6
7
  * A component for masking Sprites.
7
8
  */
8
9
  export declare class SpriteMask extends Renderer {
9
10
  /** The mask layers the sprite mask influence to. */
10
- influenceLayers: number;
11
+ influenceLayers: SpriteMaskLayer;
11
12
  private _sprite;
12
13
  private _automaticWidth;
13
14
  private _automaticHeight;
@@ -88,7 +88,6 @@ export declare class SpriteRenderer extends Renderer {
88
88
  protected _render(context: RenderContext): void;
89
89
  protected _onDestroy(): void;
90
90
  private _calDefaultSize;
91
- private _updateStencilState;
92
91
  private _onSpriteChange;
93
92
  private _onColorChanged;
94
93
  }
@@ -106,7 +106,6 @@ export declare class TextRenderer extends Renderer {
106
106
  constructor(entity: Entity);
107
107
  protected _updateBounds(worldBounds: BoundingBox): void;
108
108
  protected _render(context: RenderContext): void;
109
- private _updateStencilState;
110
109
  private _resetSubFont;
111
110
  private _updatePosition;
112
111
  private _updateColor;
@@ -1 +1,2 @@
1
- export {};
1
+ import { RenderStateElementKey } from "./shader/enums/RenderStateElementKey";
2
+ export type RenderStateElementMap = Record<RenderStateElementKey, number | boolean>;
package/types/Engine.d.ts CHANGED
@@ -117,9 +117,6 @@ export declare class Engine extends EventDispatcher {
117
117
  * @remarks If call during frame execution will delay until the end of the frame
118
118
  */
119
119
  destroy(): void;
120
- private _createSpriteMaterial;
121
- private _createSpriteMaskMaterial;
122
- private _createTextMaterial;
123
120
  private _onDeviceLost;
124
121
  private _onDeviceRestored;
125
122
  private _gc;
@@ -9,6 +9,7 @@ import { AnimatorCullingMode } from "./enums/AnimatorCullingMode";
9
9
  * The controller of the animation system.
10
10
  */
11
11
  export declare class Animator extends Component {
12
+ private static _passedTriggerParameterNames;
12
13
  /** Culling mode of this Animator. */
13
14
  cullingMode: AnimatorCullingMode;
14
15
  /** The playback speed of the Animator, 1.0 is normal playback speed. */
@@ -39,17 +40,25 @@ export declare class Animator extends Component {
39
40
  * Play a state by name.
40
41
  * @param stateName - The state name
41
42
  * @param layerIndex - The layer index(default -1). If layer is -1, play the first state with the given state name
42
- * @param normalizedTimeOffset - The time offset between 0 and 1(default 0)
43
+ * @param normalizedTimeOffset - The normalized time offset (between 0 and 1, default 0) to start the state's animation from
43
44
  */
44
45
  play(stateName: string, layerIndex?: number, normalizedTimeOffset?: number): void;
45
46
  /**
46
- * Create a cross fade from the current state to another state.
47
+ * Create a cross fade from the current state to another state with a normalized duration.
47
48
  * @param stateName - The state name
48
- * @param normalizedTransitionDuration - The duration of the transition (normalized)
49
+ * @param normalizedDuration - The normalized duration of the transition, relative to the destination state's duration (range: 0 to 1)
49
50
  * @param layerIndex - The layer index(default -1). If layer is -1, play the first state with the given state name
50
- * @param normalizedTimeOffset - The time offset between 0 and 1(default 0)
51
+ * @param normalizedTimeOffset - The normalized time offset (between 0 and 1, default 0) to start the destination state's animation from
51
52
  */
52
- crossFade(stateName: string, normalizedTransitionDuration: number, layerIndex?: number, normalizedTimeOffset?: number): void;
53
+ crossFade(stateName: string, normalizedDuration: number, layerIndex?: number, normalizedTimeOffset?: number): void;
54
+ /**
55
+ * Create a cross fade from the current state to another state with a fixed duration.
56
+ * @param stateName - The state name
57
+ * @param fixedDuration - The duration of the transition in seconds
58
+ * @param layerIndex - The layer index(default -1). If layer is -1, play the first state with the given state name
59
+ * @param normalizedTimeOffset - The normalized time offset (between 0 and 1, default 0) to start the destination state's animation from
60
+ */
61
+ crossFadeInFixedDuration(stateName: string, fixedDuration: number, layerIndex?: number, normalizedTimeOffset?: number): void;
53
62
  /**
54
63
  * Evaluates the animator component based on deltaTime.
55
64
  * @param deltaTime - The deltaTime when the animation update
@@ -88,6 +97,17 @@ export declare class Animator extends Component {
88
97
  * @param value - The value of the parameter
89
98
  */
90
99
  setParameterValue(name: string, value: AnimatorControllerParameterValue): void;
100
+ /**
101
+ * Activate the trigger parameter by name.
102
+ * @param name - The name of the trigger parameter
103
+ */
104
+ activateTriggerParameter(name: string): void;
105
+ /**
106
+ * Reset the trigger parameter to deactivate it by name.
107
+ * @param name - The name of the trigger parameter
108
+ */
109
+ deactivateTriggerParameter(name: string): void;
110
+ private _crossFade;
91
111
  private _getAnimatorStateInfo;
92
112
  private _getAnimatorStateData;
93
113
  private _saveAnimatorStateData;
@@ -112,6 +132,7 @@ export declare class Animator extends Component {
112
132
  private _updateCrossFadeData;
113
133
  private _preparePlayOwner;
114
134
  private _applyStateTransitions;
135
+ private _checkNoExitTimeTransition;
115
136
  private _checkSubTransition;
116
137
  private _checkBackwardsSubTransition;
117
138
  private _applyTransitionsByCondition;
@@ -128,4 +149,5 @@ export declare class Animator extends Component {
128
149
  private _checkAnyAndEntryState;
129
150
  private _checkRevertOwner;
130
151
  private _fireAnimationEventsAndCallScripts;
152
+ private _deactivateTriggeredParameters;
131
153
  }
@@ -31,10 +31,19 @@ export declare class AnimatorController extends ReferResource {
31
31
  */
32
32
  addParameter(name: string, defaultValue?: AnimatorControllerParameterValue): AnimatorControllerParameter;
33
33
  /**
34
- * Remove a parameter from the controller by name.
35
- * @param name - The parameter name
34
+ * Add a trigger parameter to the controller.
35
+ * @param name - The name of the parameter
36
+ */
37
+ addTriggerParameter(name: string): AnimatorControllerParameter;
38
+ /**
39
+ * Remove a parameter from the controller by name, including trigger parameters.
40
+ * @param name - The name of the parameter
36
41
  */
37
42
  removeParameter(name: string): void;
43
+ /**
44
+ * Clear all parameters, including trigger parameters.
45
+ */
46
+ clearParameters(): void;
38
47
  /**
39
48
  * Get the parameter by name.
40
49
  * @param name - The name of the parameter
@@ -59,4 +68,5 @@ export declare class AnimatorController extends ReferResource {
59
68
  * Clear layers.
60
69
  */
61
70
  clearLayers(): void;
71
+ private _addParameter;
62
72
  }
@@ -14,7 +14,6 @@ export declare class AnimatorState {
14
14
  private _clipStartTime;
15
15
  private _clipEndTime;
16
16
  private _clip;
17
- private _transitions;
18
17
  /**
19
18
  * The transitions that are going out of the state.
20
19
  */
@@ -14,8 +14,6 @@ export declare class AnimatorStateMachine {
14
14
  * @remarks When the Animator's AnimatorController changed or the Animator's onEnable be triggered.
15
15
  */
16
16
  defaultState: AnimatorState;
17
- private _entryTransitions;
18
- private _anyStateTransitions;
19
17
  private _statesMap;
20
18
  /**
21
19
  * The list of entry transitions in the state machine.
@@ -52,7 +50,7 @@ export declare class AnimatorStateMachine {
52
50
  */
53
51
  addEntryStateTransition(transition: AnimatorStateTransition): AnimatorStateTransition;
54
52
  /**
55
- * Add an entry transition to the destination state.
53
+ * Add an entry transition to the destination state, the default value of entry transition's hasExitTime is false.
56
54
  * @param animatorState - The destination state
57
55
  */
58
56
  addEntryStateTransition(animatorState: AnimatorState): AnimatorStateTransition;
@@ -67,7 +65,7 @@ export declare class AnimatorStateMachine {
67
65
  */
68
66
  addAnyStateTransition(transition: AnimatorStateTransition): AnimatorStateTransition;
69
67
  /**
70
- * Add an any transition to the destination state.
68
+ * Add an any transition to the destination state, the default value of any transition's hasExitTime is false.
71
69
  * @param animatorState - The destination state
72
70
  */
73
71
  addAnyStateTransition(animatorState: AnimatorState): AnimatorStateTransition;
@@ -76,6 +74,12 @@ export declare class AnimatorStateMachine {
76
74
  * @param transition - The transition
77
75
  */
78
76
  removeAnyStateTransition(transition: AnimatorStateTransition): void;
79
- private _addTransition;
80
- private _removeTransition;
77
+ /**
78
+ * Clear all entry state transitions.
79
+ */
80
+ clearEntryStateTransitions(): void;
81
+ /**
82
+ * Clear all any state transitions.
83
+ */
84
+ clearAnyStateTransitions(): void;
81
85
  }
@@ -1,12 +1,12 @@
1
- import { AnimatorControllerParameterValue } from "./AnimatorControllerParameter";
2
- import { AnimatorConditionMode } from "./enums/AnimatorConditionMode";
3
1
  import { AnimatorCondition } from "./AnimatorCondition";
2
+ import { AnimatorControllerParameterValue } from "./AnimatorControllerParameter";
4
3
  import { AnimatorState } from "./AnimatorState";
4
+ import { AnimatorConditionMode } from "./enums/AnimatorConditionMode";
5
5
  /**
6
6
  * Transitions define when and how the state machine switch from on state to another. AnimatorTransition always originate from a StateMachine or a StateMachine entry.
7
7
  */
8
8
  export declare class AnimatorStateTransition {
9
- /** The duration of the transition. This is represented in normalized time. */
9
+ /** The duration of the transition. The duration is in normalized time by default. To set it to be in seconds, set isFixedDuration to true. */
10
10
  duration: number;
11
11
  /** The time at which the destination state will start. This is represented in normalized time. */
12
12
  offset: number;
@@ -16,8 +16,11 @@ export declare class AnimatorStateTransition {
16
16
  destinationState: AnimatorState;
17
17
  /** Mutes the transition. The transition will never occur. */
18
18
  mute: boolean;
19
+ /** Determines whether the duration of the transition is reported in a fixed duration in seconds or as a normalized time. */
20
+ isFixedDuration: boolean;
19
21
  private _conditions;
20
22
  private _solo;
23
+ private _hasExitTime;
21
24
  /**
22
25
  * Is the transition destination the exit of the current state machine.
23
26
  */
@@ -31,13 +34,18 @@ export declare class AnimatorStateTransition {
31
34
  * The conditions in the transition.
32
35
  */
33
36
  get conditions(): Readonly<AnimatorCondition[]>;
37
+ /**
38
+ * When active the transition will have an exit time condition.
39
+ */
40
+ get hasExitTime(): boolean;
41
+ set hasExitTime(value: boolean);
34
42
  /**
35
43
  * Add a condition to a transition.
36
- * @param mode - The AnimatorCondition mode of the condition
37
44
  * @param parameterName - The name of the parameter
45
+ * @param mode - The AnimatorCondition mode of the condition
38
46
  * @param threshold - The threshold value of the condition
39
47
  */
40
- addCondition(mode: AnimatorConditionMode, parameterName: string, threshold?: AnimatorControllerParameterValue): AnimatorCondition;
48
+ addCondition(parameterName: string, mode?: AnimatorConditionMode, threshold?: AnimatorControllerParameterValue): AnimatorCondition;
41
49
  /**
42
50
  * Add a condition to a transition.
43
51
  * @param animatorCondition - The condition to add
@@ -115,4 +115,6 @@ export declare class ResourceManager {
115
115
  * @param assetType - Type of asset
116
116
  * @param extNames - Name of file extension
117
117
  */
118
- export declare function resourceLoader(assetType: string, extNames: string[], useCache?: boolean): <T extends Loader<any>>(Target: new (useCache: boolean) => T) => void;
118
+ export declare function resourceLoader(assetType: string, extNames: string[], useCache?: boolean): <T extends Loader<any>>(Target: {
119
+ new (useCache: boolean): T;
120
+ }) => void;
@@ -3,37 +3,37 @@
3
3
  */
4
4
  export declare enum DataType {
5
5
  /** Float */
6
- FLOAT = 5126,
6
+ FLOAT = 5126,// gl.FLOAT
7
7
  /** Floating-point two-dimensional vector */
8
- FLOAT_VEC2 = 35664,
8
+ FLOAT_VEC2 = 35664,// gl.FLOAT_VEC2
9
9
  /** Floating-point three-dimensional vector */
10
- FLOAT_VEC3 = 35665,
10
+ FLOAT_VEC3 = 35665,// gl.FLOAT_VEC3
11
11
  /** Floating-point four-dimensional vector */
12
- FLOAT_VEC4 = 35666,
12
+ FLOAT_VEC4 = 35666,// gl.FLOAT_VEC4
13
13
  /** Integer */
14
- INT = 5124,
14
+ INT = 5124,// gl.INT
15
15
  /** Integer two-dimensional vector */
16
- INT_VEC2 = 35667,
16
+ INT_VEC2 = 35667,// gl.INT_VEC2
17
17
  /** Integer three-dimensional vector */
18
- INT_VEC3 = 35668,
18
+ INT_VEC3 = 35668,// gl.INT_VEC3
19
19
  /** Integer four-dimensional vector */
20
- INT_VEC4 = 35669,
20
+ INT_VEC4 = 35669,// gl.INT_VEC4
21
21
  /** Boolean */
22
- BOOL = 35670,
22
+ BOOL = 35670,// gl.BOOL
23
23
  /** Boolean two-dimensional vector */
24
- BOOL_VEC2 = 35671,
24
+ BOOL_VEC2 = 35671,// gl.BOOL_VEC2
25
25
  /** Boolean three-dimensional vector */
26
- BOOL_VEC3 = 35672,
26
+ BOOL_VEC3 = 35672,// gl.BOOL_VEC3
27
27
  /** Boolean four-dimensional vector */
28
- BOOL_VEC4 = 35673,
28
+ BOOL_VEC4 = 35673,// gl.BOOL_VEC4
29
29
  /** Second-order matrix */
30
- FLOAT_MAT2 = 35674,
30
+ FLOAT_MAT2 = 35674,// gl.FLOAT_MAT2
31
31
  /** Third-order matrix */
32
- FLOAT_MAT3 = 35675,
32
+ FLOAT_MAT3 = 35675,// gl.FLOAT_MAT3
33
33
  /** Fourth-order matrix */
34
- FLOAT_MAT4 = 35676,
34
+ FLOAT_MAT4 = 35676,// gl.FLOAT_MAT4
35
35
  /** Float array */
36
- FLOAT_ARRAY = 35677,
36
+ FLOAT_ARRAY = 35677,// gl.FLOAT_ARRAY
37
37
  /** Floating-point two-dimensional vector array */
38
38
  FLOAT_VEC2_ARRAY = 100000,
39
39
  /** Floating-point three-dimensional vector array */
@@ -59,17 +59,17 @@ export declare enum DataType {
59
59
  /** Cube map texture sampler array */
60
60
  SAMPLER_CUBE_ARRAY = 100011,
61
61
  /** 2D sampler */
62
- SAMPLER_2D = 35678,
62
+ SAMPLER_2D = 35678,// gl.SAMPLER_2D
63
63
  /** Cube map Texture sampler */
64
- SAMPLER_CUBE = 35680,
64
+ SAMPLER_CUBE = 35680,// gl.SAMPLER_CUBE
65
65
  /** Byte */
66
- BYTE = 5120,
66
+ BYTE = 5120,// gl.BYTE
67
67
  /** Unsigned byte */
68
- UNSIGNED_BYTE = 5121,
68
+ UNSIGNED_BYTE = 5121,// gl.UNSIGNED_BYTE
69
69
  /** Short */
70
- SHORT = 5122,
70
+ SHORT = 5122,// gl.SHORT
71
71
  /** Unsigned short */
72
- UNSIGNED_SHORT = 5123,
72
+ UNSIGNED_SHORT = 5123,// gl.UNSIGNED_SHORT
73
73
  /** Unsigned int */
74
74
  UNSIGNED_INT = 5125
75
75
  }
@@ -67,5 +67,7 @@ export declare enum SpriteMaskLayer {
67
67
  /** Mask layer 31. */
68
68
  Layer31 = 2147483648,
69
69
  /** All mask layers. */
70
- Everything = 4294967295
70
+ Everything = 4294967295,
71
+ /** None mask layer. */
72
+ Nothing = 0
71
73
  }
package/types/index.d.ts CHANGED
@@ -36,6 +36,7 @@ export { ReplacementFailureStrategy } from "./enums/ReplacementFailureStrategy";
36
36
  export { Downsampling } from "./enums/Downsampling";
37
37
  export { ColorSpace } from "./enums/ColorSpace";
38
38
  export { BackgroundTextureFillMode } from "./enums/BackgroundTextureFillMode";
39
+ export { SpriteMaskLayer } from "./enums/SpriteMaskLayer";
39
40
  export { XRManager } from "./xr/XRManager";
40
41
  export * from "./utils/index";
41
42
  export * from "./input/index";
@@ -7,6 +7,11 @@ export declare class DirectLight extends Light {
7
7
  private static _cullingMaskProperty;
8
8
  private static _colorProperty;
9
9
  private static _directionProperty;
10
+ /**
11
+ * The offset distance in the opposite direction of light direction when generating shadows.
12
+ * @remarks Increasing this value can avoid the holes in the shadow caused by low polygon models.
13
+ */
14
+ shadowNearPlaneOffset: number;
10
15
  private _reverseDirection;
11
16
  /**
12
17
  * Get direction.
@@ -19,7 +19,10 @@ export declare abstract class Light extends Component {
19
19
  shadowBias: number;
20
20
  /** Shadow mapping normal-based bias. */
21
21
  shadowNormalBias: number;
22
- /** Near plane value to use for shadow frustums. */
22
+ /**
23
+ * @deprecated
24
+ * Please use `shadowNearPlaneOffset` instead.
25
+ */
23
26
  shadowNearPlane: number;
24
27
  private _shadowStrength;
25
28
  private _color;
@@ -1,3 +1,4 @@
1
+ import { Vector2 } from "@galacean/engine-math";
1
2
  import { Engine } from "../Engine";
2
3
  import { Texture2D } from "../texture/Texture2D";
3
4
  import { PBRBaseMaterial } from "./PBRBaseMaterial";
@@ -12,6 +13,10 @@ export declare class PBRMaterial extends PBRBaseMaterial {
12
13
  private static _anisotropyInfoProp;
13
14
  private static _anisotropyTextureProp;
14
15
  private _anisotropyRotation;
16
+ private static _iridescenceInfoProp;
17
+ private static _iridescenceThicknessTextureProp;
18
+ private static _iridescenceTextureProp;
19
+ private _iridescenceRange;
15
20
  /**
16
21
  * Index Of Refraction.
17
22
  * @defaultValue `1.5`
@@ -56,11 +61,43 @@ export declare class PBRMaterial extends PBRBaseMaterial {
56
61
  */
57
62
  get anisotropyTexture(): Texture2D;
58
63
  set anisotropyTexture(value: Texture2D);
64
+ /**
65
+ * The iridescence intensity factor, from 0.0 to 1.0.
66
+ * @defaultValue `0.0`
67
+ */
68
+ get iridescence(): number;
69
+ set iridescence(value: number);
70
+ /**
71
+ * The iridescence intensity texture, sampling red channel, and multiply 'iridescence'.
72
+ */
73
+ get iridescenceTexture(): Texture2D;
74
+ set iridescenceTexture(value: Texture2D);
75
+ /**
76
+ * The index of refraction of the dielectric thin-film layer, greater than or equal to 1.0.
77
+ * @defaultValue `1.3`
78
+ */
79
+ get iridescenceIOR(): number;
80
+ set iridescenceIOR(value: number);
81
+ /**
82
+ * The range of iridescence thickness, x is minimum, y is maximum.
83
+ * @defaultValue `[100, 400]`.
84
+ */
85
+ get iridescenceThicknessRange(): Vector2;
86
+ set iridescenceThicknessRange(value: Vector2);
87
+ /**
88
+ * The thickness texture of the thin-film layer, sampling green channel.
89
+ * @remarks
90
+ * If iridescenceThicknessTexture is defined, iridescence thickness between the 'iridescenceThicknessRange'.
91
+ * If iridescenceThicknessTexture is not defined, iridescence thickness will use only 'iridescenceThicknessRange.y'.
92
+ */
93
+ get iridescenceThicknessTexture(): Texture2D;
94
+ set iridescenceThicknessTexture(value: Texture2D);
59
95
  /**
60
96
  * Create a pbr metallic-roughness workflow material instance.
61
97
  * @param engine - Engine to which the material belongs
62
98
  */
63
99
  constructor(engine: Engine);
100
+ private _onIridescenceRangeChanged;
64
101
  /**
65
102
  * @inheritdoc
66
103
  */