@galacean/engine-core 1.2.0-alpha.0 → 1.2.0-alpha.10

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.2.0-alpha.0",
3
+ "version": "1.2.0-alpha.10",
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.2.0-alpha.0"
18
+ "@galacean/engine-math": "1.2.0-alpha.10"
19
19
  },
20
20
  "devDependencies": {
21
- "@galacean/engine-design": "1.2.0-alpha.0"
21
+ "@galacean/engine-design": "1.2.0-alpha.10"
22
22
  },
23
23
  "scripts": {
24
24
  "b:types": "tsc"
@@ -64,4 +64,6 @@ export interface AtlasSprite {
64
64
  w: number;
65
65
  };
66
66
  pixelsPerUnit: number;
67
+ width: number;
68
+ height: number;
67
69
  }
@@ -108,4 +108,5 @@ export declare class TextRenderer extends Renderer {
108
108
  private _resetSubFont;
109
109
  private _updatePosition;
110
110
  private _updateLocalData;
111
+ private _isTextNoVisible;
111
112
  }
package/types/Camera.d.ts CHANGED
@@ -37,18 +37,18 @@ export declare class Camera extends Component {
37
37
  depthTextureMode: DepthTextureMode;
38
38
  private _priority;
39
39
  private _shaderData;
40
- private _isProjMatSetting;
40
+ private _isCustomViewMatrix;
41
+ private _isCustomProjectionMatrix;
41
42
  private _nearClipPlane;
42
43
  private _farClipPlane;
43
44
  private _fieldOfView;
44
45
  private _orthographicSize;
45
46
  private _isProjectionDirty;
46
47
  private _isInvProjMatDirty;
47
- private _isFrustumProjectDirty;
48
48
  private _customAspectRatio;
49
49
  private _renderTarget;
50
50
  private _depthBufferParams;
51
- private _frustumViewChangeFlag;
51
+ private _frustumChangeFlag;
52
52
  private _transform;
53
53
  private _isViewMatrixDirty;
54
54
  private _isInvViewProjDirty;
@@ -112,12 +112,13 @@ export declare class Camera extends Component {
112
112
  * View matrix.
113
113
  */
114
114
  get viewMatrix(): Readonly<Matrix>;
115
+ set viewMatrix(value: Matrix);
115
116
  /**
116
117
  * The projection matrix is ​​calculated by the relevant parameters of the camera by default.
117
118
  * If it is manually set, the manual value will be maintained. Call resetProjectionMatrix() to restore it.
118
119
  */
120
+ get projectionMatrix(): Readonly<Matrix>;
119
121
  set projectionMatrix(value: Matrix);
120
- get projectionMatrix(): Matrix;
121
122
  /**
122
123
  * Whether to enable HDR.
123
124
  * @todo When render pipeline modification
@@ -129,6 +130,10 @@ export declare class Camera extends Component {
129
130
  */
130
131
  get renderTarget(): RenderTarget | null;
131
132
  set renderTarget(value: RenderTarget | null);
133
+ /**
134
+ * Restore the view matrix to the world matrix of the entity.
135
+ */
136
+ resetViewMatrix(): void;
132
137
  /**
133
138
  * Restore the automatic calculation of projection matrix through fieldOfView, nearClipPlane and farClipPlane.
134
139
  */
@@ -237,7 +242,8 @@ export declare class Camera extends Component {
237
242
  */
238
243
  _onDisableInScene(): void;
239
244
  private _updatePixelViewport;
240
- private _projMatChange;
245
+ private _viewMatrixChange;
246
+ private _projectionMatrixChange;
241
247
  private _innerViewportToWorldPoint;
242
248
  private _updateShaderData;
243
249
  /**
package/types/Canvas.d.ts CHANGED
@@ -14,5 +14,6 @@ export declare abstract class Canvas {
14
14
  */
15
15
  get height(): number;
16
16
  set height(value: number);
17
- protected abstract _onSizeChanged(width: number, height: number): void;
17
+ protected abstract _onWidthChanged(value: number): void;
18
+ protected abstract _onHeightChange(value: number): void;
18
19
  }
package/types/Engine.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { IHardwareRenderer, IPhysics, IShaderLab, IXRDevice } from "@galacean/engine-design";
1
+ import { IHardwareRenderer, IInputOptions, IPhysics, IShaderLab, IXRDevice } from "@galacean/engine-design";
2
2
  import { Canvas } from "./Canvas";
3
3
  import { EngineSettings } from "./EngineSettings";
4
4
  import { Entity } from "./Entity";
@@ -136,6 +136,8 @@ export interface EngineConfiguration {
136
136
  xrDevice?: IXRDevice;
137
137
  /** Color space. */
138
138
  colorSpace?: ColorSpace;
139
- /** Shader lab */
139
+ /** Shader lab. */
140
140
  shaderLab?: IShaderLab;
141
+ /** Input options. */
142
+ input?: IInputOptions;
141
143
  }
package/types/Scene.d.ts CHANGED
@@ -30,6 +30,11 @@ export declare class Scene extends EngineObject {
30
30
  shadowFourCascadeSplits: Vector3;
31
31
  /** Max Shadow distance. */
32
32
  shadowDistance: number;
33
+ /**
34
+ * Last shadow fade distance in percentage, range [0,1].
35
+ * @remarks Value 0 is used for no shadow fade.
36
+ */
37
+ shadowFadeBorder: number;
33
38
  private _background;
34
39
  private _shaderData;
35
40
  private _shadowCascades;
@@ -7,6 +7,8 @@ export declare class SystemInfo {
7
7
  static platform: Platform;
8
8
  /** The operating system is running on. */
9
9
  static operatingSystem: string;
10
+ /** Whether the system support SIMD. */
11
+ private static _simdSupported;
10
12
  /**
11
13
  * The pixel ratio of the device.
12
14
  */
package/types/Utils.d.ts CHANGED
@@ -15,6 +15,12 @@ export declare class Utils {
15
15
  * @returns Whether the url is absolute url.
16
16
  */
17
17
  static isAbsoluteUrl(url: string): boolean;
18
+ /**
19
+ * Judge whether the url is base64 url.
20
+ * @param url - The url to be judged.
21
+ * @returns Whether the url is base64 url.
22
+ */
23
+ static isBase64Url(url: string): boolean;
18
24
  /**
19
25
  * Get the values of an object.
20
26
  */
@@ -39,6 +39,8 @@ export declare enum AssetType {
39
39
  KTX2 = "KTX2",
40
40
  /** Sprite. */
41
41
  Sprite = "Sprite",
42
+ /** PrimitiveMesh. */
43
+ PrimitiveMesh = "PrimitiveMesh",
42
44
  /** Sprite Atlas. */
43
45
  SpriteAtlas = "SpriteAtlas",
44
46
  /** Ambient light. */
@@ -24,7 +24,14 @@ export declare abstract class Loader<T> {
24
24
  static getClass(className: string): {
25
25
  new (...args: any): any;
26
26
  };
27
+ /**
28
+ * Get the class name by class object.
29
+ * @param obj - class object
30
+ * @returns class name
31
+ */
32
+ static getClassName(obj: Object): string;
27
33
  private static _engineObjects;
34
+ private static _classNameMap;
28
35
  constructor(useCache: boolean);
29
36
  initialize?(engine: Engine, configuration: EngineConfiguration): Promise<void>;
30
37
  abstract load(item: LoadItem, resourceManager: ResourceManager): AssetPromise<T>;
@@ -15,6 +15,8 @@ export declare class ResourceManager {
15
15
  retryInterval: number;
16
16
  /** The default timeout period for loading assets, in milliseconds. */
17
17
  timeout: number;
18
+ /** Base url for loading assets. */
19
+ baseUrl: string | null;
18
20
  private _loadingPromises;
19
21
  /** Asset path pool, key is the `instanceID` of resource, value is asset path. */
20
22
  private _assetPool;
@@ -62,6 +62,4 @@ export declare class InputManager {
62
62
  * @returns Whether the pointer is released during the current frame
63
63
  */
64
64
  isPointerUp(pointerButton?: PointerButton): boolean;
65
- private _onBlur;
66
- private _onFocus;
67
65
  }
@@ -7,12 +7,4 @@ export interface IInput {
7
7
  * Function called when the engine is destroyed.
8
8
  */
9
9
  _destroy(): void;
10
- /**
11
- * Function called when focused.
12
- */
13
- _onFocus(): void;
14
- /**
15
- * Function called when focus is lost.
16
- */
17
- _onBlur(): void;
18
10
  }
@@ -6,6 +6,10 @@ import { ModelMesh } from "./ModelMesh";
6
6
  */
7
7
  export declare class PrimitiveMesh {
8
8
  private static _tempVec30;
9
+ private static readonly _sphereSeedPositions;
10
+ private static readonly _sphereSeedCells;
11
+ private static _sphereEdgeIdx;
12
+ private static _spherePoleIdx;
9
13
  /**
10
14
  * Create a sphere mesh.
11
15
  * @param engine - Engine
@@ -15,6 +19,16 @@ export declare class PrimitiveMesh {
15
19
  * @returns Sphere model mesh
16
20
  */
17
21
  static createSphere(engine: Engine, radius?: number, segments?: number, noLongerAccessible?: boolean): ModelMesh;
22
+ /**
23
+ * Create a sphere mesh by implementing Catmull-Clark Surface Subdivision Algorithm.
24
+ * Max step is limited to 6.
25
+ * @param engine - Engine
26
+ * @param radius - Sphere radius
27
+ * @param step - Number of subdiv steps
28
+ * @param noLongerAccessible - No longer access the vertices of the mesh after creation
29
+ * @returns Sphere model mesh
30
+ */
31
+ static createSubdivisionSurfaceSphere(engine: Engine, radius?: number, step?: number, noLongerAccessible?: boolean): ModelMesh;
18
32
  /**
19
33
  * Create a cuboid mesh.
20
34
  * @param engine - Engine
@@ -82,6 +96,14 @@ export declare class PrimitiveMesh {
82
96
  * @returns Capsule model mesh
83
97
  */
84
98
  static createCapsule(engine: Engine, radius?: number, height?: number, radialSegments?: number, heightSegments?: number, noLongerAccessible?: boolean): ModelMesh;
99
+ /**
100
+ * Duplicate vertices at the poles and adjust their UV coordinates.
101
+ */
102
+ private static _generateAndReplacePoleUV;
103
+ /**
104
+ * Get edge point index for subdivision surface sphere.
105
+ */
106
+ private static _calculateEdgeIndex;
85
107
  static _setCylinderData(cylinderMesh: ModelMesh, radiusTop: number, radiusBottom: number, height: number, radialSegments: number, heightSegments: number, noLongerAccessible: boolean, isRestoreMode: boolean, restoreVertexBuffer?: Buffer): void;
86
108
  static _setCapsuleData(capsuleMesh: ModelMesh, radius: number, height: number, radialSegments: number, heightSegments: number, noLongerAccessible: boolean, isRestoreMode: boolean, restoreVertexBuffer?: Buffer): void;
87
109
  private static _initialize;
@@ -1,3 +1,4 @@
1
+ import { Rand } from "@galacean/engine-math";
1
2
  import { ICustomClone } from "../../clone/ComponentCloner";
2
3
  import { ParticleScaleMode } from "../enums/ParticleScaleMode";
3
4
  import { ParticleSimulationSpace } from "../enums/ParticleSimulationSpace";
@@ -54,6 +55,7 @@ export declare class MainModule implements ICustomClone {
54
55
  scalingMode: ParticleScaleMode;
55
56
  /** If set to true, the Particle Generator automatically begins to play on startup. */
56
57
  playOnEnabled: boolean;
58
+ readonly _gravityModifierRand: Rand;
57
59
  private _generator;
58
60
  private _gravity;
59
61
  /**
@@ -4,9 +4,9 @@ import { ParticleShapeType } from "./enums/ParticleShapeType";
4
4
  */
5
5
  export declare abstract class BaseShape {
6
6
  /** The type of shape to emit particles from. */
7
- shapeType: ParticleShapeType;
7
+ abstract readonly shapeType: ParticleShapeType;
8
8
  /** Specifies whether the ShapeModule is enabled or disabled. */
9
- enable: boolean;
9
+ enabled: boolean;
10
10
  /** Randomizes the starting direction of particles. */
11
11
  randomDirectionAmount: number;
12
12
  }
@@ -1,11 +1,12 @@
1
1
  import { Vector3 } from "@galacean/engine-math";
2
2
  import { BaseShape } from "./BaseShape";
3
+ import { ParticleShapeType } from "./enums/ParticleShapeType";
3
4
  /**
4
5
  * Particle shape that emits particles from a box.
5
6
  */
6
7
  export declare class BoxShape extends BaseShape {
7
8
  private static _tempVector30;
9
+ readonly shapeType = ParticleShapeType.Box;
8
10
  /** The size of the box. */
9
11
  size: Vector3;
10
- constructor();
11
12
  }
@@ -1,10 +1,12 @@
1
1
  import { BaseShape } from "./BaseShape";
2
2
  import { ParticleShapeArcMode } from "./enums/ParticleShapeArcMode";
3
+ import { ParticleShapeType } from "./enums/ParticleShapeType";
3
4
  /**
4
5
  * Particle shape that emits particles from a circle.
5
6
  */
6
7
  export declare class CircleShape extends BaseShape {
7
8
  private static _tempPositionPoint;
9
+ readonly shapeType = ParticleShapeType.Circle;
8
10
  /** Radius of the shape to emit particles from. */
9
11
  radius: number;
10
12
  /** Angle of the circle arc to emit particles from. */
@@ -13,5 +15,4 @@ export declare class CircleShape extends BaseShape {
13
15
  arcMode: ParticleShapeArcMode;
14
16
  /** The speed of complete 360 degree rotation. */
15
17
  arcSpeed: number;
16
- constructor();
17
18
  }
@@ -1,4 +1,5 @@
1
1
  import { BaseShape } from "./BaseShape";
2
+ import { ParticleShapeType } from "./enums/ParticleShapeType";
2
3
  /**
3
4
  * Cone shape.
4
5
  */
@@ -7,6 +8,7 @@ export declare class ConeShape extends BaseShape {
7
8
  private static _tempVector21;
8
9
  private static _tempVector30;
9
10
  private static _tempVector31;
11
+ readonly shapeType = ParticleShapeType.Cone;
10
12
  /** Angle of the cone to emit particles from. */
11
13
  angle: number;
12
14
  /** Radius of the shape to emit particles from. */
@@ -15,7 +17,6 @@ export declare class ConeShape extends BaseShape {
15
17
  length: number;
16
18
  /** Cone emitter type. */
17
19
  emitType: ConeEmitType;
18
- constructor();
19
20
  }
20
21
  /**
21
22
  * Cone emitter type.
@@ -1,9 +1,10 @@
1
1
  import { BaseShape } from "./BaseShape";
2
+ import { ParticleShapeType } from "./enums/ParticleShapeType";
2
3
  /**
3
4
  * Particle shape that emits particles from a hemisphere.
4
5
  */
5
6
  export declare class HemisphereShape extends BaseShape {
7
+ readonly shapeType = ParticleShapeType.Hemisphere;
6
8
  /** Radius of the shape to emit particles from. */
7
9
  radius: number;
8
- constructor();
9
10
  }
@@ -1,9 +1,10 @@
1
1
  import { BaseShape } from "./BaseShape";
2
+ import { ParticleShapeType } from "./enums/ParticleShapeType";
2
3
  /**
3
4
  * Particle shape that emits particles from a sphere.
4
5
  */
5
6
  export declare class SphereShape extends BaseShape {
7
+ readonly shapeType = ParticleShapeType.Sphere;
6
8
  /** Radius of the shape to emit particles from. */
7
9
  radius: number;
8
- constructor();
9
10
  }
@@ -4,3 +4,4 @@ export { ConeShape, ConeEmitType } from "./ConeShape";
4
4
  export { HemisphereShape } from "./HemisphereShape";
5
5
  export { SphereShape } from "./SphereShape";
6
6
  export { ParticleShapeArcMode } from "./enums/ParticleShapeArcMode";
7
+ export { ParticleShapeType } from "./enums/ParticleShapeType";
@@ -1,5 +1,6 @@
1
1
  import { Entity } from "../Entity";
2
2
  import { Vector3 } from "@galacean/engine-math";
3
+ import { ColliderShape } from "./shape";
3
4
  /**
4
5
  * Structure used to get information back from a raycast or a sweep.
5
6
  */
@@ -12,4 +13,6 @@ export declare class HitResult {
12
13
  point: Vector3;
13
14
  /** The normal of the surface the ray hit. */
14
15
  normal: Vector3;
16
+ /** The shape of the collider that was hit. */
17
+ shape: ColliderShape;
15
18
  }
@@ -1,7 +1,12 @@
1
1
  export declare class ShaderFactory {
2
2
  static parseCustomMacros(macros: string[]): string;
3
3
  static registerInclude(includeName: string, includeSource: string): void;
4
- static parseIncludes(src: string): string;
4
+ static unRegisterInclude(includeName: string): void;
5
+ /**
6
+ * @param regex The default regex is for engine's builtin glsl `#include` syntax,
7
+ * since `ShaderLab` use the same parsing function but different syntax for `#include` --- `/^[ \t]*#include +"([\w\d.]+)"/gm`
8
+ */
9
+ static parseIncludes(src: string, regex?: RegExp): string;
5
10
  /**
6
11
  * Convert lower GLSL version to GLSL 300 es.
7
12
  * @param shader - code
@@ -28,7 +28,6 @@ export declare class CascadedShadowCasterPass extends PipelinePass {
28
28
  private _shadowSliceData;
29
29
  private _lightUp;
30
30
  private _lightSide;
31
- private _existShadowMap;
32
31
  private _splitBoundSpheres;
33
32
  /** The end is project precision problem in shader. */
34
33
  private _shadowMatrices;
@@ -76,4 +76,5 @@ export declare abstract class Texture extends GraphicsResource {
76
76
  */
77
77
  protected _getMaxMiplevel(size: number): number;
78
78
  protected _getMipmapCount(): number;
79
+ protected _isIntFormat(): boolean;
79
80
  }
@@ -20,56 +20,58 @@ export declare enum TextureFormat {
20
20
  R16G16B16A16 = 7,
21
21
  /** RGBA format, 32 bits per channel. */
22
22
  R32G32B32A32 = 8,
23
+ /** RGBA unsigned integer format, 32 bits per channel. */
24
+ R32G32B32A32_UInt = 9,
23
25
  /** RGB compressed format, 4 bits per pixel. */
24
- BC1 = 9,
26
+ BC1 = 10,
25
27
  /** RGBA compressed format, 8 bits per pixel. */
26
- BC3 = 10,
28
+ BC3 = 11,
27
29
  /** RGB(A) compressed format, 128 bits per 4x4 pixel block. */
28
- BC7 = 11,
30
+ BC7 = 12,
29
31
  /** RGB compressed format, 4 bits per pixel. */
30
- ETC1_RGB = 12,
32
+ ETC1_RGB = 13,
31
33
  /** RGB compressed format, 4 bits per pixel. */
32
- ETC2_RGB = 13,
34
+ ETC2_RGB = 14,
33
35
  /** RGBA compressed format, 5 bits per pixel, 4 bit in RGB, 1 bit in A. */
34
- ETC2_RGBA5 = 14,
36
+ ETC2_RGBA5 = 15,
35
37
  /** RGB compressed format, 8 bits per pixel. */
36
- ETC2_RGBA8 = 15,
38
+ ETC2_RGBA8 = 16,
37
39
  /** RGB compressed format, 2 bits per pixel. */
38
- PVRTC_RGB2 = 16,
40
+ PVRTC_RGB2 = 17,
39
41
  /** RGBA compressed format, 2 bits per pixel. */
40
- PVRTC_RGBA2 = 17,
42
+ PVRTC_RGBA2 = 18,
41
43
  /** RGB compressed format, 4 bits per pixel. */
42
- PVRTC_RGB4 = 18,
44
+ PVRTC_RGB4 = 19,
43
45
  /** RGBA compressed format, 4 bits per pixel. */
44
- PVRTC_RGBA4 = 19,
46
+ PVRTC_RGBA4 = 20,
45
47
  /** RGB(A) compressed format, 128 bits per 4x4 pixel block. */
46
- ASTC_4x4 = 20,
48
+ ASTC_4x4 = 21,
47
49
  /** RGB(A) compressed format, 128 bits per 5x5 pixel block. */
48
- ASTC_5x5 = 21,
50
+ ASTC_5x5 = 22,
49
51
  /** RGB(A) compressed format, 128 bits per 6x6 pixel block. */
50
- ASTC_6x6 = 22,
52
+ ASTC_6x6 = 23,
51
53
  /** RGB(A) compressed format, 128 bits per 8x8 pixel block. */
52
- ASTC_8x8 = 23,
54
+ ASTC_8x8 = 24,
53
55
  /** RGB(A) compressed format, 128 bits per 10x10 pixel block. */
54
- ASTC_10x10 = 24,
56
+ ASTC_10x10 = 25,
55
57
  /** RGB(A) compressed format, 128 bits per 12x12 pixel block. */
56
- ASTC_12x12 = 25,
58
+ ASTC_12x12 = 26,
57
59
  /** Automatic depth format, engine will automatically select the supported precision. */
58
- Depth = 26,
60
+ Depth = 27,
59
61
  /** Automatic depth stencil format, engine will automatically select the supported precision. */
60
- DepthStencil = 27,
62
+ DepthStencil = 28,
61
63
  /** 16-bit depth format. */
62
- Depth16 = 28,
64
+ Depth16 = 29,
63
65
  /** 24-bit depth format. */
64
- Depth24 = 29,
66
+ Depth24 = 30,
65
67
  /** 32-bit depth format. */
66
- Depth32 = 30,
68
+ Depth32 = 31,
67
69
  /** 16-bit depth + 8-bit stencil format. */
68
- Depth24Stencil8 = 31,
70
+ Depth24Stencil8 = 32,
69
71
  /** 32-bit depth + 8-bit stencil format. */
70
- Depth32Stencil8 = 32,
72
+ Depth32Stencil8 = 33,
71
73
  /** @deprecated Use `TextureFormat.BC1` instead. */
72
- DXT1 = 33,
74
+ DXT1 = 34,
73
75
  /** @deprecated Use `TextureFormat.BC3` instead. */
74
- DXT5 = 34
76
+ DXT5 = 35
75
77
  }