@galacean/engine-loader 1.2.0-alpha.0 → 1.2.0-alpha.10
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/dist/main.js +853 -463
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +852 -463
- package/dist/module.js +841 -452
- package/dist/module.js.map +1 -1
- package/package.json +4 -5
- package/types/GLTFLoader.d.ts +7 -1
- package/types/PrimitiveMeshLoader.d.ts +1 -0
- package/types/gltf/GLTFSchema.d.ts +1 -1
- package/types/gltf/GLTFUtils.d.ts +5 -4
- package/types/gltf/extensions/EXT_meshopt_compression.d.ts +13 -0
- package/types/gltf/extensions/GLTFExtensionParser.d.ts +1 -1
- package/types/gltf/extensions/GLTFExtensionSchema.d.ts +10 -10
- package/types/gltf/extensions/MeshoptDecoder.d.ts +8 -0
- package/types/gltf/extensions/index.d.ts +1 -1
- package/types/gltf/index.d.ts +2 -1
- package/types/gltf/parser/GLTFBufferViewParser.d.ts +5 -0
- package/types/gltf/parser/GLTFParser.d.ts +1 -1
- package/types/gltf/parser/GLTFParserContext.d.ts +7 -6
- package/types/gltf/parser/GLTFSchemaParser.d.ts +0 -1
- package/types/gltf/parser/index.d.ts +2 -1
- package/types/index.d.ts +3 -1
- package/types/ktx2/KTX2Loader.d.ts +4 -3
- package/types/resource-deserialize/index.d.ts +2 -1
- package/types/resource-deserialize/resources/animationClip/AnimationClipDecoder.d.ts +0 -1
- package/types/resource-deserialize/resources/parser/HierarchyParser.d.ts +36 -0
- package/types/resource-deserialize/resources/parser/ParserContext.d.ts +29 -0
- package/types/resource-deserialize/resources/parser/ReflectionParser.d.ts +4 -4
- package/types/resource-deserialize/resources/prefab/PrefabParser.d.ts +13 -4
- package/types/resource-deserialize/resources/prefab/PrefabParserContext.d.ts +5 -0
- package/types/resource-deserialize/resources/scene/SceneParser.d.ts +3 -17
- package/types/resource-deserialize/resources/scene/SceneParserContext.d.ts +6 -12
- package/types/resource-deserialize/resources/schema/BasicSchema.d.ts +26 -1
- package/types/resource-deserialize/resources/schema/SceneSchema.d.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@galacean/engine-loader",
|
|
3
|
-
"version": "1.2.0-alpha.
|
|
3
|
+
"version": "1.2.0-alpha.10",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -15,10 +15,9 @@
|
|
|
15
15
|
"types/**/*"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@galacean/engine-
|
|
19
|
-
"@galacean/engine-
|
|
20
|
-
"@galacean/engine-
|
|
21
|
-
"@galacean/engine-math": "1.2.0-alpha.0"
|
|
18
|
+
"@galacean/engine-core": "1.2.0-alpha.10",
|
|
19
|
+
"@galacean/engine-rhi-webgl": "1.2.0-alpha.10",
|
|
20
|
+
"@galacean/engine-math": "1.2.0-alpha.10"
|
|
22
21
|
},
|
|
23
22
|
"scripts": {
|
|
24
23
|
"b:types": "tsc"
|
package/types/GLTFLoader.d.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import { AssetPromise, Loader, LoadItem, ResourceManager } from "@galacean/engine-core";
|
|
1
|
+
import { AssetPromise, Engine, EngineConfiguration, Loader, LoadItem, ResourceManager } from "@galacean/engine-core";
|
|
2
2
|
import { GLTFResource } from "./gltf/GLTFResource";
|
|
3
3
|
export declare class GLTFLoader extends Loader<GLTFResource> {
|
|
4
|
+
/**
|
|
5
|
+
* Release glTF loader memory(includes meshopt workers).
|
|
6
|
+
* @remarks If use loader after releasing, we should release again.
|
|
7
|
+
*/
|
|
8
|
+
static release(): void;
|
|
9
|
+
initialize(_: Engine, configuration: EngineConfiguration): Promise<void>;
|
|
4
10
|
load(item: LoadItem, resourceManager: ResourceManager): AssetPromise<GLTFResource>;
|
|
5
11
|
}
|
|
6
12
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -30,7 +30,7 @@ export declare class GLTFUtils {
|
|
|
30
30
|
/**
|
|
31
31
|
* Get accessor data.
|
|
32
32
|
*/
|
|
33
|
-
static processingSparseData(
|
|
33
|
+
static processingSparseData(context: GLTFParserContext, accessor: IAccessor, bufferInfo: BufferInfo): Promise<void>;
|
|
34
34
|
static getIndexFormat(type: AccessorComponentType): IndexFormat;
|
|
35
35
|
static getElementFormat(type: AccessorComponentType, size: number, normalized?: boolean): VertexElementFormat;
|
|
36
36
|
/**
|
|
@@ -40,9 +40,10 @@ export declare class GLTFUtils {
|
|
|
40
40
|
/**
|
|
41
41
|
* Parse the glb format.
|
|
42
42
|
*/
|
|
43
|
-
static parseGLB(context: GLTFParserContext,
|
|
44
|
-
glTF
|
|
45
|
-
buffers
|
|
43
|
+
static parseGLB(context: GLTFParserContext, originBuffer: ArrayBuffer): {
|
|
44
|
+
glTF?: IGLTF;
|
|
45
|
+
buffers?: ArrayBuffer[];
|
|
46
|
+
originBuffer?: ArrayBuffer;
|
|
46
47
|
};
|
|
47
48
|
static parseSampler(texture: Texture2D, samplerInfo: ISamplerInfo): void;
|
|
48
49
|
static getSamplerInfo(sampler: ISampler): ISamplerInfo;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare module "@galacean/engine-core" {
|
|
2
|
+
interface EngineConfiguration {
|
|
3
|
+
/** glTF loader options. */
|
|
4
|
+
glTF?: {
|
|
5
|
+
/** Meshopt options. If set this option and workCount is great than 0, workers will be created. */
|
|
6
|
+
meshOpt?: {
|
|
7
|
+
/** Worker count for transcoder, default is 4. */
|
|
8
|
+
workerCount: number;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -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>;
|
|
22
|
+
createAndParse(context: GLTFParserContext, extensionSchema: GLTFExtensionSchema, extensionOwnerSchema: GLTFExtensionOwnerSchema, ...extra: any[]): EngineObject | Promise<EngineObject | Uint8Array>;
|
|
23
23
|
/**
|
|
24
24
|
* Additive parse to the resource.
|
|
25
25
|
* @param context - The parser context
|
|
@@ -18,15 +18,6 @@ export interface IKHRLightsPunctual_Light {
|
|
|
18
18
|
export interface IKHRLightsPunctual {
|
|
19
19
|
lights: IKHRLightsPunctual_Light[];
|
|
20
20
|
}
|
|
21
|
-
/**
|
|
22
|
-
* Interfaces from the KHR_draco_mesh_compression extension
|
|
23
|
-
*/
|
|
24
|
-
export interface IKHRDracoMeshCompression {
|
|
25
|
-
bufferView: number;
|
|
26
|
-
attributes: {
|
|
27
|
-
[name: string]: number;
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
21
|
/**
|
|
31
22
|
* Interfaces from the KHR_materials_clearcoat extension
|
|
32
23
|
*/
|
|
@@ -142,6 +133,15 @@ export interface IKHRXmp {
|
|
|
142
133
|
export interface IKHRXmp_Node {
|
|
143
134
|
packet: number;
|
|
144
135
|
}
|
|
136
|
+
export interface IEXTMeshoptCompressionSchema {
|
|
137
|
+
buffer: number;
|
|
138
|
+
byteOffset?: number;
|
|
139
|
+
byteLength: number;
|
|
140
|
+
byteStride: number;
|
|
141
|
+
mode: "ATTRIBUTES" | "TRIANGLES" | "INDICES";
|
|
142
|
+
count: number;
|
|
143
|
+
filter?: "NONE" | "OCTAHEDRAL" | "QUATERNION" | "EXPONENTIAL";
|
|
144
|
+
}
|
|
145
145
|
export interface IGalaceanMaterialRemap {
|
|
146
146
|
refId: string;
|
|
147
147
|
key?: string;
|
|
@@ -154,4 +154,4 @@ export interface IGalaceanAnimation {
|
|
|
154
154
|
parameter: any;
|
|
155
155
|
}[];
|
|
156
156
|
}
|
|
157
|
-
export type GLTFExtensionSchema = IKHRLightsPunctual_Light |
|
|
157
|
+
export type GLTFExtensionSchema = IKHRLightsPunctual_Light | IKHRMaterialsClearcoat | IKHRMaterialsIor | IKHRMaterialsUnlit | IKHRMaterialsPbrSpecularGlossiness | IKHRMaterialsSheen | IKHRMaterialsSpecular | IKHRMaterialsTransmission | IKHRMaterialsTranslucency | IKHRMaterialVariants_Mapping | IKHRMaterialVariants_Variants | IKHRMaterialsAnisotropy | IKHRTextureBasisU | IKHRTextureTransform | IKHRXmp | IKHRXmp_Node | IGalaceanAnimation | Object;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import "./KHR_draco_mesh_compression";
|
|
2
1
|
import "./KHR_lights_punctual";
|
|
3
2
|
import "./KHR_materials_clearcoat";
|
|
4
3
|
import "./KHR_materials_ior";
|
|
@@ -14,6 +13,7 @@ import "./KHR_texture_transform";
|
|
|
14
13
|
import "./KHR_materials_ior";
|
|
15
14
|
import "./GALACEAN_materials_remap";
|
|
16
15
|
import "./GALACEAN_animation_event";
|
|
16
|
+
import "./EXT_meshopt_compression";
|
|
17
17
|
import "./KHR_materials_anisotropy";
|
|
18
18
|
export { GLTFExtensionParser, GLTFExtensionMode } from "./GLTFExtensionParser";
|
|
19
19
|
export * from "./GLTFExtensionSchema";
|
package/types/gltf/index.d.ts
CHANGED
|
@@ -2,4 +2,5 @@ export { GLTFResource } from "./GLTFResource";
|
|
|
2
2
|
export { GLTFUtils } from "./GLTFUtils";
|
|
3
3
|
export * from "./parser";
|
|
4
4
|
export * from "./extensions/index";
|
|
5
|
-
export
|
|
5
|
+
export { AccessorType } from "./GLTFSchema";
|
|
6
|
+
export type { IMaterial, IMeshPrimitive, ITextureInfo, INode, GLTFExtensionOwnerSchema, IGLTF, IMesh } from "./GLTFSchema";
|
|
@@ -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 | void>;
|
|
20
|
+
}, context: GLTFParserContext, ownerSchema: GLTFExtensionOwnerSchema, ...extra: any[]): EngineObject | void | Promise<EngineObject | Uint8Array | void>;
|
|
21
21
|
/**
|
|
22
22
|
* Execute all parses of extension to parse resource.
|
|
23
23
|
* @param extensions - Related extensions field
|
|
@@ -59,11 +59,12 @@ export declare enum GLTFParserType {
|
|
|
59
59
|
Validator = 1,
|
|
60
60
|
Scene = 2,
|
|
61
61
|
Buffer = 3,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
62
|
+
BufferView = 4,
|
|
63
|
+
Texture = 5,
|
|
64
|
+
Material = 6,
|
|
65
|
+
Mesh = 7,
|
|
66
|
+
Entity = 8,
|
|
67
|
+
Skin = 9,
|
|
68
|
+
Animation = 10
|
|
68
69
|
}
|
|
69
70
|
export declare function registerGLTFParser(pipeline: GLTFParserType): (Parser: new () => GLTFParser) => void;
|
|
@@ -9,4 +9,5 @@ export { GLTFSceneParser } from "./GLTFSceneParser";
|
|
|
9
9
|
export { GLTFSkinParser } from "./GLTFSkinParser";
|
|
10
10
|
export { GLTFTextureParser } from "./GLTFTextureParser";
|
|
11
11
|
export { GLTFValidator } from "./GLTFValidator";
|
|
12
|
-
export { GLTFParserContext, GLTFParserType, registerGLTFParser } from "./GLTFParserContext";
|
|
12
|
+
export { GLTFParserContext, GLTFParserType, registerGLTFParser, BufferInfo } from "./GLTFParserContext";
|
|
13
|
+
export { GLTFBufferViewParser } from "./GLTFBufferViewParser";
|
package/types/index.d.ts
CHANGED
|
@@ -10,13 +10,15 @@ import "./KTXCubeLoader";
|
|
|
10
10
|
import "./KTXLoader";
|
|
11
11
|
import "./MaterialLoader";
|
|
12
12
|
import "./MeshLoader";
|
|
13
|
+
import "./PrimitiveMeshLoader";
|
|
14
|
+
import "./ProjectLoader";
|
|
13
15
|
import "./SourceFontLoader";
|
|
14
16
|
import "./SpriteAtlasLoader";
|
|
15
17
|
import "./SpriteLoader";
|
|
16
18
|
import "./Texture2DLoader";
|
|
17
19
|
import "./TextureCubeLoader";
|
|
18
|
-
import "./ProjectLoader";
|
|
19
20
|
import "./ktx2/KTX2Loader";
|
|
21
|
+
export { GLTFLoader } from "./GLTFLoader";
|
|
20
22
|
export type { GLTFParams } from "./GLTFLoader";
|
|
21
23
|
export * from "./SceneLoader";
|
|
22
24
|
export type { Texture2DParams } from "./Texture2DLoader";
|
|
@@ -8,9 +8,10 @@ export declare class KTX2Loader extends Loader<Texture2D | TextureCube> {
|
|
|
8
8
|
private static _priorityFormats;
|
|
9
9
|
private static _supportedMap;
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* Release ktx2 transcoder worker.
|
|
12
|
+
* @remarks If use loader after releasing, we should release again.
|
|
12
13
|
*/
|
|
13
|
-
static
|
|
14
|
+
static release(): void;
|
|
14
15
|
/** @internal */
|
|
15
16
|
static _parseBuffer(buffer: Uint8Array, engine: Engine, params?: KTX2Params): Promise<{
|
|
16
17
|
engine: Engine;
|
|
@@ -50,7 +51,7 @@ export declare enum KTX2Transcoder {
|
|
|
50
51
|
}
|
|
51
52
|
declare module "@galacean/engine-core" {
|
|
52
53
|
interface EngineConfiguration {
|
|
53
|
-
/** KTX2 loader options. */
|
|
54
|
+
/** KTX2 loader options. If set this option and workCount is great than 0, workers will be created. */
|
|
54
55
|
ktx2Loader?: {
|
|
55
56
|
/** Worker count for transcoder, default is 4. */
|
|
56
57
|
workerCount?: number;
|
|
@@ -2,7 +2,7 @@ import { 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";
|
|
5
|
-
export { PrefabParser } from "./resources/
|
|
5
|
+
export { PrefabParser } from "./resources/prefab/PrefabParser";
|
|
6
6
|
export * from "./resources/animationClip/AnimationClipDecoder";
|
|
7
7
|
export type { IModelMesh } from "./resources/mesh/IModelMesh";
|
|
8
8
|
/**
|
|
@@ -16,3 +16,4 @@ 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";
|
|
19
|
+
export * from "./resources/parser/ParserContext";
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Entity, Engine, Scene } from "@galacean/engine-core";
|
|
2
|
+
import type { IPrefabFile } from "../schema";
|
|
3
|
+
import { ReflectionParser } from "./ReflectionParser";
|
|
4
|
+
import { ParserContext } from "./ParserContext";
|
|
5
|
+
/** @Internal */
|
|
6
|
+
export default abstract class HierarchyParser<T extends Scene | Entity, V extends ParserContext<IPrefabFile, T>> {
|
|
7
|
+
readonly context: V;
|
|
8
|
+
/**
|
|
9
|
+
* The promise of parsed object.
|
|
10
|
+
*/
|
|
11
|
+
readonly promise: Promise<T>;
|
|
12
|
+
protected _resolve: (item: T) => void;
|
|
13
|
+
protected _reject: (reason: any) => void;
|
|
14
|
+
protected _engine: Engine;
|
|
15
|
+
protected _reflectionParser: ReflectionParser;
|
|
16
|
+
private prefabContextMap;
|
|
17
|
+
private prefabPromiseMap;
|
|
18
|
+
constructor(context: V);
|
|
19
|
+
/** start parse the scene or prefab or others */
|
|
20
|
+
start(): void;
|
|
21
|
+
protected abstract handleRootEntity(id: string): void;
|
|
22
|
+
private _parseEntities;
|
|
23
|
+
private _parseComponents;
|
|
24
|
+
private _parsePrefabModification;
|
|
25
|
+
private _parsePrefabRemovedEntities;
|
|
26
|
+
private _parsePrefabRemovedComponents;
|
|
27
|
+
private _clearAndResolve;
|
|
28
|
+
private _organizeEntities;
|
|
29
|
+
private _getEntityByConfig;
|
|
30
|
+
private _parseEntity;
|
|
31
|
+
private _parseGLTF;
|
|
32
|
+
private _parseStrippedEntity;
|
|
33
|
+
private _parseChildren;
|
|
34
|
+
private _applyEntityData;
|
|
35
|
+
private _traverseAddEntityToMap;
|
|
36
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Component, EngineObject, Entity, ResourceManager } from "@galacean/engine-core";
|
|
2
|
+
import type { IEntity } from "../schema";
|
|
3
|
+
/**
|
|
4
|
+
* Parser context
|
|
5
|
+
* @export
|
|
6
|
+
* @abstract
|
|
7
|
+
* @class ParserContext
|
|
8
|
+
* @template T
|
|
9
|
+
* @template I
|
|
10
|
+
*/
|
|
11
|
+
export declare class ParserContext<T extends Object, I extends EngineObject> {
|
|
12
|
+
readonly originalData: T;
|
|
13
|
+
readonly engine: any;
|
|
14
|
+
target?: I;
|
|
15
|
+
entityMap: Map<string, Entity>;
|
|
16
|
+
components: Map<string, Component>;
|
|
17
|
+
assets: Map<string, any>;
|
|
18
|
+
entityConfigMap: Map<string, IEntity>;
|
|
19
|
+
rootIds: string[];
|
|
20
|
+
strippedIds: string[];
|
|
21
|
+
readonly resourceManager: ResourceManager;
|
|
22
|
+
constructor(originalData: T, engine: any, target?: I);
|
|
23
|
+
/**
|
|
24
|
+
* Destroy the context.
|
|
25
|
+
* @abstract
|
|
26
|
+
* @memberof ParserContext
|
|
27
|
+
*/
|
|
28
|
+
destroy(): void;
|
|
29
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Entity } from "@galacean/engine-core";
|
|
2
|
-
import type { IBasicType, IClassObject, IEntity } from "../schema";
|
|
3
|
-
import {
|
|
1
|
+
import { EngineObject, Entity } from "@galacean/engine-core";
|
|
2
|
+
import type { IBasicType, IClassObject, IEntity, IPrefabFile } from "../schema";
|
|
3
|
+
import { ParserContext } from "./ParserContext";
|
|
4
4
|
export declare class ReflectionParser {
|
|
5
5
|
private readonly _context;
|
|
6
6
|
static customParseComponentHandles: Map<string, Function>;
|
|
7
7
|
static registerCustomParseComponent(componentType: string, handle: Function): void;
|
|
8
|
-
constructor(_context:
|
|
8
|
+
constructor(_context: ParserContext<IPrefabFile, EngineObject>);
|
|
9
9
|
parseEntity(entityConfig: IEntity): Promise<Entity>;
|
|
10
10
|
parseClassObject(item: IClassObject): Promise<any>;
|
|
11
11
|
parsePropsAndMethods(instance: any, item: Omit<IClassObject, "class">): Promise<any>;
|
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
import { Entity } from "@galacean/engine-core";
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { Entity, Engine } from "@galacean/engine-core";
|
|
2
|
+
import type { IPrefabFile } from "../schema";
|
|
3
|
+
import { PrefabParserContext } from "./PrefabParserContext";
|
|
4
|
+
import HierarchyParser from "../parser/HierarchyParser";
|
|
5
|
+
export declare class PrefabParser extends HierarchyParser<Entity, PrefabParserContext> {
|
|
6
|
+
/**
|
|
7
|
+
* Parse prefab data.
|
|
8
|
+
* @param engine - the engine of the parser context
|
|
9
|
+
* @param prefabData - prefab data which is exported by editor
|
|
10
|
+
* @returns a promise of prefab
|
|
11
|
+
*/
|
|
12
|
+
static parse(engine: Engine, prefabData: IPrefabFile): PrefabParser;
|
|
13
|
+
protected handleRootEntity(id: string): void;
|
|
5
14
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Engine, Scene } from "@galacean/engine-core";
|
|
2
2
|
import type { IScene } from "../schema";
|
|
3
3
|
import { SceneParserContext } from "./SceneParserContext";
|
|
4
|
+
import HierarchyParser from "../parser/HierarchyParser";
|
|
4
5
|
/** @Internal */
|
|
5
|
-
export declare class SceneParser {
|
|
6
|
-
readonly context: SceneParserContext;
|
|
6
|
+
export declare class SceneParser extends HierarchyParser<Scene, SceneParserContext> {
|
|
7
7
|
/**
|
|
8
8
|
* Parse scene data.
|
|
9
9
|
* @param engine - the engine of the parser context
|
|
@@ -11,19 +11,5 @@ export declare class SceneParser {
|
|
|
11
11
|
* @returns a promise of scene
|
|
12
12
|
*/
|
|
13
13
|
static parse(engine: Engine, sceneData: IScene): Promise<Scene>;
|
|
14
|
-
|
|
15
|
-
* The promise of parsed scene.
|
|
16
|
-
*/
|
|
17
|
-
readonly promise: Promise<Scene>;
|
|
18
|
-
private _resolve;
|
|
19
|
-
private _reject;
|
|
20
|
-
private _engine;
|
|
21
|
-
private _reflectionParser;
|
|
22
|
-
constructor(context: SceneParserContext);
|
|
23
|
-
/** start parse the scene */
|
|
24
|
-
start(): void;
|
|
25
|
-
private _parseEntities;
|
|
26
|
-
private _organizeEntities;
|
|
27
|
-
private _parseComponents;
|
|
28
|
-
private _clearAndResolveScene;
|
|
14
|
+
protected handleRootEntity(id: string): void;
|
|
29
15
|
}
|
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { Scene } from "@galacean/engine-core";
|
|
2
|
+
import { IScene } from "../schema";
|
|
3
|
+
import { ParserContext } from "../parser/ParserContext";
|
|
4
|
+
export declare class SceneParserContext extends ParserContext<IScene, Scene> {
|
|
4
5
|
readonly originalData: IScene;
|
|
6
|
+
readonly engine: any;
|
|
5
7
|
readonly scene: Scene;
|
|
6
|
-
|
|
7
|
-
components: Map<string, Component>;
|
|
8
|
-
assets: Map<string, any>;
|
|
9
|
-
entityConfigMap: Map<string, IEntity>;
|
|
10
|
-
rootIds: string[];
|
|
11
|
-
readonly engine: Engine;
|
|
12
|
-
readonly resourceManager: ResourceManager;
|
|
13
|
-
constructor(originalData: IScene, scene: Scene);
|
|
14
|
-
destroy(): void;
|
|
8
|
+
constructor(originalData: IScene, engine: any, scene: Scene);
|
|
15
9
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Layer } from "@galacean/engine-core";
|
|
1
2
|
export interface IVector3 {
|
|
2
3
|
x: number;
|
|
3
4
|
y: number;
|
|
@@ -33,12 +34,36 @@ export interface IBasicEntity {
|
|
|
33
34
|
scale?: IVector3;
|
|
34
35
|
children?: Array<string>;
|
|
35
36
|
parent?: string;
|
|
37
|
+
layer?: Layer;
|
|
36
38
|
}
|
|
37
|
-
export type IEntity = IBasicEntity | IRefEntity;
|
|
39
|
+
export type IEntity = IBasicEntity | IRefEntity | IStrippedEntity;
|
|
38
40
|
export interface IRefEntity extends IBasicEntity {
|
|
39
41
|
assetRefId: string;
|
|
40
42
|
key?: string;
|
|
41
43
|
isClone?: boolean;
|
|
44
|
+
modifications: {
|
|
45
|
+
target: IPrefabModifyTarget;
|
|
46
|
+
methods?: {
|
|
47
|
+
[methodName: string]: Array<IMethodParams>;
|
|
48
|
+
};
|
|
49
|
+
props?: {
|
|
50
|
+
[key: string]: IBasicType | IMethodParams;
|
|
51
|
+
};
|
|
52
|
+
}[];
|
|
53
|
+
removedEntities: IPrefabModifyTarget[];
|
|
54
|
+
removedComponents: IPrefabModifyTarget[];
|
|
55
|
+
}
|
|
56
|
+
export interface IPrefabModifyTarget {
|
|
57
|
+
entityId?: string;
|
|
58
|
+
componentId?: string;
|
|
59
|
+
}
|
|
60
|
+
export interface IStrippedEntity extends IBasicEntity {
|
|
61
|
+
strippedId: string;
|
|
62
|
+
prefabInstanceId: string;
|
|
63
|
+
prefabSource: {
|
|
64
|
+
assetId: string;
|
|
65
|
+
entityId: string;
|
|
66
|
+
};
|
|
42
67
|
}
|
|
43
68
|
export type IComponent = {
|
|
44
69
|
id: string;
|