@galacean/engine-core 1.0.0-beta.18 → 1.0.0-beta.20

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.0.0-beta.18",
3
+ "version": "1.0.0-beta.20",
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": "1.0.0-beta.18"
18
+ "@galacean/engine-math": "1.0.0-beta.20"
19
19
  },
20
20
  "devDependencies": {
21
- "@galacean/engine-design": "1.0.0-beta.18"
21
+ "@galacean/engine-design": "1.0.0-beta.20"
22
22
  },
23
23
  "scripts": {
24
24
  "b:types": "tsc"
package/types/Entity.d.ts CHANGED
@@ -65,7 +65,7 @@ export declare class Entity extends EngineObject {
65
65
  * @param type - The type of the component
66
66
  * @returns The first component which match type
67
67
  */
68
- getComponent<T extends Component>(type: new (entity: Entity) => T): T;
68
+ getComponent<T extends Component>(type: new (entity: Entity) => T): T | null;
69
69
  /**
70
70
  * Get components which match the type.
71
71
  * @param type - The type of the component
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,16 @@
1
+ import { Engine } from "../Engine";
2
+ import { CullingResults } from "../RenderPipeline/CullingResults";
3
+ import { RenderContext } from "../RenderPipeline/RenderContext";
4
+ /**
5
+ * PipelinePass is a base class for all pipeline passes.
6
+ */
7
+ export declare abstract class PipelinePass {
8
+ protected _engine: Engine;
9
+ constructor(engine: Engine);
10
+ /**
11
+ * Called before rendering a camera, override this method to configure the camera If you need to configure the camera clear flag or render target.
12
+ * @param context - Rendering context
13
+ * @param cullingResults - Culling results
14
+ */
15
+ abstract onRender(context: RenderContext, cullingResults: CullingResults): void;
16
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -195,6 +195,7 @@ export declare class Transform extends Component {
195
195
  * @returns Change flag
196
196
  */
197
197
  registerWorldChangeFlag(): BoolUpdateFlag;
198
+ protected _onDestroy(): void;
198
199
  /**
199
200
  * Get worldMatrix: Will trigger the worldMatrix update of itself and all parent entities.
200
201
  * Get worldPosition: Will trigger the worldMatrix, local position update of itself and the worldMatrix update of all parent entities.
@@ -1,15 +1,12 @@
1
+ type PickOnlyOne<T extends {}, Keys extends keyof T = keyof T> = Keys extends unknown ? {
2
+ [K in Keys]: T[Keys];
3
+ } & {
4
+ [K in Exclude<keyof T, Keys>]?: never;
5
+ } : never;
1
6
  /**
2
7
  * Used to describe loading asset.
3
8
  */
4
9
  export type LoadItem = {
5
- /**
6
- * Loading url.
7
- */
8
- url?: string;
9
- /**
10
- * Available when AssetType is TextureCube.
11
- */
12
- urls?: string[];
13
10
  /**
14
11
  * Asset Type.
15
12
  */
@@ -30,4 +27,14 @@ export type LoadItem = {
30
27
  * Additional parameters for specified loader.
31
28
  */
32
29
  params?: Record<string, any>;
33
- };
30
+ } & PickOnlyOne<{
31
+ /**
32
+ * Loading url.
33
+ */
34
+ url: string;
35
+ /**
36
+ * Available when AssetType is TextureCube.
37
+ */
38
+ urls: string[];
39
+ }>;
40
+ export {};
@@ -0,0 +1,6 @@
1
+ export declare enum ActiveChangeFlag {
2
+ None = 0,
3
+ Scene = 1,
4
+ Hierarchy = 2,
5
+ All = 3
6
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Depth texture mode.
3
+ */
4
+ export declare enum DepthTextureMode {
5
+ None = 0,
6
+ PrePass = 1
7
+ }
package/types/index.d.ts CHANGED
@@ -22,7 +22,7 @@ export { AssetPromise } from "./asset/AssetPromise";
22
22
  export type { LoadItem } from "./asset/LoadItem";
23
23
  export { AssetType } from "./asset/AssetType";
24
24
  export { ReferResource } from "./asset/ReferResource";
25
- export * from "./RenderPipeline/Index";
25
+ export * from "./RenderPipeline/index";
26
26
  export * from "./base";
27
27
  export { Background } from "./Background";
28
28
  export { BackgroundMode } from "./enums/BackgroundMode";
@@ -9,6 +9,7 @@ export declare class PhysicsManager {
9
9
  private static _collision;
10
10
  private _engine;
11
11
  private _restTime;
12
+ private _fixedTimeStep;
12
13
  private _colliders;
13
14
  private _gravity;
14
15
  private _nativePhysicsManager;
@@ -19,13 +20,14 @@ export declare class PhysicsManager {
19
20
  private _onTriggerEnter;
20
21
  private _onTriggerExit;
21
22
  private _onTriggerStay;
22
- /** The fixed time step in seconds at which physics are performed. */
23
- fixedTimeStep: number;
24
23
  /**
25
24
  * The gravity of physics scene.
26
25
  */
27
26
  get gravity(): Vector3;
28
27
  set gravity(value: Vector3);
28
+ /** The fixed time step in seconds at which physics are performed. */
29
+ get fixedTimeStep(): number;
30
+ set fixedTimeStep(value: number);
29
31
  constructor(engine: Engine);
30
32
  /**
31
33
  * Casts a ray through the Scene and returns the first hit.
@@ -0,0 +1,75 @@
1
+ import { Ray, Vector3 } from "@galacean/engine-math";
2
+ import { Layer } from "../Layer";
3
+ import { Scene } from "../Scene";
4
+ import { HitResult } from "./HitResult";
5
+ /**
6
+ * A physics scene is a collection of colliders and constraints which can interact.
7
+ */
8
+ export declare class PhysicsScene {
9
+ private static _collision;
10
+ private _scene;
11
+ private _restTime;
12
+ private _colliders;
13
+ private _gravity;
14
+ private _nativePhysicsScene;
15
+ private _onContactEnter;
16
+ private _onContactExit;
17
+ private _onContactStay;
18
+ private _onTriggerEnter;
19
+ private _onTriggerExit;
20
+ private _onTriggerStay;
21
+ /** The fixed time step in seconds at which physics are performed. */
22
+ fixedTimeStep: number;
23
+ /**
24
+ * The gravity of physics scene.
25
+ */
26
+ get gravity(): Vector3;
27
+ set gravity(value: Vector3);
28
+ constructor(scene: Scene);
29
+ /**
30
+ * Casts a ray through the Scene and returns the first hit.
31
+ * @param ray - The ray
32
+ * @returns Returns True if the ray intersects with a collider, otherwise false
33
+ */
34
+ raycast(ray: Ray): boolean;
35
+ /**
36
+ * Casts a ray through the Scene and returns the first hit.
37
+ * @param ray - The ray
38
+ * @param outHitResult - If true is returned, outHitResult will contain more detailed collision information
39
+ * @returns Returns True if the ray intersects with a collider, otherwise false
40
+ */
41
+ raycast(ray: Ray, outHitResult: HitResult): boolean;
42
+ /**
43
+ * Casts a ray through the Scene and returns the first hit.
44
+ * @param ray - The ray
45
+ * @param distance - The max distance the ray should check
46
+ * @returns Returns True if the ray intersects with a collider, otherwise false
47
+ */
48
+ raycast(ray: Ray, distance: number): boolean;
49
+ /**
50
+ * Casts a ray through the Scene and returns the first hit.
51
+ * @param ray - The ray
52
+ * @param distance - The max distance the ray should check
53
+ * @param outHitResult - If true is returned, outHitResult will contain more detailed collision information
54
+ * @returns Returns True if the ray intersects with a collider, otherwise false
55
+ */
56
+ raycast(ray: Ray, distance: number, outHitResult: HitResult): boolean;
57
+ /**
58
+ * Casts a ray through the Scene and returns the first hit.
59
+ * @param ray - The ray
60
+ * @param distance - The max distance the ray should check
61
+ * @param layerMask - Layer mask that is used to selectively ignore Colliders when casting
62
+ * @returns Returns True if the ray intersects with a collider, otherwise false
63
+ */
64
+ raycast(ray: Ray, distance: number, layerMask: Layer): boolean;
65
+ /**
66
+ * Casts a ray through the Scene and returns the first hit.
67
+ * @param ray - The ray
68
+ * @param distance - The max distance the ray should check
69
+ * @param layerMask - Layer mask that is used to selectively ignore Colliders when casting
70
+ * @param outHitResult - If true is returned, outHitResult will contain more detailed collision information
71
+ * @returns Returns True if the ray intersects with a collider, otherwise false.
72
+ */
73
+ raycast(ray: Ray, distance: number, layerMask: Layer, outHitResult: HitResult): boolean;
74
+ private _setGravity;
75
+ }
@@ -0,0 +1,58 @@
1
+ export declare enum RenderStateElementKey {
2
+ /** Blend state enabled for target 0 key. */
3
+ BlendStateEnabled0 = 0,
4
+ /** Blend state color blend operation for target 0 key. */
5
+ BlendStateColorBlendOperation0 = 1,
6
+ /** Blend state alpha blend operation for target 0 key. */
7
+ BlendStateAlphaBlendOperation0 = 2,
8
+ /** Blend state source color blend factor for target 0 key. */
9
+ BlendStateSourceColorBlendFactor0 = 3,
10
+ /** Blend state source alpha blend factor for target 0 key. */
11
+ BlendStateSourceAlphaBlendFactor0 = 4,
12
+ /** Blend state destination color blend factor for target 0 key. */
13
+ BlendStateDestinationColorBlendFactor0 = 5,
14
+ /** Blend state destination alpha blend factor for target 0 key. */
15
+ BlendStateDestinationAlphaBlendFactor0 = 6,
16
+ /** Blend state color write mask for target 0 key. */
17
+ BlendStateColorWriteMask0 = 7,
18
+ /** Blend state blend color key. */
19
+ BlendStateBlendColor = 8,
20
+ /** Blend state alpha to coverage key. */
21
+ BlendStateAlphaToCoverage = 9,
22
+ /** Depth state enabled key. */
23
+ DepthStateEnabled = 10,
24
+ /** Depth state write enabled key. */
25
+ DepthStateWriteEnabled = 11,
26
+ /** Depth state compare function key. */
27
+ DepthStateCompareFunction = 12,
28
+ /** Stencil state enabled key. */
29
+ StencilStateEnabled = 13,
30
+ /** Stencil state reference value key. */
31
+ StencilStateReferenceValue = 14,
32
+ /** Stencil state read mask key. */
33
+ StencilStateMask = 15,
34
+ /** Stencil state write mask key. */
35
+ StencilStateWriteMask = 16,
36
+ /** Stencil state compare function front key. */
37
+ StencilStateCompareFunctionFront = 17,
38
+ /** Stencil state compare function back key. */
39
+ StencilStateCompareFunctionBack = 18,
40
+ /** Stencil state pass operation front key. */
41
+ StencilStatePassOperationFront = 19,
42
+ /** Stencil state pass operation back key. */
43
+ StencilStatePassOperationBack = 20,
44
+ /** Stencil state fail operation front key. */
45
+ StencilStateFailOperationFront = 21,
46
+ /** Stencil state fail operation back key. */
47
+ StencilStateFailOperationBack = 22,
48
+ /** Stencil state z fail operation front key. */
49
+ StencilStateZFailOperationFront = 23,
50
+ /** Stencil state z fail operation back key. */
51
+ StencilStateZFailOperationBack = 24,
52
+ /** Raster state fill mode key. */
53
+ RasterStateCullMode = 25,
54
+ /** Raster state cull mode key. */
55
+ RasterStateDepthBias = 26,
56
+ /** Raster state depth bias key. */
57
+ RasterStateSlopeScaledDepthBias = 27
58
+ }
@@ -0,0 +1,41 @@
1
+ export declare class SafeLoopArray<T> {
2
+ private _array;
3
+ private _loopArray;
4
+ private _loopArrayDirty;
5
+ /**
6
+ * Get the length of the array.
7
+ */
8
+ get length(): number;
9
+ /**
10
+ * Push item to the array.
11
+ * @param item - The item which want to be pushed
12
+ */
13
+ push(item: T): void;
14
+ /**
15
+ * Add item to the array.
16
+ * @param index - The index of the array
17
+ * @param item - The item which want to be added
18
+ */
19
+ add(index: number, item: T): void;
20
+ /**
21
+ * Remove item from the array.
22
+ * @param index - The index of the array
23
+ */
24
+ removeByIndex(index: number): void;
25
+ /**
26
+ * The index of the item.
27
+ * @param item - The item which want to get the index
28
+ * @returns Index of the item
29
+ */
30
+ indexOf(item: T): number;
31
+ /**
32
+ * Get the array.
33
+ * @returns The array
34
+ */
35
+ getArray(): ReadonlyArray<T>;
36
+ /**
37
+ * Get the array use for loop.
38
+ * @returns The array use for loop
39
+ */
40
+ getLoopArray(): ReadonlyArray<T>;
41
+ }