@galacean/engine-loader 1.0.0 → 1.0.2

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 (65) hide show
  1. package/dist/main.js +1764 -1208
  2. package/dist/main.js.map +1 -1
  3. package/dist/miniprogram.js +1784 -1228
  4. package/dist/module.js +1751 -1210
  5. package/dist/module.js.map +1 -1
  6. package/package.json +5 -5
  7. package/types/AnimationClipLoader.d.ts +1 -0
  8. package/types/GLTFContentRestorer.d.ts +92 -0
  9. package/types/GLTFLoader.d.ts +3 -0
  10. package/types/ProjectLoader.d.ts +1 -0
  11. package/types/Texture2DContentRestorer.d.ts +11 -0
  12. package/types/TextureCubeContentRestorer.d.ts +11 -0
  13. package/types/gltf/GLTFPipeline.d.ts +23 -0
  14. package/types/gltf/GLTFResource.d.ts +7 -15
  15. package/types/gltf/GLTFSchema.d.ts +816 -0
  16. package/types/gltf/GLTFUtil.d.ts +1 -1
  17. package/types/gltf/GLTFUtils.d.ts +48 -0
  18. package/types/gltf/extensions/GALACEAN_animation_event.d.ts +1 -0
  19. package/types/gltf/extensions/GLTFExtensionParser.d.ts +52 -0
  20. package/types/gltf/extensions/GLTFExtensionSchema.d.ts +149 -0
  21. package/types/gltf/extensions/KHR_materials_ior.d.ts +1 -0
  22. package/types/gltf/extensions/KHR_materials_variants.d.ts +6 -1
  23. package/types/gltf/extensions/index.d.ts +5 -1
  24. package/types/gltf/index.d.ts +6 -0
  25. package/types/gltf/parser/GLTFAnimationParser.d.ts +12 -0
  26. package/types/gltf/parser/GLTFBufferParser.d.ts +7 -0
  27. package/types/gltf/parser/GLTFEntityParser.d.ts +9 -0
  28. package/types/gltf/parser/GLTFMaterialParser.d.ts +15 -0
  29. package/types/gltf/parser/GLTFMeshParser.d.ts +19 -0
  30. package/types/gltf/parser/GLTFParser.d.ts +63 -0
  31. package/types/gltf/parser/GLTFParserContext.d.ts +53 -0
  32. package/types/gltf/parser/GLTFSceneParser.d.ts +11 -0
  33. package/types/gltf/parser/GLTFSchemaParser.d.ts +7 -0
  34. package/types/gltf/parser/GLTFSkinParser.d.ts +7 -0
  35. package/types/gltf/parser/GLTFTextureParser.d.ts +9 -0
  36. package/types/gltf/parser/GLTFValidator.d.ts +6 -0
  37. package/types/gltf/parser/index.d.ts +11 -0
  38. package/types/index.d.ts +2 -2
  39. package/types/ktx2/BinomialLLCTranscoder/BinomialLLCTranscoder.d.ts +13 -0
  40. package/types/ktx2/BinomialLLCTranscoder/TranscodeWorkerCode.d.ts +33 -0
  41. package/types/ktx2/KTX2Container.d.ts +72 -0
  42. package/types/ktx2/KTX2Loader.d.ts +53 -0
  43. package/types/ktx2/KTX2TargetFormat.d.ts +21 -0
  44. package/types/ktx2/KhronosTranscoder/KhronosTranscoder.d.ts +17 -0
  45. package/types/ktx2/KhronosTranscoder/TranscoderWorkerCode.d.ts +34 -0
  46. package/types/ktx2/TranscodeResult.d.ts +10 -0
  47. package/types/ktx2/WorkerPool.d.ts +32 -0
  48. package/types/ktx2/constants.d.ts +7 -0
  49. package/types/ktx2/transcoder/AbstractTranscoder.d.ts +55 -0
  50. package/types/ktx2/transcoder/BinomialLLCTranscoder.d.ts +8 -0
  51. package/types/ktx2/transcoder/BinomialLLCWorkerCode.d.ts +6 -0
  52. package/types/ktx2/transcoder/KhronosTranscoder.d.ts +13 -0
  53. package/types/ktx2/transcoder/KhronosWorkerCode.d.ts +1 -0
  54. package/types/ktx2/zstddec.d.ts +62 -0
  55. package/types/resource-deserialize/index.d.ts +3 -3
  56. package/types/resource-deserialize/resources/mesh/MeshDecoder.d.ts +1 -1
  57. package/types/resource-deserialize/resources/parser/PrefabParser.d.ts +5 -0
  58. package/types/resource-deserialize/resources/parser/ReflectionParser.d.ts +14 -0
  59. package/types/resource-deserialize/resources/scene/SceneParser.d.ts +1 -1
  60. package/types/resource-deserialize/resources/scene/SceneParserContext.d.ts +1 -1
  61. package/types/resource-deserialize/resources/schema/BasicSchema.d.ts +61 -0
  62. package/types/resource-deserialize/resources/schema/MaterialSchema.d.ts +91 -0
  63. package/types/resource-deserialize/resources/schema/ProjectSchema.d.ts +9 -0
  64. package/types/resource-deserialize/resources/schema/SceneSchema.d.ts +41 -0
  65. package/types/resource-deserialize/resources/schema/index.d.ts +3 -0
@@ -0,0 +1,72 @@
1
+ export declare enum SupercompressionScheme {
2
+ None = 0,
3
+ BasisLZ = 1,
4
+ Zstd = 2,
5
+ ZLib = 3
6
+ }
7
+ /** @internal */
8
+ export declare class KTX2Container {
9
+ vkFormat: number;
10
+ typeSize: number;
11
+ pixelWidth: number;
12
+ pixelHeight: number;
13
+ pixelDepth: number;
14
+ layerCount: number;
15
+ faceCount: number;
16
+ supercompressionScheme: SupercompressionScheme;
17
+ levels: KTX2Level[];
18
+ dataFormatDescriptor: KTX2DataFormatDescriptorBasicFormat;
19
+ keyValue: {
20
+ [key: string]: string | Uint8Array;
21
+ };
22
+ globalData: KTX2GlobalDataBasisLZ | null;
23
+ constructor(buffer: Uint8Array);
24
+ get isSRGB(): boolean;
25
+ get isUASTC(): boolean;
26
+ private parse;
27
+ }
28
+ interface KTX2Level {
29
+ levelData: Uint8Array;
30
+ uncompressedByteLength: number;
31
+ }
32
+ interface KTX2DataFormatDescriptorBasicFormat {
33
+ vendorId: number;
34
+ descriptorType: number;
35
+ versionNumber: number;
36
+ /** @deprecated Inferred. */
37
+ descriptorBlockSize: number;
38
+ colorModel: number;
39
+ colorPrimaries: number;
40
+ transferFunction: number;
41
+ flags: number;
42
+ texelBlockDimension: [number, number, number, number];
43
+ bytesPlane: [number, number, number, number, number, number, number, number];
44
+ samples: KTX2BasicFormatSample[];
45
+ }
46
+ interface KTX2BasicFormatSample {
47
+ bitOffset: number;
48
+ bitLength: number;
49
+ /** @deprecated Renamed to 'channelType'. */
50
+ channelID?: number;
51
+ channelType: number;
52
+ samplePosition: number[];
53
+ sampleLower: number;
54
+ sampleUpper: number;
55
+ }
56
+ interface KTX2GlobalDataBasisLZ {
57
+ endpointCount: number;
58
+ selectorCount: number;
59
+ imageDescs: KTX2GlobalDataBasisLZImageDesc[];
60
+ endpointsData: Uint8Array;
61
+ selectorsData: Uint8Array;
62
+ tablesData: Uint8Array;
63
+ extendedData: Uint8Array;
64
+ }
65
+ interface KTX2GlobalDataBasisLZImageDesc {
66
+ imageFlags: number;
67
+ rgbSliceByteOffset: number;
68
+ rgbSliceByteLength: number;
69
+ alphaSliceByteOffset: number;
70
+ alphaSliceByteLength: number;
71
+ }
72
+ export {};
@@ -0,0 +1,53 @@
1
+ import { AssetPromise, Engine, EngineConfiguration, LoadItem, Loader, ResourceManager, Texture2D, TextureCube } from "@galacean/engine-core";
2
+ import { KTX2TargetFormat } from "./KTX2TargetFormat";
3
+ import { TranscodeResult } from "./transcoder/AbstractTranscoder";
4
+ export declare class KTX2Loader extends Loader<Texture2D | TextureCube> {
5
+ private static _isBinomialInit;
6
+ private static _binomialLLCTranscoder;
7
+ private static _khronosTranscoder;
8
+ private static _supportedMap;
9
+ /**
10
+ * Destroy ktx2 transcoder worker.
11
+ */
12
+ static destroy(): void;
13
+ /** @internal */
14
+ static _parseBuffer(buffer: Uint8Array, engine: Engine, params?: KTX2Params): Promise<{
15
+ engine: Engine;
16
+ result: TranscodeResult;
17
+ targetFormat: KTX2TargetFormat;
18
+ params: Uint8Array;
19
+ }>;
20
+ /** @internal */
21
+ static _createTextureByBuffer(engine: Engine, transcodeResult: TranscodeResult, targetFormat: KTX2TargetFormat, params?: Uint8Array): Texture2D | TextureCube;
22
+ private static _decideTargetFormat;
23
+ private static _detectSupportedFormat;
24
+ private static _getBinomialLLCTranscoder;
25
+ private static _getKhronosTranscoder;
26
+ private static _getEngineTextureFormat;
27
+ initialize(engine: Engine, configuration: EngineConfiguration): Promise<void>;
28
+ /**
29
+ * @internal
30
+ */
31
+ load(item: LoadItem & {
32
+ params?: KTX2Params;
33
+ }, resourceManager: ResourceManager): AssetPromise<Texture2D | TextureCube>;
34
+ private _isKhronosSupported;
35
+ }
36
+ /**
37
+ * KTX2 loader params interface.
38
+ */
39
+ export interface KTX2Params {
40
+ /** Priority transcoding format queue, default is ASTC/ETC/DXT/PVRTC/RGBA8. */
41
+ priorityFormats: KTX2TargetFormat[];
42
+ }
43
+ declare module "@galacean/engine-core" {
44
+ interface EngineConfiguration {
45
+ /** KTX2 loader options. */
46
+ ktx2Loader?: {
47
+ /** Worker count for transcoder, default is 4. */
48
+ workerCount?: number;
49
+ /** Pre-initialization according to the priority transcoding format queue, default is ASTC/ETC/DXT/PVRTC/RGBA8. */
50
+ priorityFormats?: KTX2TargetFormat[] | KTX2TargetFormat[][];
51
+ };
52
+ }
53
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * KTX2 transcode target format.
3
+ */
4
+ export declare enum KTX2TargetFormat {
5
+ /** RGB(A) compressed format, 128 bits per 4x4 pixel block. */
6
+ ASTC = 0,
7
+ /** RGB(A) compressed format, 128 bits per 4x4 pixel block. */
8
+ BC7 = 1,
9
+ /** RGB(A) compressed format, 4 bits per pixel if no alpha channel, 8 bits per pixel if has alpha channel. */
10
+ BC1_BC3 = 2,
11
+ /** RGB(A) compressed format, 4 bits per pixel. */
12
+ PVRTC = 3,
13
+ /** RGB(A) compressed format, 4 bits per pixel if no alpha channel, 8 bits per pixel if has alpha channel. */
14
+ ETC = 4,
15
+ /** R format, 8 bits per pixel. */
16
+ R8 = 5,
17
+ /** RG format, 16 bits per pixel. */
18
+ R8G8 = 6,
19
+ /** RGBA format, 32 bits per pixel. */
20
+ R8G8B8A8 = 7
21
+ }
@@ -0,0 +1,17 @@
1
+ import { KTX2Container } from "../KTX2Container";
2
+ import { KTX2TargetFormat } from "../KTX2TargetFormat";
3
+ import { TranscodeResult } from "./TranscoderWorkerCode";
4
+ /** @internal */
5
+ export declare class KhronosTranscoder {
6
+ readonly workerLimit: number;
7
+ readonly type: KTX2TargetFormat;
8
+ static transcoderMap: {
9
+ 0: string;
10
+ };
11
+ private _transcodeWorkerPool;
12
+ private _initPromise;
13
+ constructor(workerLimit: number, type: KTX2TargetFormat);
14
+ init(): Promise<any>;
15
+ transcode(ktx2Container: KTX2Container): Promise<TranscodeResult>;
16
+ destroy(): void;
17
+ }
@@ -0,0 +1,34 @@
1
+ export interface EncodedData {
2
+ buffer: Uint8Array;
3
+ levelWidth: number;
4
+ levelHeight: number;
5
+ uncompressedByteLength: number;
6
+ }
7
+ type MessageType = "init" | "transcode";
8
+ export interface IBaseMessage {
9
+ type: MessageType;
10
+ }
11
+ export interface IInitMessage extends IBaseMessage {
12
+ type: "init";
13
+ transcoderWasm: ArrayBuffer;
14
+ }
15
+ export interface ITranscodeMessage extends IBaseMessage {
16
+ type: "transcode";
17
+ format: number;
18
+ needZstd: boolean;
19
+ data: EncodedData[][];
20
+ }
21
+ export type IMessage = IInitMessage | ITranscodeMessage;
22
+ export type TranscodeResult = {
23
+ data: Array<{
24
+ data: Uint8Array;
25
+ width: number;
26
+ height: number;
27
+ }>;
28
+ };
29
+ export type TranscodeResponse = {
30
+ id: number;
31
+ type: "transcoded";
32
+ } & TranscodeResult;
33
+ export declare function TranscodeWorkerCode(): void;
34
+ export {};
@@ -0,0 +1,10 @@
1
+ export interface TranscodeResult {
2
+ width: number;
3
+ height: number;
4
+ hasAlpha: boolean;
5
+ mipmaps: Array<{
6
+ data: Uint8Array;
7
+ width: number;
8
+ height: number;
9
+ }>;
10
+ }
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @internal
3
+ * WorkerPool, T is is post message type, U is return type.
4
+ */
5
+ export declare class WorkerPool<T = any, U = any> {
6
+ readonly limitedCount: number;
7
+ private readonly _workerCreator;
8
+ private _taskQueue;
9
+ private _workerStatus;
10
+ private _workerItems;
11
+ /**
12
+ * Constructor of WorkerPool.
13
+ * @param limitedCount - worker limit count
14
+ * @param _workerCreator - creator of worker
15
+ */
16
+ constructor(limitedCount: number, _workerCreator: () => Worker | Promise<Worker>);
17
+ prepareWorker(): Promise<Worker[]>;
18
+ /**
19
+ * Post message to worker.
20
+ * @param message - Message which posted to worker
21
+ * @returns Return a promise of message
22
+ */
23
+ postMessage(message: T): Promise<U>;
24
+ /**
25
+ * Destroy the worker pool.
26
+ */
27
+ destroy(): void;
28
+ private _initWorker;
29
+ private _getIdleWorkerId;
30
+ private _onMessage;
31
+ private _nextTask;
32
+ }
@@ -0,0 +1,7 @@
1
+ export declare enum SupercompressionScheme {
2
+ None = 0,
3
+ BasisLZ = 1,
4
+ Zstd = 2,
5
+ ZLib = 3
6
+ }
7
+ export declare const KHR_DF_SAMPLE_DATATYPE_SIGNED = 64;
@@ -0,0 +1,55 @@
1
+ import { WorkerPool } from "../WorkerPool";
2
+ export declare abstract class AbstractTranscoder {
3
+ readonly workerLimitCount: number;
4
+ protected _transcodeWorkerPool: WorkerPool;
5
+ protected _initPromise: Promise<any>;
6
+ constructor(workerLimitCount: number);
7
+ init(): Promise<any>;
8
+ destroy(): void;
9
+ protected abstract _initTranscodeWorkerPool(): Promise<any>;
10
+ protected _createTranscodePool(workerURL: string, wasmBuffer: ArrayBuffer): Promise<Worker[]>;
11
+ }
12
+ type MessageType = "init" | "transcode";
13
+ export interface BaseMessage {
14
+ type: MessageType;
15
+ }
16
+ export interface InitMessage extends BaseMessage {
17
+ type: "init";
18
+ transcoderWasm: ArrayBuffer;
19
+ }
20
+ export interface BinomialTranscodeMessage extends BaseMessage {
21
+ type: "transcode";
22
+ format: number;
23
+ buffer: ArrayBuffer;
24
+ }
25
+ export type IBinomialMessage = InitMessage | BinomialTranscodeMessage;
26
+ export type TranscodeResult = {
27
+ width: number;
28
+ height: number;
29
+ hasAlpha: boolean;
30
+ format: number;
31
+ faces: Array<{
32
+ data: Uint8Array;
33
+ width: number;
34
+ height: number;
35
+ }>[];
36
+ faceCount: number;
37
+ };
38
+ export type TranscodeResponse = {
39
+ id: number;
40
+ type: "transcoded";
41
+ } & TranscodeResult;
42
+ export interface EncodedData {
43
+ buffer: Uint8Array;
44
+ levelWidth: number;
45
+ levelHeight: number;
46
+ uncompressedByteLength: number;
47
+ }
48
+ export interface KhronosTranscoderMessage extends BaseMessage {
49
+ type: "transcode";
50
+ format: number;
51
+ needZstd: boolean;
52
+ data: EncodedData[][];
53
+ }
54
+ export type IKhronosMessageMessage = InitMessage | KhronosTranscoderMessage;
55
+ export {};
@@ -0,0 +1,8 @@
1
+ import { KTX2TargetFormat } from "../KTX2TargetFormat";
2
+ import { AbstractTranscoder, TranscodeResult } from "./AbstractTranscoder";
3
+ /** @internal */
4
+ export declare class BinomialLLCTranscoder extends AbstractTranscoder {
5
+ constructor(workerLimitCount: number);
6
+ _initTranscodeWorkerPool(): Promise<any>;
7
+ transcode(buffer: ArrayBuffer, format: KTX2TargetFormat): Promise<TranscodeResult>;
8
+ }
@@ -0,0 +1,6 @@
1
+ import { TranscodeResult } from "./AbstractTranscoder";
2
+ /** @internal */
3
+ export declare function TranscodeWorkerCode(): void;
4
+ export declare const _init: () => (wasmBinary?: ArrayBuffer) => any;
5
+ export declare const init: (wasmBinary?: ArrayBuffer) => any;
6
+ export declare function transcode(buffer: ArrayBuffer, targetFormat: any, KTX2File: any): TranscodeResult;
@@ -0,0 +1,13 @@
1
+ import { KTX2Container } from "../KTX2Container";
2
+ import { KTX2TargetFormat } from "../KTX2TargetFormat";
3
+ import { AbstractTranscoder, TranscodeResult } from "./AbstractTranscoder";
4
+ /** @internal */
5
+ export declare class KhronosTranscoder extends AbstractTranscoder {
6
+ readonly type: KTX2TargetFormat;
7
+ static transcoderMap: {
8
+ 0: string;
9
+ };
10
+ constructor(workerLimitCount: number, type: KTX2TargetFormat);
11
+ _initTranscodeWorkerPool(): Promise<Worker[]>;
12
+ transcode(ktx2Container: KTX2Container): Promise<TranscodeResult>;
13
+ }
@@ -0,0 +1 @@
1
+ export declare function TranscodeWorkerCode(): void;
@@ -0,0 +1,62 @@
1
+ /**
2
+ * From https://github.com/donmccurdy/zstddec by Don McCurdy
3
+ */
4
+ interface DecoderExports {
5
+ memory: Uint8Array;
6
+ ZSTD_findDecompressedSize: (compressedPtr: number, compressedSize: number) => number;
7
+ ZSTD_decompress: (uncompressedPtr: number, uncompressedSize: number, compressedPtr: number, compressedSize: number) => number;
8
+ malloc: (ptr: number) => number;
9
+ free: (ptr: number) => void;
10
+ }
11
+ /**
12
+ * ZSTD (Zstandard) decoder.
13
+ */
14
+ export declare class ZSTDDecoder {
15
+ static heap: Uint8Array;
16
+ static IMPORT_OBJECT: {
17
+ env: {
18
+ emscripten_notify_memory_growth: () => void;
19
+ };
20
+ };
21
+ static instance: {
22
+ exports: DecoderExports;
23
+ };
24
+ static WasmModuleURL: string;
25
+ _initPromise: Promise<any>;
26
+ init(): Promise<void>;
27
+ _init(result: WebAssembly.WebAssemblyInstantiatedSource): void;
28
+ decode(array: Uint8Array, uncompressedSize?: number): Uint8Array;
29
+ }
30
+ export {};
31
+ /**
32
+ * BSD License
33
+ *
34
+ * For Zstandard software
35
+ *
36
+ * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. All rights reserved.
37
+ *
38
+ * Redistribution and use in source and binary forms, with or without modification,
39
+ * are permitted provided that the following conditions are met:
40
+ *
41
+ * * Redistributions of source code must retain the above copyright notice, this
42
+ * list of conditions and the following disclaimer.
43
+ *
44
+ * * Redistributions in binary form must reproduce the above copyright notice,
45
+ * this list of conditions and the following disclaimer in the documentation
46
+ * and/or other materials provided with the distribution.
47
+ *
48
+ * * Neither the name Facebook nor the names of its contributors may be used to
49
+ * endorse or promote products derived from this software without specific
50
+ * prior written permission.
51
+ *
52
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
53
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
54
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
55
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
56
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
57
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
58
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
59
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
60
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
61
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
62
+ */
@@ -1,8 +1,8 @@
1
1
  import { Engine } from "@galacean/engine-core";
2
2
  export { MeshDecoder } from "./resources/mesh/MeshDecoder";
3
3
  export { Texture2DDecoder } from "./resources/texture2D/TextureDecoder";
4
- export { ReflectionParser } from "./resources/prefab/ReflectionParser";
5
- export { PrefabParser } from "./resources/prefab/PrefabParser";
4
+ export { ReflectionParser } from "./resources/parser/ReflectionParser";
5
+ export { PrefabParser } from "./resources/parser/PrefabParser";
6
6
  export * from "./resources/animationClip/AnimationClipDecoder";
7
7
  export type { IModelMesh } from "./resources/mesh/IModelMesh";
8
8
  /**
@@ -12,7 +12,7 @@ export type { IModelMesh } from "./resources/mesh/IModelMesh";
12
12
  * @returns
13
13
  */
14
14
  export declare function decode<T>(arrayBuffer: ArrayBuffer, engine: Engine): Promise<T>;
15
- export * from "./resources/prefab/PrefabDesign";
15
+ export * from "./resources/schema";
16
16
  export * from "./resources/scene/SceneParser";
17
17
  export * from "./resources/scene/MeshLoader";
18
18
  export * from "./resources/scene/EditorTextureLoader";
@@ -1,5 +1,5 @@
1
- import { ModelMesh } from "@galacean/engine-core";
2
1
  import type { Engine } from "@galacean/engine-core";
2
+ import { ModelMesh } from "@galacean/engine-core";
3
3
  import type { BufferReader } from "../../utils/BufferReader";
4
4
  /**
5
5
  * @todo refactor
@@ -0,0 +1,5 @@
1
+ import { Entity } from "@galacean/engine-core";
2
+ import type { IEntity } from "../schema";
3
+ export declare class PrefabParser {
4
+ static parseChildren(entitiesConfig: Map<string, IEntity>, entities: Map<string, Entity>, parentId: string): void;
5
+ }
@@ -0,0 +1,14 @@
1
+ import { Engine, Entity } from "@galacean/engine-core";
2
+ import type { IBasicType, IClassObject, IEntity } from "../schema";
3
+ export declare class ReflectionParser {
4
+ static customParseComponentHandles: Map<string, Function>;
5
+ static registerCustomParseComponent(componentType: string, handle: Function): void;
6
+ static parseEntity(entityConfig: IEntity, engine: Engine): Promise<Entity>;
7
+ private static getEntityByConfig;
8
+ static parseClassObject(item: IClassObject, engine: Engine, resourceManager?: any): Promise<any>;
9
+ static parseBasicType(value: IBasicType, engine: Engine, resourceManager?: any): Promise<any>;
10
+ static parsePropsAndMethods(instance: any, item: Omit<IClassObject, "class">, engine: Engine, resourceManager?: any): Promise<any>;
11
+ static parseMethod(instance: any, methodName: string, methodParams: Array<IBasicType>, engine: Engine, resourceManager?: any): Promise<any>;
12
+ private static _isClass;
13
+ private static _isRef;
14
+ }
@@ -1,5 +1,5 @@
1
1
  import { Engine, Scene } from "@galacean/engine-core";
2
- import { IScene } from "../prefab/PrefabDesign";
2
+ import type { IScene } from "../schema";
3
3
  import { SceneParserContext } from "./SceneParserContext";
4
4
  /** @Internal */
5
5
  export declare class SceneParser {
@@ -1,5 +1,5 @@
1
1
  import { Component, Entity, Scene } from "@galacean/engine-core";
2
- import { IEntity, IScene } from "../prefab/PrefabDesign";
2
+ import type { IEntity, IScene } from "../schema";
3
3
  export declare class SceneParserContext {
4
4
  readonly originalData: IScene;
5
5
  readonly scene: Scene;
@@ -0,0 +1,61 @@
1
+ export interface IVector3 {
2
+ x: number;
3
+ y: number;
4
+ z: number;
5
+ }
6
+ export interface IVector2 {
7
+ x: number;
8
+ y: number;
9
+ }
10
+ export interface IVector4 {
11
+ x: number;
12
+ y: number;
13
+ z: number;
14
+ w: number;
15
+ }
16
+ export interface IColor {
17
+ r: number;
18
+ g: number;
19
+ b: number;
20
+ a: number;
21
+ }
22
+ export interface IPrefabFile {
23
+ entities: Array<IEntity>;
24
+ }
25
+ export type IMethodParams = Array<IBasicType>;
26
+ export type IClassObject = {
27
+ class: string;
28
+ constructParams?: IMethodParams;
29
+ methods?: {
30
+ [methodName: string]: Array<IMethodParams>;
31
+ };
32
+ props?: {
33
+ [key: string]: IBasicType | IMethodParams;
34
+ };
35
+ };
36
+ export type IBasicType = string | number | boolean | null | undefined | IAssetRef | IClassObject | IMethodParams;
37
+ export type IAssetRef = {
38
+ key?: string;
39
+ refId: string;
40
+ };
41
+ export interface IBasicEntity {
42
+ name?: string;
43
+ id?: string;
44
+ components?: Array<IComponent>;
45
+ isActive?: boolean;
46
+ position?: IVector3;
47
+ rotation?: IVector3;
48
+ scale?: IVector3;
49
+ children?: Array<string>;
50
+ parent?: string;
51
+ }
52
+ export type IEntity = IBasicEntity | IRefEntity;
53
+ export interface IRefEntity extends IBasicEntity {
54
+ assetRefId: string;
55
+ key?: string;
56
+ isClone?: boolean;
57
+ }
58
+ export type IComponent = {
59
+ id: string;
60
+ refId?: string;
61
+ } & IClassObject;
@@ -0,0 +1,91 @@
1
+ import { BlendFactor, BlendOperation, ColorWriteMask, CompareFunction, CullMode, RenderQueueType, StencilOperation } from "@galacean/engine-core";
2
+ import type { IAssetRef, IColor, IVector2, IVector3 } from "./BasicSchema";
3
+ export interface IRenderState {
4
+ /** Blend state. */
5
+ blendState: {
6
+ /** The blend state of the render target. */
7
+ targetBlendState: {
8
+ /** Whether to enable blend. */
9
+ enabled: boolean;
10
+ /** color (RGB) blend operation. */
11
+ colorBlendOperation: BlendOperation;
12
+ /** alpha (A) blend operation. */
13
+ alphaBlendOperation: BlendOperation;
14
+ /** color blend factor (RGB) for source. */
15
+ sourceColorBlendFactor: BlendFactor;
16
+ /** alpha blend factor (A) for source. */
17
+ sourceAlphaBlendFactor: BlendFactor;
18
+ /** color blend factor (RGB) for destination. */
19
+ destinationColorBlendFactor: BlendFactor;
20
+ /** alpha blend factor (A) for destination. */
21
+ destinationAlphaBlendFactor: BlendFactor;
22
+ /** color mask. */
23
+ colorWriteMask: ColorWriteMask;
24
+ };
25
+ blendColor: IColor;
26
+ /** Whether to use (Alpha-to-Coverage) technology. */
27
+ alphaToCoverage: boolean;
28
+ };
29
+ /** Depth state. */
30
+ depthState: {
31
+ /** Whether to enable the depth test. */
32
+ enabled: boolean;
33
+ /** Whether the depth value can be written.*/
34
+ writeEnabled: boolean;
35
+ /** Depth comparison function. */
36
+ compareFunction: CompareFunction;
37
+ };
38
+ /** Stencil state. */
39
+ stencilState: {
40
+ /** Whether to enable stencil test. */
41
+ enabled: boolean;
42
+ /** Write the reference value of the stencil buffer. */
43
+ referenceValue: number;
44
+ /** Specifying a bit-wise mask that is used to AND the reference value and the stored stencil value when the test is done. */
45
+ mask: number;
46
+ /** Specifying a bit mask to enable or disable writing of individual bits in the stencil planes. */
47
+ writeMask: number;
48
+ /** The comparison function of the reference value of the front face of the geometry and the current buffer storage value. */
49
+ compareFunctionFront: CompareFunction;
50
+ /** The comparison function of the reference value of the back of the geometry and the current buffer storage value. */
51
+ compareFunctionBack: CompareFunction;
52
+ /** specifying the function to use for front face when both the stencil test and the depth test pass. */
53
+ passOperationFront: StencilOperation;
54
+ /** specifying the function to use for back face when both the stencil test and the depth test pass. */
55
+ passOperationBack: StencilOperation;
56
+ /** specifying the function to use for front face when the stencil test fails. */
57
+ failOperationFront: StencilOperation;
58
+ /** specifying the function to use for back face when the stencil test fails. */
59
+ failOperationBack: StencilOperation;
60
+ /** specifying the function to use for front face when the stencil test passes, but the depth test fails. */
61
+ zFailOperationFront: StencilOperation;
62
+ /** specifying the function to use for back face when the stencil test passes, but the depth test fails. */
63
+ zFailOperationBack: StencilOperation;
64
+ };
65
+ /** Raster state. */
66
+ rasterState: {
67
+ /** Specifies whether or not front- and/or back-facing polygons can be culled. */
68
+ cullMode: CullMode;
69
+ /** The multiplier by which an implementation-specific value is multiplied with to create a constant depth offset. */
70
+ depthBias: number;
71
+ /** The scale factor for the variable depth offset for each polygon. */
72
+ slopeScaledDepthBias: number;
73
+ };
74
+ /** Render queue type. */
75
+ renderQueueType: RenderQueueType;
76
+ }
77
+ export interface IMaterialSchema {
78
+ name: string;
79
+ shader: string;
80
+ shaderData: {
81
+ [key: string]: {
82
+ type: "Vector2" | "Vector3" | "Vector4" | "Color" | "Float" | "Texture";
83
+ value: IVector3 | IVector2 | IColor | number | IAssetRef;
84
+ };
85
+ };
86
+ macros: Array<{
87
+ name: string;
88
+ value?: string;
89
+ }>;
90
+ renderState: IRenderState;
91
+ }
@@ -0,0 +1,9 @@
1
+ export interface IProject {
2
+ scene: string;
3
+ files: {
4
+ virtualPath: string;
5
+ path: string;
6
+ type: string;
7
+ id: string;
8
+ }[];
9
+ }