@galacean/engine-core 0.0.0-experimental-1.0-xr.0 → 0.0.0-experimental-0.9-plus.7

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.
Files changed (116) hide show
  1. package/dist/main.js +16233 -17946
  2. package/dist/main.js.map +1 -1
  3. package/dist/miniprogram.js +16233 -17946
  4. package/dist/module.js +16229 -17935
  5. package/dist/module.js.map +1 -1
  6. package/package.json +3 -3
  7. package/types/2d/atlas/SpriteAtlas.d.ts +6 -2
  8. package/types/2d/data/RenderData2D.d.ts +1 -0
  9. package/types/2d/enums/SpriteDrawMode.d.ts +2 -4
  10. package/types/2d/index.d.ts +0 -1
  11. package/types/2d/sprite/Sprite.d.ts +2 -2
  12. package/types/2d/sprite/SpriteMask.d.ts +12 -2
  13. package/types/2d/sprite/SpriteRenderer.d.ts +12 -17
  14. package/types/2d/text/Font.d.ts +7 -2
  15. package/types/2d/text/TextRenderer.d.ts +12 -2
  16. package/types/2d/text/index.d.ts +0 -1
  17. package/types/Camera.d.ts +8 -27
  18. package/types/Component.d.ts +8 -0
  19. package/types/ComponentsDependencies.d.ts +9 -17
  20. package/types/Engine.d.ts +40 -33
  21. package/types/Entity.d.ts +1 -1
  22. package/types/RenderPipeline/Basic2DBatcher.d.ts +7 -6
  23. package/types/RenderPipeline/BasicRenderPipeline.d.ts +6 -8
  24. package/types/RenderPipeline/MeshRenderElement.d.ts +17 -0
  25. package/types/RenderPipeline/RenderElement.d.ts +7 -5
  26. package/types/RenderPipeline/RenderPass.d.ts +1 -1
  27. package/types/RenderPipeline/RenderQueue.d.ts +5 -3
  28. package/types/RenderPipeline/SpriteElement.d.ts +13 -0
  29. package/types/RenderPipeline/SpriteMaskBatcher.d.ts +3 -4
  30. package/types/RenderPipeline/SpriteMaskElement.d.ts +10 -0
  31. package/types/RenderPipeline/TextRenderElement.d.ts +6 -0
  32. package/types/Renderer.d.ts +14 -4
  33. package/types/SafeLoopArray.d.ts +37 -0
  34. package/types/Scene.d.ts +1 -0
  35. package/types/Script.d.ts +15 -18
  36. package/types/Transform.d.ts +12 -9
  37. package/types/Utils.d.ts +0 -28
  38. package/types/animation/AnimationClip.d.ts +1 -2
  39. package/types/animation/animationCurve/AnimationFloatArrayCurve.d.ts +1 -0
  40. package/types/animation/internal/AnimationCurveLayerOwner.d.ts +1 -0
  41. package/types/animation/internal/AnimationCurveOwnerLayerData.d.ts +1 -0
  42. package/types/asset/AssetType.d.ts +16 -16
  43. package/types/asset/IRefObject.d.ts +2 -0
  44. package/types/asset/RefObject.d.ts +27 -0
  45. package/types/asset/ResourceManager.d.ts +9 -17
  46. package/types/base/Constant.d.ts +1 -2
  47. package/types/base/EngineObject.d.ts +0 -1
  48. package/types/base/Event.d.ts +24 -0
  49. package/types/base/EventDispatcher.d.ts +14 -1
  50. package/types/base/Time.d.ts +24 -25
  51. package/types/base/Util.d.ts +14 -0
  52. package/types/base/index.d.ts +2 -0
  53. package/types/enums/ActiveChangeFlag.d.ts +6 -0
  54. package/types/env-probe/CubeProbe.d.ts +7 -0
  55. package/types/env-probe/Probe.d.ts +6 -0
  56. package/types/graphic/Buffer.d.ts +12 -5
  57. package/types/graphic/Mesh.d.ts +16 -5
  58. package/types/index.d.ts +7 -9
  59. package/types/input/InputManager.d.ts +1 -1
  60. package/types/input/interface/IInput.d.ts +1 -1
  61. package/types/lighting/DirectLight.d.ts +1 -0
  62. package/types/lighting/Light.d.ts +1 -0
  63. package/types/lighting/SpotLight.d.ts +1 -0
  64. package/types/material/BaseMaterial.d.ts +10 -8
  65. package/types/material/BlinnPhongMaterial.d.ts +3 -0
  66. package/types/material/Material.d.ts +10 -3
  67. package/types/material/PBRMaterial.d.ts +1 -1
  68. package/types/material/PBRSpecularMaterial.d.ts +1 -1
  69. package/types/material/UnlitMaterial.d.ts +1 -1
  70. package/types/mesh/BlendShape.d.ts +1 -1
  71. package/types/mesh/BlendShapeFrame.d.ts +6 -28
  72. package/types/mesh/MeshRenderer.d.ts +12 -3
  73. package/types/mesh/ModelMesh.d.ts +5 -5
  74. package/types/mesh/PrimitiveMesh.d.ts +2 -4
  75. package/types/mesh/SkinnedMeshRenderer.d.ts +15 -0
  76. package/types/particle/ParticleRenderer.d.ts +2 -2
  77. package/types/physics/CharacterController.d.ts +2 -0
  78. package/types/physics/Collider.d.ts +1 -1
  79. package/types/physics/PhysicsManager.d.ts +20 -1
  80. package/types/physics/PhysicsScene.d.ts +75 -0
  81. package/types/physics/joint/HingeJoint.d.ts +2 -2
  82. package/types/physics/joint/Joint.d.ts +2 -2
  83. package/types/physics/joint/SpringJoint.d.ts +1 -1
  84. package/types/renderingHardwareInterface/index.d.ts +0 -1
  85. package/types/shader/Shader.d.ts +23 -32
  86. package/types/shader/ShaderData.d.ts +24 -24
  87. package/types/shader/ShaderMacro.d.ts +0 -16
  88. package/types/shader/ShaderPass.d.ts +2 -9
  89. package/types/shader/ShaderProperty.d.ts +0 -7
  90. package/types/shader/index.d.ts +1 -4
  91. package/types/shader/state/index.d.ts +6 -0
  92. package/types/shadow/CascadedShadowCasterPass.d.ts +1 -0
  93. package/types/sky/Sky.d.ts +12 -4
  94. package/types/sky/SkyBoxMaterial.d.ts +9 -27
  95. package/types/sky/index.d.ts +0 -1
  96. package/types/texture/RenderTarget.d.ts +6 -2
  97. package/types/texture/Texture.d.ts +6 -2
  98. package/types/trail/TrailRenderer.d.ts +5 -0
  99. package/types/utils/BoolUpdateFlag.d.ts +12 -0
  100. package/types/utils/DisorderedArray.d.ts +18 -0
  101. package/types/utils/SafeLoopArray.d.ts +41 -0
  102. package/types/utils/UpdateFlag.d.ts +20 -0
  103. package/types/utils/UpdateFlagManager.d.ts +1 -0
  104. package/types/utils/Utils.d.ts +31 -0
  105. package/types/xr/XRCamera.d.ts +0 -13
  106. package/types/xr/XRHandle.d.ts +0 -12
  107. package/types/xr/XRInputManager.d.ts +0 -27
  108. package/types/xr/XRManager.d.ts +0 -41
  109. package/types/xr/enum/EnumXRButton.d.ts +0 -9
  110. package/types/xr/enum/EnumXREvent.d.ts +0 -10
  111. package/types/xr/enum/EnumXREye.d.ts +0 -5
  112. package/types/xr/enum/EnumXRFeature.d.ts +0 -5
  113. package/types/xr/enum/EnumXRHandedness.d.ts +0 -5
  114. package/types/xr/enum/EnumXRMode.d.ts +0 -5
  115. package/types/xr/enum/EnumXRSpaceType.d.ts +0 -7
  116. package/types/xr/index.d.ts +0 -10
@@ -0,0 +1,10 @@
1
+ import { RenderData2D } from "../2d/data/RenderData2D";
2
+ import { Material } from "../material/Material";
3
+ import { Renderer } from "../Renderer";
4
+ import { RenderElement } from "./RenderElement";
5
+ export declare class SpriteMaskElement extends RenderElement {
6
+ renderData: RenderData2D;
7
+ isAdd: boolean;
8
+ constructor();
9
+ setValue(component: Renderer, renderData: RenderData2D, material: Material): void;
10
+ }
@@ -0,0 +1,6 @@
1
+ import { RenderElement } from "./RenderElement";
2
+ import { SpriteElement } from "./SpriteElement";
3
+ export declare class TextRenderElement extends RenderElement {
4
+ charElements: SpriteElement[];
5
+ constructor();
6
+ }
@@ -1,12 +1,15 @@
1
- import { BoundingBox, Vector4 } from "@galacean/engine-math";
1
+ import { BoundingBox, Matrix, Vector4 } from "@galacean/engine-math";
2
2
  import { Component } from "./Component";
3
- import { Material } from "./material";
3
+ import { RenderContext } from "./RenderPipeline/RenderContext";
4
+ import { TransformModifyFlags } from "./Transform";
5
+ import { ICustomClone } from "./clone/ComponentCloner";
6
+ import { Material } from "./material/Material";
4
7
  import { ShaderData } from "./shader/ShaderData";
5
8
  /**
6
9
  * Basis for all renderers.
7
- * @decorator `@dependentComponents(Transform, DependentMode.CheckOnly)`
10
+ * @decorator `@dependentComponents(Transform)`
8
11
  */
9
- export declare class Renderer extends Component {
12
+ export declare class Renderer extends Component implements ICustomClone {
10
13
  private static _tempVector0;
11
14
  private static _receiveShadowMacro;
12
15
  private static _localMatrixProperty;
@@ -106,5 +109,12 @@ export declare class Renderer extends Component {
106
109
  */
107
110
  setMaterials(materials: Material[]): void;
108
111
  update(deltaTime: number): void;
112
+ protected _updateShaderData(context: RenderContext): void;
113
+ protected _updateTransformShaderData(context: RenderContext, worldMatrix: Matrix): void;
114
+ protected _registerEntityTransformListener(): void;
115
+ protected _updateBounds(worldBounds: BoundingBox): void;
116
+ protected _render(context: RenderContext): void;
117
+ private _createInstanceMaterial;
109
118
  private _setMaterial;
119
+ protected _onTransformChanged(type: TransformModifyFlags): void;
110
120
  }
@@ -0,0 +1,37 @@
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
+ * Splice the array.
16
+ * @param index - The index of the array
17
+ * @param deleteCount - The count of the array which want to be deleted
18
+ * @param item - The item which want to be added
19
+ */
20
+ splice(index: number, deleteCount: number, item?: T): void;
21
+ /**
22
+ * The index of the item.
23
+ * @param item - The item which want to get the index
24
+ * @returns Index of the item
25
+ */
26
+ indexOf(item: T): number;
27
+ /**
28
+ * Get the array.
29
+ * @returns The array
30
+ */
31
+ getArray(): ReadonlyArray<T>;
32
+ /**
33
+ * Get the array use for loop.
34
+ * @returns The array use for loop
35
+ */
36
+ getLoopArray(): ReadonlyArray<T>;
37
+ }
package/types/Scene.d.ts CHANGED
@@ -40,6 +40,7 @@ export declare class Scene extends EngineObject {
40
40
  private _fogEnd;
41
41
  private _fogDensity;
42
42
  private _fogParams;
43
+ private _sunlightVector3;
43
44
  /**
44
45
  * Number of cascades to use for directional light shadows.
45
46
  */
package/types/Script.d.ts CHANGED
@@ -2,7 +2,6 @@ import { Camera } from "./Camera";
2
2
  import { Component } from "./Component";
3
3
  import { Pointer } from "./input";
4
4
  import { ColliderShape } from "./physics";
5
- import { Collision } from "./physics/Collision";
6
5
  /**
7
6
  * Script class, used for logic writing.
8
7
  */
@@ -23,12 +22,12 @@ export declare class Script extends Component {
23
22
  onStart(): void;
24
23
  /**
25
24
  * The main loop, called frame by frame.
26
- * @param deltaTime - The delta time since last frame in seconds
25
+ * @param deltaTime - The deltaTime when the script update.
27
26
  */
28
27
  onUpdate(deltaTime: number): void;
29
28
  /**
30
29
  * Called after the onUpdate finished, called frame by frame.
31
- * @param deltaTime - The delta time since last frame in seconds
30
+ * @param deltaTime - The deltaTime when the script update.
32
31
  */
33
32
  onLateUpdate(deltaTime: number): void;
34
33
  /**
@@ -46,39 +45,37 @@ export declare class Script extends Component {
46
45
  */
47
46
  onPhysicsUpdate(): void;
48
47
  /**
49
- * Called when the trigger enter.
48
+ * Called when the collision enter.
50
49
  * @param other - ColliderShape
51
50
  */
52
51
  onTriggerEnter(other: ColliderShape): void;
53
52
  /**
54
- * Called when the trigger exit.
53
+ * Called when the collision stay.
54
+ * @remarks onTriggerStay is called every frame while the collision stay.
55
55
  * @param other - ColliderShape
56
56
  */
57
57
  onTriggerExit(other: ColliderShape): void;
58
58
  /**
59
- * Called when the trigger stay.
60
- * @remarks onTriggerStay is called every frame while the trigger stay.
59
+ * Called when the collision exit.
61
60
  * @param other - ColliderShape
62
61
  */
63
62
  onTriggerStay(other: ColliderShape): void;
64
63
  /**
65
64
  * Called when the collision enter.
66
- * @param other - The Collision data associated with this collision event
67
- * @remarks The Collision data will be invalid after this call, you should copy the data if needed.
65
+ * @param other - ColliderShape
68
66
  */
69
- onCollisionEnter(other: Collision): void;
67
+ onCollisionEnter(other: ColliderShape): void;
70
68
  /**
71
- * Called when the collision exit.
72
- * @param other - The Collision data associated with this collision event
73
- * @remarks The Collision data will be invalid after this call, you should copy the data if needed.
69
+ * Called when the collision stay.
70
+ * @remarks onTriggerStay is called every frame while the collision stay.
71
+ * @param other - ColliderShape
74
72
  */
75
- onCollisionExit(other: Collision): void;
73
+ onCollisionExit(other: ColliderShape): void;
76
74
  /**
77
- * Called when the collision stay.
78
- * @param other - The Collision data associated with this collision event
79
- * @remarks The Collision data will be invalid after this call, you should copy the data if needed.
75
+ * Called when the collision exit.
76
+ * @param other - ColliderShape
80
77
  */
81
- onCollisionStay(other: Collision): void;
78
+ onCollisionStay(other: ColliderShape): void;
82
79
  /**
83
80
  * Called when the pointer is down while over the ColliderShape.
84
81
  * @param pointer - The pointer that triggered
@@ -24,9 +24,6 @@ export declare class Transform extends Component {
24
24
  private _lossyWorldScale;
25
25
  private _localMatrix;
26
26
  private _worldMatrix;
27
- private _worldForward;
28
- private _worldRight;
29
- private _worldUp;
30
27
  private _isParentDirty;
31
28
  private _parentTransformCache;
32
29
  private _dirtyFlag;
@@ -138,17 +135,23 @@ export declare class Transform extends Component {
138
135
  */
139
136
  setWorldRotationQuaternion(x: number, y: number, z: number, w: number): void;
140
137
  /**
141
- * The forward direction in world space.
138
+ * Get the forward direction in world space.
139
+ * @param forward - Forward vector
140
+ * @returns Forward vector
142
141
  */
143
- get worldForward(): Vector3;
142
+ getWorldForward(forward: Vector3): Vector3;
144
143
  /**
145
- * The right direction in world space.
144
+ * Get the right direction in world space.
145
+ * @param right - Right vector
146
+ * @returns Right vector
146
147
  */
147
- get worldRight(): Vector3;
148
+ getWorldRight(right: Vector3): Vector3;
148
149
  /**
149
- * The up direction in world space.
150
+ * Get the up direction in world space.
151
+ * @param up - Up vector
152
+ * @returns Up vector
150
153
  */
151
- get worldUp(): Vector3;
154
+ getWorldUp(up: Vector3): Vector3;
152
155
  /**
153
156
  * Translate in the direction and distance of the translation.
154
157
  * @param translation - Direction and distance of translation
package/types/Utils.d.ts CHANGED
@@ -1,31 +1,3 @@
1
1
  export declare class Utils {
2
- /**
3
- * Fast remove an element from array.
4
- * @param array - Array
5
- * @param item - Element
6
- */
7
- static removeFromArray(array: any[], item: any): boolean;
8
- /**
9
- * Decodes a given Uint8Array into a string.
10
- */
11
- static decodeText(array: Uint8Array): string;
12
- /**
13
- * Judge whether the url is absolute url.
14
- * @param url - The url to be judged.
15
- * @returns Whether the url is absolute url.
16
- */
17
- static isAbsoluteUrl(url: string): boolean;
18
- /**
19
- * Get the values of an object.
20
- */
21
- static objectValues(obj: any): any[];
22
- /**
23
- * Convert a relative URL to an absolute URL based on a given base URL.
24
- * @param baseUrl - The base url.
25
- * @param relativeUrl - The relative url.
26
- * @returns The resolved url.
27
- */
28
- static resolveAbsoluteUrl(baseUrl: string, relativeUrl: string): string;
29
2
  private static _stringToPath;
30
- private static _formatRelativePath;
31
3
  }
@@ -1,4 +1,3 @@
1
- import { EngineObject } from "../base/EngineObject";
2
1
  import { Component } from "../Component";
3
2
  import { Entity } from "../Entity";
4
3
  import { AnimationClipCurveBinding } from "./AnimationClipCurveBinding";
@@ -8,7 +7,7 @@ import { KeyframeValueType } from "./Keyframe";
8
7
  /**
9
8
  * Stores keyframe based animations.
10
9
  */
11
- export declare class AnimationClip extends EngineObject {
10
+ export declare class AnimationClip {
12
11
  readonly name: string;
13
12
  private _length;
14
13
  private _events;
@@ -6,6 +6,7 @@ import { AnimationCurve } from "./AnimationCurve";
6
6
  export declare class AnimationFloatArrayCurve extends AnimationCurve<Float32Array> {
7
7
  /**
8
8
  * @inheritdoc
9
+ * @override
9
10
  */
10
11
  addKey(key: Keyframe<Float32Array>): void;
11
12
  }
@@ -6,47 +6,47 @@ export declare enum AssetType {
6
6
  * Plain text.
7
7
  * @remarks Will not be cached based on url in ResourceManager.
8
8
  */
9
- Text = "Text",
9
+ Text = "text",
10
10
  /**
11
11
  * JSON.
12
12
  * @remarks Will not be cached based on url in ResourceManager.
13
13
  */
14
- JSON = "JSON",
14
+ JSON = "json",
15
15
  /**
16
16
  * ArrayBuffer.
17
17
  * @remarks Will not be cached based on url in ResourceManager.
18
18
  */
19
- Buffer = "Buffer",
19
+ Buffer = "buffer",
20
20
  /** 2D Texture. */
21
- Texture2D = "Texture2D",
21
+ Texture2D = "texture2d",
22
22
  /** Cube Texture. */
23
- TextureCube = "TextureCube",
23
+ TextureCube = "texture-cube",
24
24
  /** Material. */
25
- Material = "Material",
25
+ Material = "material",
26
26
  /** Mesh. */
27
- Mesh = "Mesh",
27
+ Mesh = "mesh",
28
28
  /** AnimationClip. */
29
29
  AnimationClip = "AnimationClip",
30
30
  /** AnimatorController. */
31
31
  AnimatorController = "AnimatorController",
32
32
  /** Prefab.*/
33
- GLTF = "GLTF",
33
+ Prefab = "prefab",
34
34
  /** Compress Texture. */
35
- KTX = "KTX",
35
+ KTX = "ktx",
36
36
  /** Cube Compress Texture. */
37
- KTXCube = "KTXCube",
37
+ KTXCube = "ktx-cube",
38
38
  /** Sprite. */
39
- Sprite = "Sprite",
39
+ Sprite = "sprite",
40
40
  /** Sprite Atlas. */
41
- SpriteAtlas = "SpriteAtlas",
41
+ SpriteAtlas = "sprite-atlas",
42
42
  /** Ambient light. */
43
- Env = "Environment",
43
+ Env = "environment",
44
44
  /** Scene. */
45
- Scene = "Scene",
45
+ Scene = "scene",
46
46
  /** HDR to cube. */
47
47
  HDR = "HDR",
48
48
  /** Font. */
49
- Font = "Font",
49
+ Font = "font",
50
50
  /** Source Font, include ttf、 otf and woff. */
51
- SourceFont = "SourceFont"
51
+ SourceFont = "source-font"
52
52
  }
@@ -0,0 +1,2 @@
1
+ export interface IRefObject {
2
+ }
@@ -0,0 +1,27 @@
1
+ import { EngineObject } from "../base/EngineObject";
2
+ import { Engine } from "../Engine";
3
+ import { IRefObject } from "./IRefObject";
4
+ /**
5
+ * The base class of assets, with reference counting capability.
6
+ */
7
+ export declare abstract class RefObject extends EngineObject implements IRefObject {
8
+ /** Whether to ignore the garbage collection check, if it is true, it will not be affected by ResourceManager.gc(). */
9
+ isGCIgnored: boolean;
10
+ private _refCount;
11
+ /**
12
+ * Counted by valid references.
13
+ */
14
+ get refCount(): number;
15
+ protected constructor(engine: Engine);
16
+ /**
17
+ * Destroy self.
18
+ * @param force - Whether to force the destruction, if it is false, refCount = 0 can be released successfully.
19
+ * @returns Whether the release was successful.
20
+ */
21
+ destroy(force?: boolean): boolean;
22
+ /**
23
+ * Called when the resource is destroyed.
24
+ * Subclasses can override this function.
25
+ */
26
+ protected abstract _onDestroy(): void;
27
+ }
@@ -1,4 +1,4 @@
1
- import { ContentRestorer, Engine, EngineObject } from "..";
1
+ import { Engine } from "..";
2
2
  import { AssetPromise } from "./AssetPromise";
3
3
  import { Loader } from "./Loader";
4
4
  import { LoadItem } from "./LoadItem";
@@ -17,17 +17,14 @@ export declare class ResourceManager {
17
17
  retryInterval: number;
18
18
  /** The default timeout period for loading assets, in milliseconds. */
19
19
  timeout: number;
20
- private _loadingPromises;
21
- /** Asset path pool, key is the `instanceID` of resource, value is asset path. */
20
+ /** Asset path pool, key is asset ID, value is asset path */
22
21
  private _assetPool;
23
- /** Asset url pool, key is the asset path and the value is the asset. */
22
+ /** Asset pool, the key is the asset path and the value is the asset. */
24
23
  private _assetUrlPool;
25
- /** Referable resource pool, key is the `instanceID` of resource. */
26
- private _referResourcePool;
27
- /** Graphic resource pool, key is the `instanceID` of resource. */
28
- private _graphicResourcePool;
29
- /** Restorable resource information pool, key is the `instanceID` of resource. */
30
- private _contentRestorerPool;
24
+ /** Reference counted object pool, key is the object ID, and reference counted objects are put into this pool. */
25
+ private _refObjectPool;
26
+ /** Loading promises. */
27
+ private _loadingPromises;
31
28
  /**
32
29
  * Create a ResourceManager.
33
30
  * @param engine - Engine to which the current ResourceManager belongs
@@ -88,11 +85,6 @@ export declare class ResourceManager {
88
85
  * @remarks The release principle is that it is not referenced by the components, including direct and indirect reference.
89
86
  */
90
87
  gc(): void;
91
- /**
92
- * Add content restorer.
93
- * @param restorer - The restorer
94
- */
95
- addContentRestorer<T extends EngineObject>(restorer: ContentRestorer<T>): void;
96
88
  private _assignDefaultOptions;
97
89
  private _loadSingleItem;
98
90
  private _gc;
@@ -104,6 +96,6 @@ export declare class ResourceManager {
104
96
  /**
105
97
  * Declare ResourceLoader's decorator.
106
98
  * @param assetType - Type of asset
107
- * @param extNames - Name of file extension
99
+ * @param extnames - Name of file extension
108
100
  */
109
- export declare function resourceLoader(assetType: string, extNames: string[], useCache?: boolean): <T extends Loader<any>>(Target: new (useCache: boolean) => T) => void;
101
+ export declare function resourceLoader(assetType: string, extnames: string[], useCache?: boolean): <T extends Loader<any>>(Target: new (useCache: boolean) => T) => void;
@@ -105,7 +105,6 @@ export declare enum GLCapabilityType {
105
105
  pvrtc = "WEBGL_compressed_texture_pvrtc",
106
106
  pvrtc_webkit = "WEBKIT_WEBGL_compressed_texture_pvrtc",
107
107
  s3tc = "WEBGL_compressed_texture_s3tc",
108
- s3tc_webkit = "WEBKIT_WEBGL_compressed_texture_s3tc",
109
- WEBGL_lose_context = "WEBGL_lose_context"
108
+ s3tc_webkit = "WEBKIT_WEBGL_compressed_texture_s3tc"
110
109
  }
111
110
  export type TypedArray = Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array;
@@ -21,5 +21,4 @@ export declare abstract class EngineObject {
21
21
  * Destroy self.
22
22
  */
23
23
  destroy(): void;
24
- protected _onDestroy(): void;
25
24
  }
@@ -0,0 +1,24 @@
1
+ import { EventDispatcher } from "./EventDispatcher";
2
+ export type Listener = ((e: Event) => any) & {
3
+ once?: boolean;
4
+ };
5
+ /** Event Object. * @class */
6
+ export declare class Event {
7
+ get propagationStopped(): boolean;
8
+ get target(): EventDispatcher;
9
+ set target(t: EventDispatcher);
10
+ get timeStamp(): number;
11
+ get currentTarget(): EventDispatcher;
12
+ set currentTarget(t: EventDispatcher);
13
+ get bubbles(): boolean;
14
+ get type(): string | number;
15
+ data: any;
16
+ private _timeStamp;
17
+ private _target;
18
+ private _currentTarget;
19
+ private _bubbles;
20
+ private _propagationStopped;
21
+ private _type;
22
+ constructor(type: string | number, target?: EventDispatcher, data?: any, bubbles?: boolean);
23
+ stopPropagation(): void;
24
+ }
@@ -1,3 +1,4 @@
1
+ import { Event } from "./Event";
1
2
  /**
2
3
  * EventDispatcher, which can be inherited as a base class.
3
4
  */
@@ -43,6 +44,15 @@ export declare class EventDispatcher {
43
44
  * @returns This
44
45
  */
45
46
  once(event: string, fn: Function): EventDispatcher;
47
+ /**
48
+ * @deprecated Use `on/once` instead.
49
+ * Add a listener function with the specified event name.
50
+ * @param event - Event name
51
+ * @param fn - Function
52
+ * @param once - Is it a one-time listener
53
+ * @returns this
54
+ */
55
+ addEventListener(event: string, fn: Function, once?: boolean): EventDispatcher;
46
56
  /**
47
57
  * Remove the event listener(s) of the specified event name.
48
58
  * @param event - Event name
@@ -61,6 +71,9 @@ export declare class EventDispatcher {
61
71
  * @param event - Event name, delete all events if not passed
62
72
  */
63
73
  removeAllEventListeners(event?: string): void;
64
- private _addEventListener;
74
+ /**
75
+ * @deprecated Use `dispatch` instead.
76
+ */
77
+ trigger(e: Event): void;
65
78
  private _clearEvent;
66
79
  }
@@ -1,44 +1,43 @@
1
1
  /**
2
- * Provide time related information.
2
+ * Tools for calculating the time per frame.
3
3
  */
4
4
  export declare class Time {
5
5
  private static _elapsedTimeProperty;
6
- private static _deltaTimeProperty;
7
- private _frameCount;
6
+ private _clock;
7
+ private _timeScale;
8
8
  private _deltaTime;
9
- private _actualDeltaTime;
10
- private _elapsedTime;
11
- private _actualElapsedTime;
12
- private _lastSystemTime;
9
+ private _startTime;
10
+ private _lastTickTime;
13
11
  private _elapsedTimeValue;
14
- private _deltaTimeValue;
15
- /** Maximum delta time allowed per frame in seconds. */
16
- maximumDeltaTime: number;
17
- /** The scale of time. */
18
- timeScale: number;
19
12
  get frameCount(): number;
20
13
  /**
21
- * The delta time in seconds from the last frame to the current frame.
22
- *
23
- * @remarks When the frame rate is low or stutter occurs, `deltaTime` will not exceed the value of `maximumDeltaTime` * `timeScale`.
14
+ * Constructor of the Time.
15
+ */
16
+ constructor();
17
+ reset(): void;
18
+ /**
19
+ * Current Time
20
+ */
21
+ get nowTime(): number;
22
+ /**
23
+ * Time between two ticks
24
24
  */
25
25
  get deltaTime(): number;
26
26
  /**
27
- * The amount of elapsed time in seconds since the start of the engine.
27
+ * Scaled delta time.
28
28
  */
29
- get elapsedTime(): number;
29
+ get timeScale(): number;
30
+ set timeScale(s: number);
30
31
  /**
31
- * The actual delta time in seconds from the last frame to the current frame.
32
- *
33
- * @remarks The actual delta time is not affected by `maximumDeltaTime` and `timeScale`.
32
+ * Unscaled delta time.
34
33
  */
35
- get actualDeltaTime(): number;
34
+ get unscaledDeltaTime(): number;
36
35
  /**
37
- * The amount of actual elapsed time in seconds since the start of the engine.
36
+ * The elapsed time, after the clock is initialized.
38
37
  */
39
- get actualElapsedTime(): number;
38
+ get timeSinceStartup(): number;
40
39
  /**
41
- * Constructor of the Time.
40
+ * Call every frame, update delta time and other data.
42
41
  */
43
- constructor();
42
+ tick(): void;
44
43
  }
@@ -0,0 +1,14 @@
1
+ export declare const Util: {
2
+ isArray: (value: any) => boolean;
3
+ isArrayLike(x: any): boolean;
4
+ clone<T>(obj: T): T;
5
+ downloadBlob(blob: Blob, fileName?: string): void;
6
+ };
7
+ export declare const isArrayLike: <T>(x: any) => x is ArrayLike<T>;
8
+ /**
9
+ * Fastly remove an element from array.
10
+ * @param array - Array
11
+ * @param item - Element
12
+ */
13
+ export declare function removeFromArray(array: any[], item: any): boolean;
14
+ export declare function ObjectValues(obj: any): any[];
@@ -1,5 +1,7 @@
1
+ export { Event } from "./Event";
1
2
  export { EventDispatcher } from "./EventDispatcher";
2
3
  export { Logger } from "./Logger";
3
4
  export { Time } from "./Time";
5
+ export { Util, ObjectValues } from "./Util";
4
6
  export { EngineObject } from "./EngineObject";
5
7
  export * from "./Constant";
@@ -0,0 +1,6 @@
1
+ export declare enum ActiveChangeFlag {
2
+ None = 0,
3
+ Scene = 1,
4
+ Hierarchy = 2,
5
+ All = 3
6
+ }
@@ -9,8 +9,15 @@ export declare class CubeProbe extends Probe {
9
9
  * The position of the probe can be set, the default is the origin [0,0,0].
10
10
  */
11
11
  position: Vector3;
12
+ /**
13
+ * @override
14
+ */
15
+ protected readonly _isCube: boolean;
12
16
  private oriViewMatrix;
13
17
  private _oriFieldOfView;
18
+ /**
19
+ * @override
20
+ */
14
21
  onBeginRender(camera: Camera): void;
15
22
  /**
16
23
  * Store original camera parameters.
@@ -46,7 +46,13 @@ export declare abstract class Probe extends Script {
46
46
  * @remarks Prevent issue: Feedback Loops Between Textures and the Framebuffer.
47
47
  */
48
48
  onTextureChange(renderColorTexture: Texture): void;
49
+ /**
50
+ * @override
51
+ */
49
52
  onBeginRender(camera: Camera): void;
53
+ /**
54
+ * @override
55
+ */
50
56
  onEndRender(camera: Camera): void;
51
57
  protected _reset(): void;
52
58
  }