@galacean/engine-loader 1.3.26 → 1.3.27

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-loader",
3
- "version": "1.3.26",
3
+ "version": "1.3.27",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -18,9 +18,9 @@
18
18
  "types/**/*"
19
19
  ],
20
20
  "dependencies": {
21
- "@galacean/engine-math": "1.3.26",
22
- "@galacean/engine-core": "1.3.26",
23
- "@galacean/engine-rhi-webgl": "1.3.26"
21
+ "@galacean/engine-math": "1.3.27",
22
+ "@galacean/engine-core": "1.3.27",
23
+ "@galacean/engine-rhi-webgl": "1.3.27"
24
24
  },
25
25
  "scripts": {
26
26
  "b:types": "tsc"
@@ -1,4 +1,4 @@
1
- import { IndexFormat, Texture2D, TypedArray, VertexElementFormat } from "@galacean/engine-core";
1
+ import { AssetPromise, IndexFormat, Texture2D, TypedArray, VertexElementFormat } from "@galacean/engine-core";
2
2
  import { Color, Vector2, Vector3, Vector4 } from "@galacean/engine-math";
3
3
  import { AccessorComponentType, AccessorType, IAccessor, IBufferView, IGLTF, ISampler, ISamplerInfo } from "./GLTFSchema";
4
4
  import { BufferInfo, GLTFParserContext } from "./parser/GLTFParserContext";
@@ -19,13 +19,13 @@ export declare class GLTFUtils {
19
19
  */
20
20
  static getComponentType(componentType: AccessorComponentType): Float32ArrayConstructor | Uint32ArrayConstructor | Uint8ArrayConstructor | Uint16ArrayConstructor | Int8ArrayConstructor | Int16ArrayConstructor;
21
21
  static getNormalizedComponentScale(componentType: AccessorComponentType): number;
22
- static getAccessorBuffer(context: GLTFParserContext, bufferViews: IBufferView[], accessor: IAccessor): Promise<BufferInfo>;
22
+ static getAccessorBuffer(context: GLTFParserContext, bufferViews: IBufferView[], accessor: IAccessor): AssetPromise<BufferInfo>;
23
23
  static bufferToVector3Array(buffer: TypedArray, byteOffset: number, count: number, normalized: boolean, componentType: AccessorComponentType): Vector3[];
24
24
  static getBufferViewData(bufferView: IBufferView, buffers: ArrayBuffer[]): ArrayBuffer;
25
25
  /**
26
26
  * Get accessor data.
27
27
  */
28
- static processingSparseData(context: GLTFParserContext, accessor: IAccessor, bufferInfo: BufferInfo): Promise<void>;
28
+ static processingSparseData(context: GLTFParserContext, accessor: IAccessor, bufferInfo: BufferInfo): AssetPromise<void>;
29
29
  static getIndexFormat(type: AccessorComponentType): IndexFormat;
30
30
  static getElementFormat(type: AccessorComponentType, size: number, normalized?: boolean): VertexElementFormat;
31
31
  /**
@@ -1,4 +1,4 @@
1
- import { EngineObject } from "@galacean/engine-core";
1
+ import { AssetPromise, EngineObject } from "@galacean/engine-core";
2
2
  import { GLTFExtensionOwnerSchema } from "../GLTFSchema";
3
3
  import { GLTFParserContext } from "../parser/GLTFParserContext";
4
4
  import { GLTFExtensionSchema } from "./GLTFExtensionSchema";
@@ -19,7 +19,7 @@ export declare abstract class GLTFExtensionParser {
19
19
  * @param extensionOwnerSchema - The extension owner schema
20
20
  * @returns The resource or promise
21
21
  */
22
- createAndParse(context: GLTFParserContext, extensionSchema: GLTFExtensionSchema, extensionOwnerSchema: GLTFExtensionOwnerSchema, ...extra: any[]): EngineObject | Promise<EngineObject | Uint8Array>;
22
+ createAndParse(context: GLTFParserContext, extensionSchema: GLTFExtensionSchema, extensionOwnerSchema: GLTFExtensionOwnerSchema, ...extra: any[]): EngineObject | AssetPromise<EngineObject | Uint8Array>;
23
23
  /**
24
24
  * Additive parse to the resource.
25
25
  * @param context - The parser context
@@ -28,7 +28,7 @@ export declare abstract class GLTFExtensionParser {
28
28
  * @param extensionOwnerSchema - The extension owner schema
29
29
  * @returns The void or promise
30
30
  */
31
- additiveParse(context: GLTFParserContext, parseResource: EngineObject, extensionSchema: GLTFExtensionSchema, extensionOwnerSchema: GLTFExtensionOwnerSchema, ...extra: any[]): void | Promise<void>;
31
+ additiveParse(context: GLTFParserContext, parseResource: EngineObject, extensionSchema: GLTFExtensionSchema, extensionOwnerSchema: GLTFExtensionOwnerSchema, ...extra: any[]): void | AssetPromise<void>;
32
32
  }
33
33
  /**
34
34
  * glTF Extension mode.
@@ -1,4 +1,4 @@
1
- import { AnimationClip } from "@galacean/engine-core";
1
+ import { AnimationClip, AssetPromise } from "@galacean/engine-core";
2
2
  import { IAnimation } from "../GLTFSchema";
3
3
  import { GLTFParser } from "./GLTFParser";
4
4
  import { GLTFParserContext } from "./GLTFParserContext";
@@ -6,7 +6,7 @@ export declare class GLTFAnimationParser extends GLTFParser {
6
6
  /**
7
7
  * @internal
8
8
  */
9
- static _parseStandardProperty(context: GLTFParserContext, animationClip: AnimationClip, animationInfo: IAnimation): Promise<AnimationClip>;
9
+ static _parseStandardProperty(context: GLTFParserContext, animationClip: AnimationClip, animationInfo: IAnimation): AssetPromise<AnimationClip>;
10
10
  private static _addCurve;
11
- parse(context: GLTFParserContext, index: number): Promise<AnimationClip>;
11
+ parse(context: GLTFParserContext, index: number): AssetPromise<AnimationClip>;
12
12
  }
@@ -1,7 +1,7 @@
1
- import { AnimatorController } from "@galacean/engine-core";
1
+ import { AnimatorController, AssetPromise } from "@galacean/engine-core";
2
2
  import { GLTFParser } from "./GLTFParser";
3
3
  import { GLTFParserContext } from "./GLTFParserContext";
4
4
  export declare class GLTFAnimatorControllerParser extends GLTFParser {
5
- parse(context: GLTFParserContext): Promise<AnimatorController>;
5
+ parse(context: GLTFParserContext): AssetPromise<AnimatorController>;
6
6
  private _createAnimatorController;
7
7
  }
@@ -1,6 +1,7 @@
1
+ import { AssetPromise } from "@galacean/engine-core";
1
2
  import { GLTFParser } from "./GLTFParser";
2
3
  import { GLTFParserContext } from "./GLTFParserContext";
3
4
  export declare class GLTFBufferParser extends GLTFParser {
4
- parse(context: GLTFParserContext, index: number): Promise<ArrayBuffer>;
5
+ parse(context: GLTFParserContext, index: number): AssetPromise<ArrayBuffer>;
5
6
  private _parseSingleBuffer;
6
7
  }
@@ -1,5 +1,6 @@
1
- import { GLTFParserContext } from "./GLTFParserContext";
1
+ import { AssetPromise } from "@galacean/engine-core";
2
2
  import { GLTFParser } from "./GLTFParser";
3
+ import { GLTFParserContext } from "./GLTFParserContext";
3
4
  export declare class GLTFBufferViewParser extends GLTFParser {
4
- parse(context: GLTFParserContext, index: number): Promise<Uint8Array>;
5
+ parse(context: GLTFParserContext, index: number): AssetPromise<Uint8Array>;
5
6
  }
@@ -1,11 +1,8 @@
1
- import { BlinnPhongMaterial, Engine, Material, PBRMaterial, PBRSpecularMaterial, UnlitMaterial } from "@galacean/engine-core";
1
+ import { AssetPromise, Material, PBRMaterial, PBRSpecularMaterial, UnlitMaterial } from "@galacean/engine-core";
2
2
  import { IMaterial, ITextureInfo } from "../GLTFSchema";
3
3
  import { GLTFParser } from "./GLTFParser";
4
4
  import { GLTFParserContext } from "./GLTFParserContext";
5
5
  export declare class GLTFMaterialParser extends GLTFParser {
6
- /** @internal */
7
- static _getDefaultMaterial(engine: Engine): BlinnPhongMaterial;
8
- private static _defaultMaterial;
9
6
  /**
10
7
  * @internal
11
8
  */
@@ -14,5 +11,5 @@ export declare class GLTFMaterialParser extends GLTFParser {
14
11
  * @internal
15
12
  */
16
13
  static _parseStandardProperty(context: GLTFParserContext, material: UnlitMaterial | PBRMaterial | PBRSpecularMaterial, materialInfo: IMaterial): void;
17
- parse(context: GLTFParserContext, index: number): Promise<Material>;
14
+ parse(context: GLTFParserContext, index: number): AssetPromise<Material>;
18
15
  }
@@ -1,4 +1,4 @@
1
- import { ModelMesh } from "@galacean/engine-core";
1
+ import { AssetPromise, ModelMesh } from "@galacean/engine-core";
2
2
  import { ModelMeshRestoreInfo } from "../../GLTFContentRestorer";
3
3
  import type { IGLTF, IMesh, IMeshPrimitive } from "../GLTFSchema";
4
4
  import { GLTFParser } from "./GLTFParser";
@@ -8,13 +8,13 @@ export declare class GLTFMeshParser extends GLTFParser {
8
8
  /**
9
9
  * @internal
10
10
  */
11
- static _parseMeshFromGLTFPrimitive(context: GLTFParserContext, mesh: ModelMesh, meshRestoreInfo: ModelMeshRestoreInfo, gltfMesh: IMesh, gltfPrimitive: IMeshPrimitive, gltf: IGLTF, keepMeshData: boolean): Promise<ModelMesh>;
11
+ static _parseMeshFromGLTFPrimitive(context: GLTFParserContext, mesh: ModelMesh, meshRestoreInfo: ModelMeshRestoreInfo, gltfMesh: IMesh, gltfPrimitive: IMeshPrimitive, gltf: IGLTF, keepMeshData: boolean): AssetPromise<ModelMesh>;
12
12
  private static _getBlendShapeData;
13
13
  /**
14
14
  * @internal
15
15
  */
16
16
  static _createBlendShape(context: GLTFParserContext, mesh: ModelMesh, meshRestoreInfo: ModelMeshRestoreInfo, glTFMesh: IMesh, gltfPrimitive: IMeshPrimitive, glTFTargets: {
17
17
  [name: string]: number;
18
- }[]): Promise<void>;
19
- parse(context: GLTFParserContext, index: number): Promise<ModelMesh[]>;
18
+ }[]): AssetPromise<void>;
19
+ parse(context: GLTFParserContext, index: number): AssetPromise<ModelMesh[]>;
20
20
  }
@@ -1,4 +1,4 @@
1
- import { EngineObject } from "@galacean/engine-core";
1
+ import { AssetPromise, EngineObject } from "@galacean/engine-core";
2
2
  import type { GLTFExtensionOwnerSchema } from "../GLTFSchema";
3
3
  import { GLTFExtensionMode, GLTFExtensionParser } from "../extensions/GLTFExtensionParser";
4
4
  import { GLTFParserContext } from "./GLTFParserContext";
@@ -17,7 +17,7 @@ export declare abstract class GLTFParser {
17
17
  */
18
18
  static executeExtensionsCreateAndParse(extensions: {
19
19
  [key: string]: any;
20
- }, context: GLTFParserContext, ownerSchema: GLTFExtensionOwnerSchema, ...extra: any[]): EngineObject | void | Promise<EngineObject | Uint8Array | void>;
20
+ }, context: GLTFParserContext, ownerSchema: GLTFExtensionOwnerSchema, ...extra: any[]): EngineObject | void | AssetPromise<EngineObject | Uint8Array | void>;
21
21
  /**
22
22
  * Execute all parses of extension to parse resource.
23
23
  * @param extensions - Related extensions field
@@ -1,4 +1,4 @@
1
- import { Buffer, Entity, ResourceManager, TypedArray } from "@galacean/engine-core";
1
+ import { AssetPromise, Buffer, Entity, ResourceManager, TypedArray } from "@galacean/engine-core";
2
2
  import { BufferDataRestoreInfo, GLTFContentRestorer } from "../../GLTFContentRestorer";
3
3
  import { GLTFParams } from "../../GLTFLoader";
4
4
  import { GLTFResource } from "../GLTFResource";
@@ -18,6 +18,8 @@ export declare class GLTFParserContext {
18
18
  contentRestorer: GLTFContentRestorer;
19
19
  buffers?: ArrayBuffer[];
20
20
  needAnimatorController: boolean;
21
+ /** @internal */
22
+ _getPromises: AssetPromise<unknown>[];
21
23
  private _resourceCache;
22
24
  private _progress;
23
25
  /** @internal */
@@ -27,12 +29,12 @@ export declare class GLTFParserContext {
27
29
  constructor(glTFResource: GLTFResource, resourceManager: ResourceManager, params: GLTFParams);
28
30
  get<T>(type: GLTFParserType.Entity, index: number): Entity;
29
31
  get<T>(type: GLTFParserType.Entity): Entity[];
30
- get<T>(type: GLTFParserType.Schema): Promise<T>;
31
- get<T>(type: GLTFParserType.Validator): Promise<T>;
32
- get<T>(type: GLTFParserType.AnimatorController): Promise<T>;
33
- get<T>(type: GLTFParserType, index: number): Promise<T>;
34
- get<T>(type: GLTFParserType): Promise<T[]>;
35
- parse(): Promise<GLTFResource>;
32
+ get<T>(type: GLTFParserType.Schema): AssetPromise<T>;
33
+ get<T>(type: GLTFParserType.Validator): AssetPromise<T>;
34
+ get<T>(type: GLTFParserType.AnimatorController): AssetPromise<T>;
35
+ get<T>(type: GLTFParserType, index: number): AssetPromise<T>;
36
+ get<T>(type: GLTFParserType): AssetPromise<T[]>;
37
+ parse(): AssetPromise<GLTFResource>;
36
38
  /**
37
39
  * @internal
38
40
  */
@@ -40,7 +42,7 @@ export declare class GLTFParserContext {
40
42
  /**
41
43
  * @internal
42
44
  */
43
- _addTaskCompletePromise(taskPromise: Promise<any>): void;
45
+ _addTaskCompletePromise(taskPromise: PromiseLike<any>): void;
44
46
  private _handleSubAsset;
45
47
  }
46
48
  /**
@@ -1,8 +1,8 @@
1
- import { Entity } from "@galacean/engine-core";
1
+ import { AssetPromise, Entity } from "@galacean/engine-core";
2
2
  import { GLTFParser } from "./GLTFParser";
3
3
  import { GLTFParserContext } from "./GLTFParserContext";
4
4
  export declare class GLTFSceneParser extends GLTFParser {
5
- parse(context: GLTFParserContext, index: number): Promise<Entity>;
5
+ parse(context: GLTFParserContext, index: number): AssetPromise<Entity>;
6
6
  private _parseEntityComponent;
7
7
  private _createCamera;
8
8
  private _createRenderer;
@@ -1,7 +1,7 @@
1
- import { Skin } from "@galacean/engine-core";
1
+ import { AssetPromise, Skin } from "@galacean/engine-core";
2
2
  import { GLTFParser } from "./GLTFParser";
3
3
  import { GLTFParserContext } from "./GLTFParserContext";
4
4
  export declare class GLTFSkinParser extends GLTFParser {
5
- parse(context: GLTFParserContext, index: number): Promise<Skin>;
5
+ parse(context: GLTFParserContext, index: number): AssetPromise<Skin>;
6
6
  private _findSkeletonRootBone;
7
7
  }
@@ -1,4 +1,4 @@
1
- import { Texture, Texture2D, TextureWrapMode } from "@galacean/engine-core";
1
+ import { AssetPromise, Texture, Texture2D, TextureWrapMode } from "@galacean/engine-core";
2
2
  import { GLTFParser } from "./GLTFParser";
3
3
  import { GLTFParserContext } from "./GLTFParserContext";
4
4
  export declare class GLTFTextureParser extends GLTFParser {
@@ -9,6 +9,6 @@ export declare class GLTFTextureParser extends GLTFParser {
9
9
  10497: TextureWrapMode;
10
10
  };
11
11
  /** @internal */
12
- static _parseTexture(context: GLTFParserContext, imageIndex: number, textureIndex: number, sampler?: number, textureName?: string): Promise<Texture2D>;
13
- parse(context: GLTFParserContext, textureIndex: number): Promise<Texture>;
12
+ static _parseTexture(context: GLTFParserContext, imageIndex: number, textureIndex: number, sampler?: number, textureName?: string): AssetPromise<Texture2D>;
13
+ parse(context: GLTFParserContext, textureIndex: number): AssetPromise<Texture>;
14
14
  }
@@ -1,5 +1,6 @@
1
+ import { AssetPromise } from "@galacean/engine-core";
1
2
  import { GLTFParser } from "./GLTFParser";
2
3
  import { GLTFParserContext } from "./GLTFParserContext";
3
4
  export declare class GLTFValidator extends GLTFParser {
4
- parse(context: GLTFParserContext): Promise<void>;
5
+ parse(context: GLTFParserContext): AssetPromise<void>;
5
6
  }
@@ -1,4 +1,4 @@
1
- import { Engine } from "@galacean/engine-core";
1
+ import { AssetPromise, Engine } from "@galacean/engine-core";
2
2
  export { MeshDecoder } from "./resources/mesh/MeshDecoder";
3
3
  export { Texture2DDecoder } from "./resources/texture2D/TextureDecoder";
4
4
  export { ReflectionParser } from "./resources/parser/ReflectionParser";
@@ -10,7 +10,7 @@ export type { IModelMesh } from "./resources/mesh/IModelMesh";
10
10
  * @param engine - engine
11
11
  * @returns
12
12
  */
13
- export declare function decode<T>(arrayBuffer: ArrayBuffer, engine: Engine): Promise<T>;
13
+ export declare function decode<T>(arrayBuffer: ArrayBuffer, engine: Engine): AssetPromise<T>;
14
14
  export * from "./resources/schema";
15
15
  export * from "./resources/scene/SceneParser";
16
16
  export * from "./resources/scene/EditorTextureLoader";
@@ -1,4 +1,4 @@
1
- import { AnimationClip, Engine } from "@galacean/engine-core";
1
+ import { AnimationClip, AssetPromise, Engine } from "@galacean/engine-core";
2
2
  import type { BufferReader } from "../../utils/BufferReader";
3
3
  export declare enum InterpolableValueType {
4
4
  Float = 0,
@@ -14,5 +14,5 @@ export declare enum InterpolableValueType {
14
14
  ReferResource = 10
15
15
  }
16
16
  export declare class AnimationClipDecoder {
17
- static decode(engine: Engine, bufferReader: BufferReader): Promise<AnimationClip>;
17
+ static decode(engine: Engine, bufferReader: BufferReader): AssetPromise<AnimationClip>;
18
18
  }
@@ -1,9 +1,9 @@
1
- import type { Engine } from "@galacean/engine-core";
1
+ import { AssetPromise, Engine } from "@galacean/engine-core";
2
2
  import { ModelMesh } from "@galacean/engine-core";
3
3
  import type { BufferReader } from "../../utils/BufferReader";
4
4
  /**
5
5
  * @todo refactor
6
6
  */
7
7
  export declare class MeshDecoder {
8
- static decode(engine: Engine, bufferReader: BufferReader): Promise<ModelMesh>;
8
+ static decode(engine: Engine, bufferReader: BufferReader): AssetPromise<ModelMesh>;
9
9
  }
@@ -1,5 +1,5 @@
1
- import { Engine, Texture2D } from "@galacean/engine-core";
1
+ import { AssetPromise, Engine, Texture2D } from "@galacean/engine-core";
2
2
  import { BufferReader } from "../../utils/BufferReader";
3
3
  export declare class Texture2DDecoder {
4
- static decode(engine: Engine, bufferReader: BufferReader): Promise<Texture2D>;
4
+ static decode(engine: Engine, bufferReader: BufferReader): AssetPromise<Texture2D>;
5
5
  }
@@ -1,7 +1,7 @@
1
- import { Engine } from "@galacean/engine-core";
1
+ import { AssetPromise, Engine } from "@galacean/engine-core";
2
2
  import type { BufferReader } from "./BufferReader";
3
3
  export declare const decoderMap: Record<string, {
4
- decode: (engine: Engine, bufferReader: BufferReader) => Promise<any>;
4
+ decode: (engine: Engine, bufferReader: BufferReader) => AssetPromise<any>;
5
5
  }>;
6
6
  /**
7
7
  * Decoder decorator generator.