@galacean/engine-loader 1.2.0-beta.5 → 1.2.0-beta.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 (41) hide show
  1. package/dist/main.js +52 -36
  2. package/dist/main.js.map +1 -1
  3. package/dist/miniprogram.js +52 -36
  4. package/dist/module.js +52 -36
  5. package/dist/module.js.map +1 -1
  6. package/package.json +4 -4
  7. package/types/PrefabLoader.d.ts +5 -0
  8. package/types/gltf/GLTFSchema.d.ts +1 -1
  9. package/types/gltf/extensions/EXT_meshopt_compression.d.ts +16 -3
  10. package/types/gltf/extensions/MeshoptDecoder.d.ts +10 -6
  11. package/types/prefab/PrefabParser.d.ts +11 -0
  12. package/types/prefab/PrefabResource.d.ts +25 -0
  13. package/types/resource-deserialize/resources/parser/CustomParser.d.ts +6 -0
  14. package/types/resource-deserialize/resources/scene/ISceneCustomParser.d.ts +6 -0
  15. package/types/resource-deserialize/resources/schema/SceneSchema.d.ts +2 -1
  16. package/types/gltf/GLTFParser.d.ts +0 -9
  17. package/types/gltf/GLTFPipeline.d.ts +0 -23
  18. package/types/gltf/GLTFUtil.d.ts +0 -53
  19. package/types/gltf/Schema.d.ts +0 -814
  20. package/types/gltf/extensions/ExtensionParser.d.ts +0 -8
  21. package/types/gltf/extensions/Schema.d.ts +0 -142
  22. package/types/gltf/parser/AnimationParser.d.ts +0 -7
  23. package/types/gltf/parser/BufferParser.d.ts +0 -7
  24. package/types/gltf/parser/EntityParser.d.ts +0 -9
  25. package/types/gltf/parser/MaterialParser.d.ts +0 -8
  26. package/types/gltf/parser/MeshParser.d.ts +0 -13
  27. package/types/gltf/parser/Parser.d.ts +0 -21
  28. package/types/gltf/parser/ParserContext.d.ts +0 -46
  29. package/types/gltf/parser/SceneParser.d.ts +0 -11
  30. package/types/gltf/parser/SkinParser.d.ts +0 -6
  31. package/types/gltf/parser/TextureParser.d.ts +0 -8
  32. package/types/gltf/parser/Validator.d.ts +0 -5
  33. package/types/ktx2/BinomialLLCTranscoder/BinomialLLCTranscoder.d.ts +0 -13
  34. package/types/ktx2/BinomialLLCTranscoder/TranscodeWorkerCode.d.ts +0 -33
  35. package/types/ktx2/KhronosTranscoder/KhronosTranscoder.d.ts +0 -17
  36. package/types/ktx2/KhronosTranscoder/TranscoderWorkerCode.d.ts +0 -34
  37. package/types/ktx2/TranscodeResult.d.ts +0 -10
  38. package/types/ktx2/constants.d.ts +0 -7
  39. package/types/ktx2/zstddec.d.ts +0 -62
  40. package/types/resource-deserialize/resources/prefab/PrefabDesign.d.ts +0 -70
  41. package/types/resource-deserialize/resources/prefab/ReflectionParser.d.ts +0 -14
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacean/engine-loader",
3
- "version": "1.2.0-beta.5",
3
+ "version": "1.2.0-beta.7",
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-math": "1.2.0-beta.5",
19
- "@galacean/engine-rhi-webgl": "1.2.0-beta.5",
20
- "@galacean/engine-core": "1.2.0-beta.5"
18
+ "@galacean/engine-math": "1.2.0-beta.7",
19
+ "@galacean/engine-rhi-webgl": "1.2.0-beta.7",
20
+ "@galacean/engine-core": "1.2.0-beta.7"
21
21
  },
22
22
  "scripts": {
23
23
  "b:types": "tsc"
@@ -0,0 +1,5 @@
1
+ import { AssetPromise, Loader, LoadItem, ResourceManager } from "@galacean/engine-core";
2
+ import { PrefabResource } from "./prefab/PrefabResource";
3
+ export declare class PrefabLoader extends Loader<PrefabResource> {
4
+ load(item: LoadItem, resourceManager: ResourceManager): AssetPromise<PrefabResource>;
5
+ }
@@ -694,7 +694,7 @@ export interface IScene extends IChildRootProperty {
694
694
  /**
695
695
  * The indices of each root node
696
696
  */
697
- nodes: number[];
697
+ nodes?: number[];
698
698
  }
699
699
  /**
700
700
  * Joints and matrices defining a skin
@@ -1,11 +1,24 @@
1
1
  declare module "@galacean/engine-core" {
2
2
  interface EngineConfiguration {
3
- /** glTF loader options. */
3
+ glTFLoader?: {
4
+ /** Meshopt options. If set this option and workCount is great than 0, workers will be created. */
5
+ meshOpt?: {
6
+ /**
7
+ * Worker count for transcoder.
8
+ * @defaultValue 4
9
+ */
10
+ workerCount?: number;
11
+ };
12
+ };
13
+ /** @deprecated glTF loader options. */
4
14
  glTF?: {
5
15
  /** Meshopt options. If set this option and workCount is great than 0, workers will be created. */
6
16
  meshOpt?: {
7
- /** Worker count for transcoder, default is 4. */
8
- workerCount: number;
17
+ /**
18
+ * Worker count for transcoder.
19
+ * @defaultValue 4
20
+ */
21
+ workerCount?: number;
9
22
  };
10
23
  };
11
24
  }
@@ -1,8 +1,12 @@
1
- declare const MeshoptDecoder: {
1
+ export declare let ready: Promise<{
2
2
  workerCount: number;
3
- ready: Promise<void>;
4
- useWorkers: () => void;
3
+ useWorkers: (count?: number) => void;
5
4
  decodeGltfBuffer: (count: any, stride: any, source: any, mode: any, filter: any) => Promise<Uint8Array>;
6
- release(): void;
7
- };
8
- export { MeshoptDecoder };
5
+ release: () => void;
6
+ }>;
7
+ export declare function getMeshoptDecoder(): Promise<{
8
+ workerCount: number;
9
+ useWorkers: (count?: number) => void;
10
+ decodeGltfBuffer: (count: any, stride: any, source: any, mode: any, filter: any) => Promise<Uint8Array>;
11
+ release: () => void;
12
+ }>;
@@ -0,0 +1,11 @@
1
+ import { Engine, Entity } from "@galacean/engine-core";
2
+ import { HierarchyParser } from "../resource-deserialize/resources/parser/HierarchyParser";
3
+ import { PrefabResource } from "./PrefabResource";
4
+ import { IHierarchyFile, ParserContext } from "../resource-deserialize";
5
+ export declare class PrefabParser extends HierarchyParser<PrefabResource, ParserContext<IHierarchyFile, Entity>> {
6
+ readonly prefabResource: PrefabResource;
7
+ static parse(engine: Engine, url: string, data: IHierarchyFile): Promise<PrefabResource>;
8
+ constructor(data: IHierarchyFile, context: ParserContext<IHierarchyFile, Entity>, prefabResource: PrefabResource);
9
+ protected _handleRootEntity(id: string): void;
10
+ protected _clearAndResolve(): PrefabResource;
11
+ }
@@ -0,0 +1,25 @@
1
+ import { Engine, Entity, ReferResource } from "@galacean/engine-core";
2
+ /**
3
+ * The Prefab resource.
4
+ */
5
+ export declare class PrefabResource extends ReferResource {
6
+ readonly url: string;
7
+ /** @internal */
8
+ _root: Entity;
9
+ private _dependenceAssets;
10
+ /**
11
+ * @internal
12
+ * @param url - The url of the prefab
13
+ */
14
+ constructor(engine: Engine, url: string);
15
+ /**
16
+ * Instantiate prefab.
17
+ * @returns prefab's root entity
18
+ */
19
+ instantiate(): Entity;
20
+ /**
21
+ * @internal
22
+ */
23
+ _addDependenceAsset(resource: ReferResource): void;
24
+ protected _onDestroy(): void;
25
+ }
@@ -0,0 +1,6 @@
1
+ import { Engine, Scene } from "@galacean/engine-core";
2
+ import { IScene } from "../schema";
3
+ import { ParserContext } from "./ParserContext";
4
+ export declare abstract class CustomParser {
5
+ onSceneParse(engine: Engine, context: ParserContext<IScene, Scene>, data: IScene): Promise<void>;
6
+ }
@@ -0,0 +1,6 @@
1
+ import { Engine, Scene } from "@galacean/engine-core";
2
+ import { IScene } from "../schema";
3
+ export interface ISceneCustomParser {
4
+ onBeforeParse(engine: Engine, data: IScene): void;
5
+ onAfterParse(engine: Engine, data: IScene, scene: Scene): void;
6
+ }
@@ -1,4 +1,4 @@
1
- import { BackgroundMode, DiffuseMode, FogMode, ShadowCascadesMode, ShadowResolution } from "@galacean/engine-core";
1
+ import { BackgroundMode, BackgroundTextureFillMode, DiffuseMode, FogMode, ShadowCascadesMode, ShadowResolution } from "@galacean/engine-core";
2
2
  import type { IReferable } from "@galacean/engine-core/types/asset/IReferable";
3
3
  import type { IColor, IPrefabFile, IVector3 } from "./BasicSchema";
4
4
  export declare enum SpecularMode {
@@ -11,6 +11,7 @@ export interface IScene extends IPrefabFile {
11
11
  mode: BackgroundMode;
12
12
  color: IColor;
13
13
  texture?: IReferable;
14
+ textureFillMode?: BackgroundTextureFillMode;
14
15
  skyMesh?: IReferable;
15
16
  skyMaterial?: IReferable;
16
17
  };
@@ -1,9 +0,0 @@
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
- }
@@ -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
- }
@@ -1,53 +0,0 @@
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
- }