@galacean/engine-core 0.0.0-experimental-shaderlab.2 → 0.0.0-experimental-stateMachine.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": "0.0.0-experimental-shaderlab.2",
3
+ "version": "0.0.0-experimental-stateMachine.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -15,10 +15,10 @@
15
15
  "types/**/*"
16
16
  ],
17
17
  "dependencies": {
18
- "@galacean/engine-math": "0.0.0-experimental-shaderlab.2"
18
+ "@galacean/engine-math": "0.0.0-experimental-stateMachine.0"
19
19
  },
20
20
  "devDependencies": {
21
- "@galacean/engine-design": "0.0.0-experimental-shaderlab.2"
21
+ "@galacean/engine-design": "0.0.0-experimental-stateMachine.0"
22
22
  },
23
23
  "scripts": {
24
24
  "b:types": "tsc"
@@ -2,7 +2,10 @@ import { BoolUpdateFlag } from "../BoolUpdateFlag";
2
2
  import { Component } from "../Component";
3
3
  import { AnimatorController } from "./AnimatorController";
4
4
  import { AnimatorState } from "./AnimatorState";
5
+ import { AnimatorStateTransition } from "./AnimatorTransition";
5
6
  import { AnimatorCullingMode } from "./enums/AnimatorCullingMode";
7
+ import { AnimatorControllerLayer } from "./AnimatorControllerLayer";
8
+ import { AnimatorControllerParameter, AnimatorControllerParameterValue } from "./AnimatorControllerParameter";
6
9
  /**
7
10
  * The controller of the animation system.
8
11
  */
@@ -24,6 +27,14 @@ export declare class Animator extends Component {
24
27
  */
25
28
  get animatorController(): AnimatorController;
26
29
  set animatorController(animatorController: AnimatorController);
30
+ /**
31
+ * The layers in the animator's controller.
32
+ */
33
+ get layers(): Readonly<AnimatorControllerLayer[]>;
34
+ /**
35
+ * The parameters in the animator's controller.
36
+ */
37
+ get parameters(): Readonly<AnimatorControllerParameter[]>;
27
38
  /**
28
39
  * Play a state by name.
29
40
  * @param stateName - The state name
@@ -39,6 +50,7 @@ export declare class Animator extends Component {
39
50
  * @param normalizedTimeOffset - The time offset between 0 and 1(default 0)
40
51
  */
41
52
  crossFade(stateName: string, normalizedTransitionDuration: number, layerIndex?: number, normalizedTimeOffset?: number): void;
53
+ crossFade(transition: AnimatorStateTransition, layerIndex?: number): void;
42
54
  /**
43
55
  * Evaluates the animator component based on deltaTime.
44
56
  * @param deltaTime - The deltaTime when the animation update
@@ -55,6 +67,21 @@ export declare class Animator extends Component {
55
67
  * @param layerIndex - The layer index(default -1). If layer is -1, find the first state with the given state name
56
68
  */
57
69
  findAnimatorState(stateName: string, layerIndex?: number): AnimatorState;
70
+ /**
71
+ * Get the layer by name.
72
+ * @param name - The layer's name.
73
+ */
74
+ findLayerByName(name: string): AnimatorControllerLayer;
75
+ /**
76
+ * Get the parameter by name.
77
+ * @param name - The name of the parameter
78
+ */
79
+ getParameter(name: string): AnimatorControllerParameter;
80
+ /**
81
+ * Set the value of the given parameter.
82
+ * @param name - The name of the parameter
83
+ */
84
+ setParameter(name: string, value: AnimatorControllerParameterValue): void;
58
85
  private _getAnimatorStateInfo;
59
86
  private _getAnimatorStateData;
60
87
  private _saveAnimatorStateData;
@@ -77,6 +104,8 @@ export declare class Animator extends Component {
77
104
  private _checkTransition;
78
105
  private _checkSubTransition;
79
106
  private _checkBackwardsSubTransition;
107
+ _applyTransition(transition: AnimatorStateTransition, layerIndex: number): void;
108
+ private _checkConditions;
80
109
  private _crossFadeByTransition;
81
110
  private _fireAnimationEvents;
82
111
  private _fireSubAnimationEvents;
@@ -84,6 +113,6 @@ export declare class Animator extends Component {
84
113
  private _callAnimatorScriptOnEnter;
85
114
  private _callAnimatorScriptOnUpdate;
86
115
  private _callAnimatorScriptOnExit;
87
- private _checkAutoPlay;
116
+ private _checkEntryState;
88
117
  private _checkRevertOwner;
89
118
  }
@@ -0,0 +1,13 @@
1
+ import { AnimatorControllerParameterValue } from "./AnimatorControllerParameter";
2
+ import { AnimatorConditionMode } from "./enums/AnimatorConditionMode";
3
+ /**
4
+ * Condition that is used to determine if a transition must be taken.
5
+ */
6
+ export declare class AnimatorCondition {
7
+ /** The mode of the condition. */
8
+ mode: AnimatorConditionMode;
9
+ /** The name of the parameter used in the condition. */
10
+ parameter: string;
11
+ /** The AnimatorParameter's threshold value for the condition to be true. */
12
+ threshold: AnimatorControllerParameterValue;
13
+ }
@@ -1,15 +1,34 @@
1
+ import { AnimatorControllerParameter, AnimatorControllerParameterValue } from "./AnimatorControllerParameter";
1
2
  import { AnimatorControllerLayer } from "./AnimatorControllerLayer";
2
3
  /**
3
4
  * Store the data for Animator playback.
4
5
  */
5
6
  export declare class AnimatorController {
6
7
  private _updateFlagManager;
7
- private _layers;
8
- private _layersMap;
9
8
  /**
10
9
  * The layers in the controller.
11
10
  */
12
11
  get layers(): Readonly<AnimatorControllerLayer[]>;
12
+ /**
13
+ * The parameters in the controller.
14
+ */
15
+ get parameters(): Readonly<AnimatorControllerParameter[]>;
16
+ /**
17
+ * Add a parameter to the controller.
18
+ * @param name - The name of the parameter
19
+ * @param defaultValue - The defaultValue of the parameter
20
+ */
21
+ addParameter(name: string, defaultValue?: AnimatorControllerParameterValue): AnimatorControllerParameter;
22
+ /**
23
+ * Add a parameter to the controller.
24
+ * @param parameter - The parameter
25
+ */
26
+ addParameter(parameter: AnimatorControllerParameter): AnimatorControllerParameter;
27
+ /**
28
+ * Remove a parameter from the controller.
29
+ * @param parameter - The parameter
30
+ */
31
+ removeParameter(parameter: AnimatorControllerParameter): void;
13
32
  /**
14
33
  * Get the layer by name.
15
34
  * @param name - The layer's name.
@@ -0,0 +1,10 @@
1
+ export type AnimatorControllerParameterValue = number | string | boolean;
2
+ /**
3
+ * Used to communicate between scripting and the controller, parameters can be set in scripting and used by the controller.
4
+ */
5
+ export declare class AnimatorControllerParameter {
6
+ /** The name of the parameter. */
7
+ name: string;
8
+ /** The value of the parameter. */
9
+ value: AnimatorControllerParameterValue;
10
+ }
@@ -25,12 +25,20 @@ export declare class AnimatorState {
25
25
  get clip(): AnimationClip;
26
26
  set clip(clip: AnimationClip);
27
27
  /**
28
- * The start time of the clip, the range is 0 to 1, default is 0.
28
+ * The start time of this state's clip
29
+ */
30
+ get startTime(): number;
31
+ /**
32
+ * The end time of this state's clip
33
+ */
34
+ get endTime(): number;
35
+ /**
36
+ * The normalized start time of the clip, the range is 0 to 1, default is 0.
29
37
  */
30
38
  get clipStartTime(): number;
31
39
  set clipStartTime(time: number);
32
40
  /**
33
- * The end time of the clip, the range is 0 to 1, default is 1.
41
+ * The normalized end time of the clip, the range is 0 to 1, default is 1.
34
42
  */
35
43
  get clipEndTime(): number;
36
44
  set clipEndTime(time: number);
@@ -39,10 +47,15 @@ export declare class AnimatorState {
39
47
  */
40
48
  constructor(name: string);
41
49
  /**
42
- * Add an outgoing transition to the destination state.
50
+ * Add an outgoing transition.
43
51
  * @param transition - The transition
44
52
  */
45
- addTransition(transition: AnimatorStateTransition): void;
53
+ addTransition(transition: AnimatorStateTransition): AnimatorStateTransition;
54
+ /**
55
+ * Add an outgoing transition to the destination state.
56
+ * @param animatorState - The destination state
57
+ */
58
+ addTransition(animatorState: AnimatorState): AnimatorStateTransition;
46
59
  /**
47
60
  * Remove a transition from the state.
48
61
  * @param transition - The transition
@@ -1,4 +1,5 @@
1
1
  import { AnimatorState } from "./AnimatorState";
2
+ import { AnimatorStateTransition } from "./AnimatorTransition";
2
3
  export interface AnimatorStateMap {
3
4
  [key: string]: AnimatorState;
4
5
  }
@@ -13,6 +14,14 @@ export declare class AnimatorStateMachine {
13
14
  * @remarks When the Animator's AnimatorController changed or the Animator's onEnable be triggered.
14
15
  */
15
16
  defaultState: AnimatorState;
17
+ /**
18
+ * The list of entry transitions in the state machine.
19
+ */
20
+ get entryTransitions(): Readonly<AnimatorStateTransition[]>;
21
+ /**
22
+ * The list of AnyState transitions.
23
+ */
24
+ get anyStateTransitions(): Readonly<AnimatorStateTransition[]>;
16
25
  /**
17
26
  * Add a state to the state machine.
18
27
  * @param name - The name of the new state
@@ -34,4 +43,34 @@ export declare class AnimatorStateMachine {
34
43
  * @returns Unique name.
35
44
  */
36
45
  makeUniqueStateName(name: string): string;
46
+ /**
47
+ * Add an entry transition.
48
+ * @param transition - The transition
49
+ */
50
+ addEntryStateTransition(transition: AnimatorStateTransition): AnimatorStateTransition;
51
+ /**
52
+ * Add an entry transition to the destination state.
53
+ * @param animatorState - The destination state
54
+ */
55
+ addEntryStateTransition(animatorState: AnimatorState): AnimatorStateTransition;
56
+ /**
57
+ * Remove an entry transition.
58
+ * @param transition - The transition
59
+ */
60
+ removeEntryStateTransition(transition: AnimatorStateTransition): void;
61
+ /**
62
+ * Add an any transition.
63
+ * @param transition - The transition
64
+ */
65
+ addAnyStateTransition(transition: AnimatorStateTransition): AnimatorStateTransition;
66
+ /**
67
+ * Add an any transition to the destination state.
68
+ * @param animatorState - The destination state
69
+ */
70
+ addAnyStateTransition(animatorState: AnimatorState): AnimatorStateTransition;
71
+ /**
72
+ * Remove an any transition.
73
+ * @param transition - The transition
74
+ */
75
+ removeAnyStateTransition(transition: AnimatorStateTransition): void;
37
76
  }
@@ -1,3 +1,6 @@
1
+ import { AnimatorControllerParameterValue } from "./AnimatorControllerParameter";
2
+ import { AnimatorConditionMode } from "./enums/AnimatorConditionMode";
3
+ import { AnimatorCondition } from "./AnimatorCondition";
1
4
  import { AnimatorState } from "./AnimatorState";
2
5
  /**
3
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.
@@ -11,4 +14,34 @@ export declare class AnimatorStateTransition {
11
14
  exitTime: number;
12
15
  /** The destination state of the transition. */
13
16
  destinationState: AnimatorState;
17
+ /** Mutes the transition. The transition will never occur. */
18
+ mute: boolean;
19
+ /** Is the transition destination the exit of the current state machine. */
20
+ isExit: boolean;
21
+ private _conditions;
22
+ private _solo;
23
+ /** Mutes all other transitions in the source state. */
24
+ get solo(): boolean;
25
+ set solo(value: boolean);
26
+ /**
27
+ * The conditions in the transition.
28
+ */
29
+ get conditions(): Readonly<AnimatorCondition[]>;
30
+ /**
31
+ * Add a condition to a transition.
32
+ * @param mode - The AnimatorCondition mode of the condition
33
+ * @param parameter - The name of the parameter
34
+ * @param threshold - The threshold value of the condition
35
+ */
36
+ addCondition(mode: AnimatorConditionMode, parameter: string, threshold?: AnimatorControllerParameterValue): AnimatorCondition;
37
+ /**
38
+ * Add a condition to a transition.
39
+ * @param animatorCondition - The condition to add
40
+ */
41
+ addCondition(animatorCondition: AnimatorCondition): AnimatorCondition;
42
+ /**
43
+ * Remove a condition from the transition.
44
+ * @param condition - The condition to remove
45
+ */
46
+ removeCondition(condition: AnimatorCondition): void;
14
47
  }
@@ -23,10 +23,6 @@ export declare enum AssetType {
23
23
  TextureCube = "TextureCube",
24
24
  /** Material. */
25
25
  Material = "Material",
26
- /** Shader */
27
- Shader = "Shader",
28
- /** Shader Chunk */
29
- ShaderChunk = "ShaderChunk",
30
26
  /** Mesh. */
31
27
  Mesh = "Mesh",
32
28
  /** AnimationClip. */
@@ -1,17 +0,0 @@
1
- import { Mesh } from "../graphic/Mesh";
2
- import { SubMesh } from "../graphic/SubMesh";
3
- import { Material } from "../material/Material";
4
- import { Renderer } from "../Renderer";
5
- import { IPoolElement } from "./IPoolElement";
6
- import { RenderData } from "./RenderData";
7
- /**
8
- * Render element.
9
- */
10
- export declare class MeshRenderData extends RenderData implements IPoolElement {
11
- /** Mesh. */
12
- mesh: Mesh;
13
- /** Sub mesh. */
14
- subMesh: SubMesh;
15
- set(component: Renderer, material: Material, mesh: Mesh, subMesh: SubMesh): void;
16
- dispose(): void;
17
- }
@@ -1,55 +0,0 @@
1
- import { Color } from "@galacean/engine-math";
2
- import { Camera } from "../Camera";
3
- import { CameraClearFlags } from "../enums/CameraClearFlags";
4
- import { Layer } from "../Layer";
5
- import { Material } from "../material/Material";
6
- import { RenderTarget } from "../texture/RenderTarget";
7
- import { RenderQueue } from "./RenderQueue";
8
- /**
9
- * RenderPass.
10
- */
11
- declare class RenderPass {
12
- name: string;
13
- enabled: boolean;
14
- priority: number;
15
- renderTarget: RenderTarget;
16
- replaceMaterial: Material;
17
- mask: Layer;
18
- renderOverride: boolean;
19
- clearFlags: CameraClearFlags | undefined;
20
- clearColor: Color | undefined;
21
- /**
22
- * Create a RenderPass.
23
- * @param name - Pass name
24
- * @param priority - Priority, less than 0 before the default pass, greater than 0 after the default pass
25
- * @param renderTarget - The specified Render Target
26
- * @param replaceMaterial - Replaced material
27
- * @param mask - Perform bit and operations with Entity.Layer to filter the objects that this Pass needs to render
28
- */
29
- constructor(name?: string, priority?: number, renderTarget?: any, replaceMaterial?: any, mask?: any);
30
- /**
31
- * Rendering callback, will be executed if renderOverride is set to true.
32
- * @param camera - Camera
33
- * @param opaqueQueue - Opaque queue
34
- * @param alphaTestQueue - Alpha test queue
35
- * @param transparentQueue - Transparent queue
36
- */
37
- render(camera: Camera, opaqueQueue: RenderQueue, alphaTestQueue: RenderQueue, transparentQueue: RenderQueue): void;
38
- /**
39
- * Post rendering callback.
40
- * @param camera - Camera
41
- * @param opaqueQueue - Opaque queue
42
- * @param alphaTestQueue - Alpha test queue
43
- * @param transparentQueue - Transparent queue
44
- */
45
- preRender(camera: Camera, opaqueQueue: RenderQueue, alphaTestQueue: RenderQueue, transparentQueue: RenderQueue): void;
46
- /**
47
- * Post rendering callback.
48
- * @param camera - Camera
49
- * @param opaqueQueue - Opaque queue
50
- * @param alphaTestQueue - Alpha test queue
51
- * @param transparentQueue - Transparent queue
52
- */
53
- postRender(camera: Camera, opaqueQueue: RenderQueue, alphaTestQueue: RenderQueue, transparentQueue: RenderQueue): void;
54
- }
55
- export { RenderPass };
@@ -1,76 +0,0 @@
1
- import { Ray, Vector3 } from "@galacean/engine-math";
2
- import { Engine } from "../Engine";
3
- import { Layer } from "../Layer";
4
- import { HitResult } from "./HitResult";
5
- /**
6
- * A physics manager is a collection of colliders and constraints which can interact.
7
- */
8
- export declare class PhysicsManager {
9
- private static _collision;
10
- private _engine;
11
- private _restTime;
12
- private _colliders;
13
- private _gravity;
14
- private _nativePhysicsManager;
15
- private _physicalObjectsMap;
16
- private _onContactEnter;
17
- private _onContactExit;
18
- private _onContactStay;
19
- private _onTriggerEnter;
20
- private _onTriggerExit;
21
- private _onTriggerStay;
22
- /** The fixed time step in seconds at which physics are performed. */
23
- fixedTimeStep: number;
24
- /**
25
- * The gravity of physics scene.
26
- */
27
- get gravity(): Vector3;
28
- set gravity(value: Vector3);
29
- constructor(engine: Engine);
30
- /**
31
- * Casts a ray through the Scene and returns the first hit.
32
- * @param ray - The ray
33
- * @returns Returns True if the ray intersects with a collider, otherwise false
34
- */
35
- raycast(ray: Ray): boolean;
36
- /**
37
- * Casts a ray through the Scene and returns the first hit.
38
- * @param ray - The ray
39
- * @param outHitResult - If true is returned, outHitResult will contain more detailed collision information
40
- * @returns Returns True if the ray intersects with a collider, otherwise false
41
- */
42
- raycast(ray: Ray, outHitResult: HitResult): boolean;
43
- /**
44
- * Casts a ray through the Scene and returns the first hit.
45
- * @param ray - The ray
46
- * @param distance - The max distance the ray should check
47
- * @returns Returns True if the ray intersects with a collider, otherwise false
48
- */
49
- raycast(ray: Ray, distance: number): boolean;
50
- /**
51
- * Casts a ray through the Scene and returns the first hit.
52
- * @param ray - The ray
53
- * @param distance - The max distance the ray should check
54
- * @param outHitResult - If true is returned, outHitResult will contain more detailed collision information
55
- * @returns Returns True if the ray intersects with a collider, otherwise false
56
- */
57
- raycast(ray: Ray, distance: number, outHitResult: HitResult): boolean;
58
- /**
59
- * Casts a ray through the Scene and returns the first hit.
60
- * @param ray - The ray
61
- * @param distance - The max distance the ray should check
62
- * @param layerMask - Layer mask that is used to selectively ignore Colliders when casting
63
- * @returns Returns True if the ray intersects with a collider, otherwise false
64
- */
65
- raycast(ray: Ray, distance: number, layerMask: Layer): boolean;
66
- /**
67
- * Casts a ray through the Scene and returns the first hit.
68
- * @param ray - The ray
69
- * @param distance - The max distance the ray should check
70
- * @param layerMask - Layer mask that is used to selectively ignore Colliders when casting
71
- * @param outHitResult - If true is returned, outHitResult will contain more detailed collision information
72
- * @returns Returns True if the ray intersects with a collider, otherwise false.
73
- */
74
- raycast(ray: Ray, distance: number, layerMask: Layer, outHitResult: HitResult): boolean;
75
- private _setGravity;
76
- }
@@ -1,6 +0,0 @@
1
- /**
2
- * Hardware graphics API renderer.
3
- */
4
- export interface IHardwareRenderer {
5
- [key: string]: any;
6
- }
File without changes