@galacean/engine-loader 1.2.0-beta.3 → 1.2.0-beta.4

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 (40) hide show
  1. package/LICENSE +2 -2
  2. package/dist/main.js +79 -42
  3. package/dist/main.js.map +1 -1
  4. package/dist/miniprogram.js +79 -42
  5. package/dist/module.js +80 -43
  6. package/dist/module.js.map +1 -1
  7. package/package.json +4 -4
  8. package/types/gltf/GLTFParser.d.ts +9 -0
  9. package/types/gltf/GLTFPipeline.d.ts +23 -0
  10. package/types/gltf/GLTFResource.d.ts +8 -6
  11. package/types/gltf/GLTFUtil.d.ts +53 -0
  12. package/types/gltf/Schema.d.ts +814 -0
  13. package/types/gltf/extensions/ExtensionParser.d.ts +8 -0
  14. package/types/gltf/extensions/KHR_draco_mesh_compression.d.ts +1 -0
  15. package/types/gltf/extensions/Schema.d.ts +142 -0
  16. package/types/gltf/parser/AnimationParser.d.ts +7 -0
  17. package/types/gltf/parser/BufferParser.d.ts +7 -0
  18. package/types/gltf/parser/EntityParser.d.ts +9 -0
  19. package/types/gltf/parser/GLTFAnimatorControllerParser.d.ts +7 -0
  20. package/types/gltf/parser/GLTFParserContext.d.ts +4 -2
  21. package/types/gltf/parser/MaterialParser.d.ts +8 -0
  22. package/types/gltf/parser/MeshParser.d.ts +13 -0
  23. package/types/gltf/parser/Parser.d.ts +21 -0
  24. package/types/gltf/parser/ParserContext.d.ts +46 -0
  25. package/types/gltf/parser/SceneParser.d.ts +11 -0
  26. package/types/gltf/parser/SkinParser.d.ts +6 -0
  27. package/types/gltf/parser/TextureParser.d.ts +8 -0
  28. package/types/gltf/parser/Validator.d.ts +5 -0
  29. package/types/gltf/parser/index.d.ts +1 -0
  30. package/types/ktx2/BinomialLLCTranscoder/BinomialLLCTranscoder.d.ts +13 -0
  31. package/types/ktx2/BinomialLLCTranscoder/TranscodeWorkerCode.d.ts +33 -0
  32. package/types/ktx2/KhronosTranscoder/KhronosTranscoder.d.ts +17 -0
  33. package/types/ktx2/KhronosTranscoder/TranscoderWorkerCode.d.ts +34 -0
  34. package/types/ktx2/TranscodeResult.d.ts +10 -0
  35. package/types/ktx2/constants.d.ts +7 -0
  36. package/types/ktx2/zstddec.d.ts +62 -0
  37. package/types/resource-deserialize/resources/animationClip/ComponentMap.d.ts +2 -0
  38. package/types/resource-deserialize/resources/parser/PrefabParser.d.ts +5 -0
  39. package/types/resource-deserialize/resources/prefab/PrefabDesign.d.ts +70 -0
  40. package/types/resource-deserialize/resources/prefab/ReflectionParser.d.ts +14 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacean/engine-loader",
3
- "version": "1.2.0-beta.3",
3
+ "version": "1.2.0-beta.4",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -15,9 +15,9 @@
15
15
  "types/**/*"
16
16
  ],
17
17
  "dependencies": {
18
- "@galacean/engine-core": "1.2.0-beta.3",
19
- "@galacean/engine-rhi-webgl": "1.2.0-beta.3",
20
- "@galacean/engine-math": "1.2.0-beta.3"
18
+ "@galacean/engine-core": "1.2.0-beta.4",
19
+ "@galacean/engine-rhi-webgl": "1.2.0-beta.4",
20
+ "@galacean/engine-math": "1.2.0-beta.4"
21
21
  },
22
22
  "scripts": {
23
23
  "b:types": "tsc"
@@ -0,0 +1,9 @@
1
+ import { AssetPromise } from "@galacean/engine-core";
2
+ import { GLTFResource } from "./GLTFResource";
3
+ import { ParserContext } from "./parser/ParserContext";
4
+ export declare class GLTFParser {
5
+ static defaultPipeline: GLTFParser;
6
+ private _pipes;
7
+ private constructor();
8
+ parse(context: ParserContext): AssetPromise<GLTFResource>;
9
+ }
@@ -0,0 +1,23 @@
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
+ }
@@ -1,20 +1,22 @@
1
- import { AnimationClip, Camera, Engine, Entity, Light, Material, ModelMesh, ReferResource, Skin, Texture2D } from "@galacean/engine-core";
1
+ import { AnimationClip, AnimatorController, Camera, Engine, Entity, Light, Material, ModelMesh, ReferResource, Skin, Texture2D } from "@galacean/engine-core";
2
2
  /**
3
3
  * Product after glTF parser, usually, `defaultSceneRoot` is only needed to use.
4
4
  */
5
5
  export declare class GLTFResource extends ReferResource {
6
6
  /** glTF file url. */
7
7
  readonly url: string;
8
- /** Texture2D after TextureParser. */
8
+ /** The array of loaded textures. */
9
9
  readonly textures?: Texture2D[];
10
- /** Material after MaterialParser. */
10
+ /** The array of loaded materials. */
11
11
  readonly materials?: Material[];
12
- /** ModelMesh after MeshParser. */
12
+ /** The array of loaded Meshes. */
13
13
  readonly meshes?: ModelMesh[][];
14
- /** Skin after SkinParser. */
14
+ /** The array of loaded skins. */
15
15
  readonly skins?: Skin[];
16
- /** AnimationClip after AnimationParser. */
16
+ /** The array of loaded animationClips. */
17
17
  readonly animations?: AnimationClip[];
18
+ /** The loaded AnimatorController. */
19
+ readonly animatorController?: AnimatorController;
18
20
  /** @internal */
19
21
  _defaultSceneRoot: Entity;
20
22
  /** @internal */
@@ -0,0 +1,53 @@
1
+ import { IndexFormat, TypedArray, VertexElementFormat } from "@galacean/engine-core";
2
+ import { Color, Vector2, Vector3, Vector4 } from "@galacean/engine-math";
3
+ import { BufferInfo, ParserContext } from "./parser/ParserContext";
4
+ import { AccessorComponentType, AccessorType, IAccessor, IBufferView, IGLTF } from "./Schema";
5
+ /**
6
+ * @internal
7
+ */
8
+ export declare class GLTFUtil {
9
+ static floatBufferToVector2Array(buffer: Float32Array): Vector2[];
10
+ static floatBufferToVector3Array(buffer: Float32Array): Vector3[];
11
+ static floatBufferToVector4Array(buffer: Float32Array): Vector4[];
12
+ static floatBufferToColorArray(buffer: Float32Array, isColor3: boolean): Color[];
13
+ /**
14
+ * Parse binary text for glb loader.
15
+ */
16
+ static decodeText(array: Uint8Array): string;
17
+ /**
18
+ * Get the number of bytes occupied by accessor type.
19
+ */
20
+ static getAccessorTypeSize(accessorType: AccessorType): number;
21
+ /**
22
+ * Get the TypedArray corresponding to the component type.
23
+ */
24
+ static getComponentType(componentType: AccessorComponentType): Int8ArrayConstructor | Uint8ArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Uint32ArrayConstructor | Float32ArrayConstructor;
25
+ static getNormalizedComponentScale(componentType: AccessorComponentType): number;
26
+ static getAccessorBuffer(context: ParserContext, gltf: IGLTF, accessor: IAccessor): BufferInfo;
27
+ /**
28
+ * @deprecated
29
+ * Get accessor data.
30
+ */
31
+ static getAccessorData(gltf: IGLTF, accessor: IAccessor, buffers: ArrayBuffer[]): TypedArray;
32
+ static getBufferViewData(bufferView: IBufferView, buffers: ArrayBuffer[]): ArrayBuffer;
33
+ /**
34
+ * Get accessor data.
35
+ */
36
+ static processingSparseData(gltf: IGLTF, accessor: IAccessor, buffers: ArrayBuffer[], originData: TypedArray): TypedArray;
37
+ static getIndexFormat(type: AccessorComponentType): IndexFormat;
38
+ static getElementFormat(type: AccessorComponentType, size: number, normalized?: boolean): VertexElementFormat;
39
+ /**
40
+ * Load image buffer
41
+ */
42
+ static loadImageBuffer(imageBuffer: ArrayBuffer, type: string): Promise<HTMLImageElement>;
43
+ static isAbsoluteUrl(url: string): boolean;
44
+ static parseRelativeUrl(baseUrl: string, relativeUrl: string): string;
45
+ /**
46
+ * Parse the glb format.
47
+ */
48
+ static parseGLB(glb: ArrayBuffer): {
49
+ gltf: IGLTF;
50
+ buffers: ArrayBuffer[];
51
+ };
52
+ private static _formatRelativePath;
53
+ }