@galacean/engine-loader 1.0.0-alpha.6 → 1.0.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.
Files changed (36) hide show
  1. package/dist/main.js +1278 -1637
  2. package/dist/main.js.map +1 -1
  3. package/dist/miniprogram.js +1299 -1658
  4. package/dist/module.js +1280 -1624
  5. package/dist/module.js.map +1 -1
  6. package/package.json +5 -5
  7. package/types/AnimationClipLoader.d.ts +0 -1
  8. package/types/GLTFLoader.d.ts +4 -7
  9. package/types/gltf/GLTFResource.d.ts +11 -7
  10. package/types/gltf/GLTFUtil.d.ts +8 -8
  11. package/types/gltf/extensions/KHR_materials_variants.d.ts +1 -6
  12. package/types/gltf/extensions/index.d.ts +2 -5
  13. package/types/index.d.ts +2 -2
  14. package/types/resource-deserialize/resources/prefab/PrefabDesign.d.ts +4 -4
  15. package/types/GLTFContentRestorer.d.ts +0 -85
  16. package/types/Texture2DContentRestorer.d.ts +0 -14
  17. package/types/TextureCubeContentRestorer.d.ts +0 -14
  18. package/types/gltf/GLTFPipeline.d.ts +0 -23
  19. package/types/gltf/GLTFSchema.d.ts +0 -816
  20. package/types/gltf/extensions/GLTFExtensionParser.d.ts +0 -52
  21. package/types/gltf/extensions/GLTFExtensionSchema.d.ts +0 -149
  22. package/types/gltf/extensions/OASIS_animation_event.d.ts +0 -1
  23. package/types/gltf/extensions/OASIS_materials_remap.d.ts +0 -1
  24. package/types/gltf/index.d.ts +0 -6
  25. package/types/gltf/parser/GLTFAnimationParser.d.ts +0 -12
  26. package/types/gltf/parser/GLTFBufferParser.d.ts +0 -7
  27. package/types/gltf/parser/GLTFEntityParser.d.ts +0 -9
  28. package/types/gltf/parser/GLTFMaterialParser.d.ts +0 -15
  29. package/types/gltf/parser/GLTFMeshParser.d.ts +0 -19
  30. package/types/gltf/parser/GLTFParser.d.ts +0 -63
  31. package/types/gltf/parser/GLTFParserContext.d.ts +0 -48
  32. package/types/gltf/parser/GLTFSceneParser.d.ts +0 -11
  33. package/types/gltf/parser/GLTFSkinParser.d.ts +0 -6
  34. package/types/gltf/parser/GLTFTextureParser.d.ts +0 -8
  35. package/types/gltf/parser/GLTFValidator.d.ts +0 -6
  36. package/types/gltf/parser/index.d.ts +0 -11
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacean/engine-loader",
3
- "version": "1.0.0-alpha.6",
3
+ "version": "1.0.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-core": "1.0.0-alpha.6",
19
- "@galacean/engine-math": "1.0.0-alpha.6",
20
- "@galacean/engine-rhi-webgl": "1.0.0-alpha.6",
21
- "@galacean/engine-draco": "1.0.0-alpha.6"
18
+ "@galacean/engine-core": "1.0.0",
19
+ "@galacean/engine-draco": "1.0.0",
20
+ "@galacean/engine-math": "1.0.0",
21
+ "@galacean/engine-rhi-webgl": "1.0.0"
22
22
  },
23
23
  "scripts": {
24
24
  "b:types": "tsc"
@@ -1 +0,0 @@
1
- export {};
@@ -1,18 +1,15 @@
1
1
  import { AssetPromise, Loader, LoadItem, ResourceManager } from "@galacean/engine-core";
2
- import { GLTFPipeline } from "./gltf/GLTFPipeline";
3
2
  import { GLTFResource } from "./gltf/GLTFResource";
4
3
  export declare class GLTFLoader extends Loader<GLTFResource> {
5
- /**
6
- * @override
7
- */
8
4
  load(item: LoadItem, resourceManager: ResourceManager): Record<string, AssetPromise<any>>;
9
5
  }
10
6
  /**
11
7
  * GlTF loader params.
12
8
  */
13
9
  export interface GLTFParams {
14
- /** Keep raw mesh data for glTF parser, default is false. */
10
+ /**
11
+ * @beta Now only contains vertex information, need to improve.
12
+ * Keep raw mesh data for glTF parser, default is false.
13
+ */
15
14
  keepMeshData: boolean;
16
- /** Custom glTF pipeline. */
17
- pipeline: GLTFPipeline;
18
15
  }
@@ -1,9 +1,9 @@
1
- import { AnimationClip, Camera, Engine, EngineObject, Entity, Light, Material, ModelMesh, Skin, Texture2D } from "@galacean/engine-core";
1
+ import { AnimationClip, Camera, Engine, EngineObject, Entity, Light, Material, ModelMesh, Renderer, Skin, Texture2D } from "@galacean/engine-core";
2
2
  /**
3
- * Product after glTF parser, usually, `defaultSceneRoot` is only needed to use.
3
+ * Product after GLTF parser, usually, `defaultSceneRoot` is only needed to use.
4
4
  */
5
5
  export declare class GLTFResource extends EngineObject {
6
- /** glTF file url. */
6
+ /** GLTF file url. */
7
7
  url: string;
8
8
  /** Texture2D after TextureParser. */
9
9
  textures?: Texture2D[];
@@ -19,17 +19,21 @@ export declare class GLTFResource extends EngineObject {
19
19
  entities: Entity[];
20
20
  /** Camera after SceneParser. */
21
21
  cameras?: Camera[];
22
- /** Export lights in extension KHR_lights_punctual. */
22
+ /** Export lights in extension KHR_lights_punctual */
23
23
  lights?: Light[];
24
24
  /** RootEntities after SceneParser. */
25
25
  sceneRoots: Entity[];
26
26
  /** RootEntity after SceneParser. */
27
27
  defaultSceneRoot: Entity;
28
- /** Extensions data. */
29
- extensionsData: Record<string, any>;
28
+ /** Renderer can replace material by `renderer.setMaterial` if gltf use plugin-in KHR_materials_variants. */
29
+ variants?: {
30
+ renderer: Renderer;
31
+ material: Material;
32
+ variants: string[];
33
+ }[];
30
34
  constructor(engine: Engine, url: string);
31
35
  /**
32
36
  * @override
33
37
  */
34
- protected _onDestroy(): void;
38
+ destroy(): void;
35
39
  }
@@ -1,7 +1,7 @@
1
1
  import { IndexFormat, TypedArray, VertexElementFormat } from "@galacean/engine-core";
2
2
  import { Color, Vector2, Vector3, Vector4 } from "@galacean/engine-math";
3
- import { AccessorComponentType, AccessorType, IAccessor, IBufferView, IGLTF } from "./GLTFSchema";
4
- import { BufferInfo, GLTFParserContext } from "./parser/GLTFParserContext";
3
+ import { BufferInfo, ParserContext } from "./parser/ParserContext";
4
+ import { AccessorComponentType, AccessorType, IAccessor, IBufferView, IGLTF } from "./Schema";
5
5
  /**
6
6
  * @internal
7
7
  */
@@ -21,19 +21,19 @@ export declare class GLTFUtil {
21
21
  /**
22
22
  * Get the TypedArray corresponding to the component type.
23
23
  */
24
- static getComponentType(componentType: AccessorComponentType): Uint8ArrayConstructor | Int8ArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Uint32ArrayConstructor | Float32ArrayConstructor;
24
+ static getComponentType(componentType: AccessorComponentType): Uint8ArrayConstructor | Float32ArrayConstructor | Uint16ArrayConstructor | Int8ArrayConstructor | Int16ArrayConstructor | Uint32ArrayConstructor;
25
25
  static getNormalizedComponentScale(componentType: AccessorComponentType): number;
26
- static getAccessorBuffer(context: GLTFParserContext, bufferViews: IBufferView[], accessor: IAccessor): BufferInfo;
26
+ static getAccessorBuffer(context: ParserContext, gltf: IGLTF, accessor: IAccessor): BufferInfo;
27
27
  /**
28
28
  * @deprecated
29
29
  * Get accessor data.
30
30
  */
31
- static getAccessorData(glTF: IGLTF, accessor: IAccessor, buffers: ArrayBuffer[]): TypedArray;
31
+ static getAccessorData(gltf: IGLTF, accessor: IAccessor, buffers: ArrayBuffer[]): TypedArray;
32
32
  static getBufferViewData(bufferView: IBufferView, buffers: ArrayBuffer[]): ArrayBuffer;
33
33
  /**
34
34
  * Get accessor data.
35
35
  */
36
- static processingSparseData(bufferViews: IBufferView[], accessor: IAccessor, buffers: ArrayBuffer[], bufferInfo: BufferInfo): void;
36
+ static processingSparseData(gltf: IGLTF, accessor: IAccessor, buffers: ArrayBuffer[], originData: TypedArray): TypedArray;
37
37
  static getIndexFormat(type: AccessorComponentType): IndexFormat;
38
38
  static getElementFormat(type: AccessorComponentType, size: number, normalized?: boolean): VertexElementFormat;
39
39
  /**
@@ -45,8 +45,8 @@ export declare class GLTFUtil {
45
45
  /**
46
46
  * Parse the glb format.
47
47
  */
48
- static parseGLB(context: GLTFParserContext, glb: ArrayBuffer): {
49
- glTF: IGLTF;
48
+ static parseGLB(glb: ArrayBuffer): {
49
+ gltf: IGLTF;
50
50
  buffers: ArrayBuffer[];
51
51
  };
52
52
  private static _formatRelativePath;
@@ -1,6 +1 @@
1
- import { Material, Renderer } from "@galacean/engine-core";
2
- export type IGLTFExtensionVariants = Array<{
3
- renderer: Renderer;
4
- material: Material;
5
- variants: string[];
6
- }>;
1
+ export {};
@@ -6,12 +6,9 @@ import "./KHR_materials_pbrSpecularGlossiness";
6
6
  import "./KHR_materials_sheen";
7
7
  import "./KHR_materials_transmission";
8
8
  import "./KHR_materials_unlit";
9
- export type { IGLTFExtensionVariants } from "./KHR_materials_variants";
9
+ import "./KHR_materials_variants";
10
10
  import "./KHR_materials_volume";
11
11
  import "./KHR_mesh_quantization";
12
12
  import "./KHR_texture_basisu";
13
13
  import "./KHR_texture_transform";
14
- import "./Galacean_materials_remap";
15
- import "./OASIS_animation_event";
16
- export { GLTFExtensionParser, GLTFExtensionMode } from "./GLTFExtensionParser";
17
- export * from "./GLTFExtensionSchema";
14
+ import "./GALACEAN_materials_remap";
package/types/index.d.ts CHANGED
@@ -2,6 +2,7 @@ import "./AnimatorControllerLoader";
2
2
  import "./BufferLoader";
3
3
  import "./EnvLoader";
4
4
  import "./FontLoader";
5
+ import "./gltf/extensions/index";
5
6
  import "./GLTFLoader";
6
7
  import "./HDRLoader";
7
8
  import "./JSONLoader";
@@ -14,10 +15,9 @@ import "./SpriteAtlasLoader";
14
15
  import "./SpriteLoader";
15
16
  import "./Texture2DLoader";
16
17
  import "./TextureCubeLoader";
17
- import "./AnimationClipLoader";
18
18
  export { parseSingleKTX } from "./compressed-texture";
19
+ export { GLTFResource } from "./gltf/GLTFResource";
19
20
  export type { GLTFParams } from "./GLTFLoader";
20
21
  export * from "./resource-deserialize";
21
22
  export * from "./SceneLoader";
22
23
  export type { Texture2DParams } from "./Texture2DLoader";
23
- export * from "./gltf";
@@ -1,5 +1,5 @@
1
1
  import type { BackgroundMode } from "@galacean/engine-core";
2
- import { IReferable } from "@galacean/engine-core/types/asset/IReferable";
2
+ import { IRefObject } from "@galacean/engine-core/types/asset/IRefObject";
3
3
  import { IColor } from "../mesh/IModelMesh";
4
4
  export interface IPrefabFile {
5
5
  entities: Array<IEntity>;
@@ -9,11 +9,11 @@ export interface IScene extends IPrefabFile {
9
9
  background: {
10
10
  mode: BackgroundMode;
11
11
  color: IColor;
12
- texture?: IReferable;
13
- sky?: IReferable;
12
+ texture?: IRefObject;
13
+ sky?: IRefObject;
14
14
  };
15
15
  ambient: {
16
- ambientLight: IReferable;
16
+ ambientLight: IRefObject;
17
17
  diffuseSolidColor: IColor;
18
18
  diffuseIntensity: number;
19
19
  specularIntensity: number;
@@ -1,85 +0,0 @@
1
- import { AssetPromise, BlendShape, Buffer, ContentRestorer, ModelMesh, Texture2D } from "@galacean/engine-core";
2
- import { RequestConfig } from "@galacean/engine-core/types/asset/request";
3
- import { Vector2 } from "@galacean/engine-math";
4
- import { GLTFResource } from "./gltf/GLTFResource";
5
- import { IBufferView } from "./gltf/GLTFSchema";
6
- /**
7
- * @internal
8
- */
9
- export declare class GLTFContentRestorer extends ContentRestorer<GLTFResource> {
10
- isGLB: boolean;
11
- bufferRequests: BufferRequestInfo[];
12
- glbBufferSlices: Vector2[];
13
- bufferTextures: BufferTextureRestoreInfo[];
14
- meshes: ModelMeshRestoreInfo[];
15
- /**
16
- * @override
17
- */
18
- restoreContent(): AssetPromise<GLTFResource>;
19
- private _getBufferData;
20
- }
21
- /**
22
- * @internal
23
- */
24
- export declare class BufferRequestInfo {
25
- url: string;
26
- config: RequestConfig;
27
- constructor(url: string, config: RequestConfig);
28
- }
29
- /**
30
- * @internal
31
- */
32
- export declare class BufferTextureRestoreInfo {
33
- texture: Texture2D;
34
- bufferView: IBufferView;
35
- mimeType: string;
36
- constructor(texture: Texture2D, bufferView: IBufferView, mimeType: string);
37
- }
38
- /**
39
- * @internal
40
- */
41
- export declare class ModelMeshRestoreInfo {
42
- mesh: ModelMesh;
43
- vertexBuffers: BufferRestoreInfo[];
44
- indexBuffer: BufferDataRestoreInfo;
45
- blendShapes: BlendShapeRestoreInfo[];
46
- }
47
- /**
48
- * @internal
49
- */
50
- export declare class BufferRestoreInfo {
51
- buffer: Buffer;
52
- data: BufferDataRestoreInfo;
53
- constructor(buffer: Buffer, data: BufferDataRestoreInfo);
54
- }
55
- /**
56
- * @internal
57
- */
58
- export declare class BufferDataRestoreInfo {
59
- main: RestoreDataAccessor;
60
- typeSize?: number;
61
- sparseCount?: number;
62
- sparseIndices?: RestoreDataAccessor;
63
- sparseValues?: RestoreDataAccessor;
64
- constructor(main: RestoreDataAccessor, typeSize?: number, sparseCount?: number, sparseIndices?: RestoreDataAccessor, sparseValues?: RestoreDataAccessor);
65
- }
66
- /**
67
- * @internal
68
- */
69
- export declare class RestoreDataAccessor {
70
- bufferIndex: number;
71
- TypedArray: new (buffer: ArrayBuffer, byteOffset: number, length?: number) => ArrayBufferView;
72
- byteOffset: number;
73
- length: number;
74
- constructor(bufferIndex: number, TypedArray: new (buffer: ArrayBuffer, byteOffset: number, length?: number) => ArrayBufferView, byteOffset: number, length: number);
75
- }
76
- /**
77
- * @internal
78
- */
79
- export declare class BlendShapeRestoreInfo {
80
- blendShape: BlendShape;
81
- position: BufferDataRestoreInfo;
82
- normal?: BufferDataRestoreInfo;
83
- tangent?: BufferDataRestoreInfo;
84
- constructor(blendShape: BlendShape, position: BufferDataRestoreInfo, normal?: BufferDataRestoreInfo, tangent?: BufferDataRestoreInfo);
85
- }
@@ -1,14 +0,0 @@
1
- import { AssetPromise, ContentRestorer, Texture2D } from "@galacean/engine-core";
2
- import { RequestConfig } from "@galacean/engine-core/types/asset/request";
3
- /**
4
- * @internal
5
- */
6
- export declare class Texture2DContentRestorer extends ContentRestorer<Texture2D> {
7
- url: string;
8
- requestConfig: RequestConfig;
9
- constructor(resource: Texture2D, url: string, requestConfig: RequestConfig);
10
- /**
11
- * @override
12
- */
13
- restoreContent(): AssetPromise<Texture2D>;
14
- }
@@ -1,14 +0,0 @@
1
- import { AssetPromise, ContentRestorer, TextureCube } from "@galacean/engine-core";
2
- import { RequestConfig } from "@galacean/engine-core/types/asset/request";
3
- /**
4
- * @internal
5
- */
6
- export declare class TextureCubeContentRestorer extends ContentRestorer<TextureCube> {
7
- urls: string[];
8
- requestConfig: RequestConfig;
9
- constructor(resource: TextureCube, urls: string[], requestConfig: RequestConfig);
10
- /**
11
- * @override
12
- */
13
- restoreContent(): AssetPromise<TextureCube>;
14
- }
@@ -1,23 +0,0 @@
1
- import { AssetPromise } from "@galacean/engine-core";
2
- import { GLTFResource } from "./GLTFResource";
3
- import { GLTFParser } from "./parser/GLTFParser";
4
- import { GLTFParserContext } from "./parser/GLTFParserContext";
5
- /**
6
- * GLTF pipeline.
7
- */
8
- export declare class GLTFPipeline {
9
- /**
10
- * Default pipeline.
11
- */
12
- static defaultPipeline: GLTFPipeline;
13
- private _parsers;
14
- /**
15
- * Constructor of GLTFPipeline.
16
- * @param parsers - Parsers to be executed in order
17
- */
18
- constructor(...parsers: (new () => GLTFParser)[]);
19
- /**
20
- * @internal
21
- */
22
- _parse(context: GLTFParserContext): AssetPromise<GLTFResource>;
23
- }