@galacean/engine-loader 2.0.0-alpha.6 → 2.0.0-alpha.61
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/README.md +3 -1
- package/dist/main.js +3445 -3771
- package/dist/main.js.map +1 -1
- package/dist/module.js +3445 -3772
- package/dist/module.js.map +1 -1
- package/package.json +4 -4
- package/types/GLTFContentRestorer.d.ts +13 -13
- package/types/HDRDecoder.d.ts +29 -9
- package/types/ImageDecoder.d.ts +14 -0
- package/types/PrimitiveMeshAsset.d.ts +238 -0
- package/types/SceneLoader.d.ts +8 -1
- package/types/{Texture2DLoader.d.ts → TextureLoader.d.ts} +4 -4
- package/types/gltf/GLTFResource.d.ts +4 -4
- package/types/gltf/GLTFUtils.d.ts +6 -6
- package/types/gltf/extensions/GLTFExtensionParser.d.ts +1 -1
- package/types/gltf/extensions/GLTFExtensionSchema.d.ts +9 -4
- package/types/gltf/extensions/MeshoptDecoder.d.ts +1 -1
- package/types/gltf/extensions/index.d.ts +1 -0
- package/types/gltf/parser/GLTFAnimatorControllerParser.d.ts +1 -1
- package/types/gltf/parser/GLTFParser.d.ts +2 -2
- package/types/gltf/parser/GLTFParserContext.d.ts +4 -3
- package/types/gltf/parser/GLTFSceneParser.d.ts +1 -1
- package/types/gltf/parser/GLTFSkinParser.d.ts +4 -0
- package/types/gltf/parser/GLTFValidator.d.ts +1 -1
- package/types/index.d.ts +7 -7
- package/types/ktx2/KTX2Container.d.ts +1 -0
- package/types/ktx2/KTX2Loader.d.ts +2 -5
- package/types/ktx2/KTX2TargetFormat.d.ts +8 -8
- package/types/ktx2/WorkerPool.d.ts +1 -1
- package/types/prefab/PrefabParser.d.ts +9 -6
- package/types/prefab/PrefabResource.d.ts +2 -2
- package/types/resource-deserialize/index.d.ts +3 -4
- package/types/resource-deserialize/resources/parser/HierarchyParser.d.ts +22 -27
- package/types/resource-deserialize/resources/parser/ParserContext.d.ts +12 -12
- package/types/resource-deserialize/resources/parser/ReflectionParser.d.ts +42 -17
- package/types/resource-deserialize/resources/scene/SceneParser.d.ts +6 -7
- package/types/resource-deserialize/resources/texture2D/Texture2DDecoder.d.ts +1 -0
- package/types/resource-deserialize/resources/textureCube/TextureCubeDecoder.d.ts +1 -0
- package/types/resource-deserialize/utils/BufferReader.d.ts +3 -1
- package/types/schema/BasicSchema.d.ts +21 -0
- package/types/schema/CommonSchema.d.ts +45 -0
- package/types/schema/HierarchySchema.d.ts +71 -0
- package/types/schema/MaterialSchema.d.ts +57 -0
- package/types/schema/PrefabSchema.d.ts +4 -0
- package/types/schema/ProjectSchema.d.ts +7 -0
- package/types/schema/SceneSchema.d.ts +59 -0
- package/types/{resource-deserialize/resources/schema → schema}/index.d.ts +4 -1
- package/types/schema/refs.d.ts +2 -0
- package/types/ShaderChunkLoader.d.ts +0 -9
- package/types/resource-deserialize/resources/mesh/MeshDecoder.d.ts +0 -8
- package/types/resource-deserialize/resources/mesh/type.d.ts +0 -31
- package/types/resource-deserialize/resources/schema/BasicSchema.d.ts +0 -97
- package/types/resource-deserialize/resources/schema/MaterialSchema.d.ts +0 -102
- package/types/resource-deserialize/resources/schema/ProjectSchema.d.ts +0 -10
- package/types/resource-deserialize/resources/schema/SceneSchema.d.ts +0 -80
- package/types/resource-deserialize/resources/texture2D/TextureDecoder.d.ts +0 -9
- /package/types/{EnvLoader.d.ts → AmbientLightLoader.d.ts} +0 -0
- /package/types/{MeshLoader.d.ts → RenderTargetLoader.d.ts} +0 -0
- /package/types/{TextureCubeLoader.d.ts → gltf/extensions/KHR_materials_emissive_strength.d.ts} +0 -0
|
@@ -25,7 +25,7 @@ export declare class KTX2Loader extends Loader<Texture2D | TextureCube> {
|
|
|
25
25
|
private static _detectSupportedFormat;
|
|
26
26
|
private static _getBinomialLLCTranscoder;
|
|
27
27
|
private static _getEngineTextureFormat;
|
|
28
|
-
initialize(_: Engine, configuration: EngineConfiguration): Promise<void
|
|
28
|
+
initialize(_: Engine, configuration: EngineConfiguration): Promise<void> | void;
|
|
29
29
|
/**
|
|
30
30
|
* @internal
|
|
31
31
|
*/
|
|
@@ -37,7 +37,7 @@ export declare class KTX2Loader extends Loader<Texture2D | TextureCube> {
|
|
|
37
37
|
* KTX2 loader params interface.
|
|
38
38
|
*/
|
|
39
39
|
export interface KTX2Params {
|
|
40
|
-
/** Priority transcoding format queue which is preferred options, default is BC7/ASTC/BC3_BC1/ETC/PVRTC/
|
|
40
|
+
/** Priority transcoding format queue which is preferred options, default is BC7/ASTC/BC3_BC1/ETC/PVRTC/R8G8B8A8_UNorm. */
|
|
41
41
|
/** @deprecated */
|
|
42
42
|
priorityFormats: KTX2TargetFormat[];
|
|
43
43
|
}
|
|
@@ -47,9 +47,6 @@ declare module "@galacean/engine-core" {
|
|
|
47
47
|
ktx2Loader?: {
|
|
48
48
|
/** Worker count for transcoder, default is 4. */
|
|
49
49
|
workerCount?: number;
|
|
50
|
-
/** Global transcoding format queue which will be used if not specified in per-instance param, default is BC7/ASTC/BC3_BC1/ETC/PVRTC/R8G8B8A8. */
|
|
51
|
-
/** @deprecated */
|
|
52
|
-
priorityFormats?: KTX2TargetFormat[];
|
|
53
50
|
};
|
|
54
51
|
}
|
|
55
52
|
}
|
|
@@ -12,16 +12,16 @@ export declare enum KTX2TargetFormat {
|
|
|
12
12
|
PVRTC = 3,
|
|
13
13
|
/** RGB(A) compressed format, 4 bits per pixel if no alpha channel, 8 bits per pixel if has alpha channel. */
|
|
14
14
|
ETC = 4,
|
|
15
|
-
/** R
|
|
16
|
-
|
|
17
|
-
/** RG
|
|
18
|
-
|
|
19
|
-
/** RGBA
|
|
20
|
-
|
|
15
|
+
/** R 8-bit unsigned normalized format. */
|
|
16
|
+
R8_UNorm = 5,
|
|
17
|
+
/** RG 8-bit unsigned normalized format. */
|
|
18
|
+
R8G8_UNorm = 6,
|
|
19
|
+
/** RGBA 8-bit unsigned normalized format. */
|
|
20
|
+
R8G8B8A8_UNorm = 7,
|
|
21
21
|
/** RGB HDR compressed format, 8 bits per pixel. */
|
|
22
22
|
BC6H = 8,
|
|
23
23
|
/** HDR RGB(A) compressed format, 128 bits per 4x4 pixel block (currently UASTC HDR 4x4 encoders are only RGB). */
|
|
24
24
|
ASTC_HDR_4x4 = 9,
|
|
25
|
-
/** RGBA
|
|
26
|
-
|
|
25
|
+
/** RGBA 16-bit signed float format. */
|
|
26
|
+
R16G16B16A16_SFloat = 10
|
|
27
27
|
}
|
|
@@ -13,7 +13,7 @@ export declare class WorkerPool<T = any, U = any> {
|
|
|
13
13
|
* @param limitedCount - worker limit count
|
|
14
14
|
* @param _workerCreator - creator of worker
|
|
15
15
|
*/
|
|
16
|
-
constructor(limitedCount: number, _workerCreator: () => Worker | Promise<Worker>);
|
|
16
|
+
constructor(limitedCount: number | undefined, _workerCreator: () => Worker | Promise<Worker>);
|
|
17
17
|
prepareWorker(): Promise<Worker[]>;
|
|
18
18
|
/**
|
|
19
19
|
* Post message to worker.
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { Engine, Entity } from "@galacean/engine-core";
|
|
2
|
-
import {
|
|
2
|
+
import type { HierarchyFile } from "../schema/HierarchySchema";
|
|
3
|
+
import type { PrefabFile } from "../schema/PrefabSchema";
|
|
3
4
|
import { HierarchyParser } from "../resource-deserialize/resources/parser/HierarchyParser";
|
|
5
|
+
import { ParserContext } from "../resource-deserialize/resources/parser/ParserContext";
|
|
4
6
|
import { PrefabResource } from "./PrefabResource";
|
|
5
|
-
export declare class PrefabParser extends HierarchyParser<PrefabResource, ParserContext
|
|
7
|
+
export declare class PrefabParser extends HierarchyParser<PrefabResource, ParserContext> {
|
|
6
8
|
readonly prefabResource: PrefabResource;
|
|
7
|
-
static parse(engine: Engine, url: string, data:
|
|
8
|
-
constructor(data:
|
|
9
|
-
protected
|
|
10
|
-
protected
|
|
9
|
+
static parse(engine: Engine, url: string, data: PrefabFile): Promise<PrefabResource>;
|
|
10
|
+
constructor(data: HierarchyFile, context: ParserContext, prefabResource: PrefabResource);
|
|
11
|
+
protected _onEntityCreated(entity: Entity): void;
|
|
12
|
+
protected _getRootIndices(): number[];
|
|
13
|
+
protected _handleRootEntity(index: number): void;
|
|
11
14
|
protected _clearAndResolve(): PrefabResource;
|
|
12
15
|
}
|
|
@@ -13,8 +13,8 @@ export declare class PrefabResource extends ReferResource {
|
|
|
13
13
|
*/
|
|
14
14
|
constructor(engine: Engine, url: string);
|
|
15
15
|
/**
|
|
16
|
-
* Instantiate prefab.
|
|
17
|
-
* @returns prefab
|
|
16
|
+
* Instantiate the prefab.
|
|
17
|
+
* @returns A detached prefab instance that must be added to a parent Entity or Scene to update and render
|
|
18
18
|
*/
|
|
19
19
|
instantiate(): Entity;
|
|
20
20
|
/**
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { AssetPromise, Engine } from "@galacean/engine-core";
|
|
2
2
|
export * from "./resources/animationClip/AnimationClipDecoder";
|
|
3
|
-
export type { IModelMesh } from "./resources/mesh/IModelMesh";
|
|
4
|
-
export { MeshDecoder } from "./resources/mesh/MeshDecoder";
|
|
5
3
|
export { ReflectionParser } from "./resources/parser/ReflectionParser";
|
|
6
|
-
|
|
4
|
+
import "./resources/texture2D/Texture2DDecoder";
|
|
5
|
+
import "./resources/textureCube/TextureCubeDecoder";
|
|
7
6
|
/**
|
|
8
7
|
* Decode engine binary resource.
|
|
9
8
|
* @param arrayBuffer - array buffer of decode binary file
|
|
@@ -14,7 +13,7 @@ export declare function decode<T>(arrayBuffer: ArrayBuffer, engine: Engine, ...a
|
|
|
14
13
|
export * from "./resources/parser/HierarchyParser";
|
|
15
14
|
export * from "./resources/parser/ParserContext";
|
|
16
15
|
export * from "./resources/scene/SceneParser";
|
|
17
|
-
export * from "
|
|
16
|
+
export * from "../schema";
|
|
18
17
|
export * from "./utils/BufferReader";
|
|
19
18
|
export * from "./utils/Decorator";
|
|
20
19
|
export * from "./utils/FileHeader";
|
|
@@ -1,43 +1,38 @@
|
|
|
1
1
|
import { Engine, Entity, Scene } from "@galacean/engine-core";
|
|
2
2
|
import { PrefabResource } from "../../../prefab/PrefabResource";
|
|
3
|
-
import type {
|
|
3
|
+
import type { HierarchyFile } from "../../../schema/HierarchySchema";
|
|
4
4
|
import { ParserContext } from "./ParserContext";
|
|
5
5
|
import { ReflectionParser } from "./ReflectionParser";
|
|
6
6
|
/** @Internal */
|
|
7
|
-
export declare abstract class HierarchyParser<T extends Scene | PrefabResource, V extends ParserContext
|
|
8
|
-
readonly data:
|
|
7
|
+
export declare abstract class HierarchyParser<T extends Scene | PrefabResource, V extends ParserContext> {
|
|
8
|
+
readonly data: HierarchyFile;
|
|
9
9
|
readonly context: V;
|
|
10
|
-
/**
|
|
11
|
-
* The promise of parsed object.
|
|
12
|
-
*/
|
|
13
10
|
readonly promise: Promise<T>;
|
|
14
11
|
protected _resolve: (item: T) => void;
|
|
15
12
|
protected _reject: (reason: any) => void;
|
|
16
13
|
protected _engine: Engine;
|
|
17
14
|
protected _reflectionParser: ReflectionParser;
|
|
18
|
-
|
|
19
|
-
private _prefabPromiseMap;
|
|
20
|
-
constructor(data: IHierarchyFile, context: V);
|
|
21
|
-
/** start parse the scene or prefab or others */
|
|
15
|
+
constructor(data: HierarchyFile, context: V);
|
|
22
16
|
start(): void;
|
|
23
|
-
|
|
24
|
-
protected abstract
|
|
17
|
+
/** Root entity indices for this hierarchy (scene.rootEntities or [prefab.root]). */
|
|
18
|
+
protected abstract _getRootIndices(): number[];
|
|
19
|
+
protected abstract _handleRootEntity(index: number): void;
|
|
25
20
|
protected abstract _clearAndResolve(): Scene | PrefabResource;
|
|
21
|
+
protected _onEntityCreated(_entity: Entity): void;
|
|
26
22
|
private _parseEntities;
|
|
27
|
-
private _parseComponents;
|
|
28
|
-
private _parsePrefabModification;
|
|
29
|
-
private _parseAddedComponents;
|
|
30
|
-
private _parsePrefabRemovedEntities;
|
|
31
|
-
private _parsePrefabRemovedComponents;
|
|
32
23
|
private _organizeEntities;
|
|
33
|
-
private
|
|
34
|
-
private
|
|
35
|
-
private
|
|
36
|
-
private
|
|
37
|
-
private
|
|
38
|
-
|
|
39
|
-
private
|
|
40
|
-
|
|
41
|
-
private
|
|
42
|
-
|
|
24
|
+
private _parseComponents;
|
|
25
|
+
private _parseComponentsPropsAndCalls;
|
|
26
|
+
private _parsePrefabOverrides;
|
|
27
|
+
private _applyOverrides;
|
|
28
|
+
private _loadPrefabInstance;
|
|
29
|
+
/** Resolve an entity inside a prefab instance by walking the child-index path from root */
|
|
30
|
+
private static _resolveEntity;
|
|
31
|
+
/** Resolve a component on an entity by type name + per-type index */
|
|
32
|
+
private static _resolveComponent;
|
|
33
|
+
/** Resolve component class from config and add to entity. Throws if class is not registered. */
|
|
34
|
+
private static _addComponentFromConfig;
|
|
35
|
+
private static _isPrefabInstanceEntity;
|
|
36
|
+
/** Apply entity-level props (name, isActive, layer, transform) to an entity. */
|
|
37
|
+
private static _applyEntityProps;
|
|
43
38
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AssetPromise, Component, Engine,
|
|
2
|
-
import type {
|
|
1
|
+
import { AssetPromise, Component, Engine, Entity, ReferResource, ResourceManager, Scene } from "@galacean/engine-core";
|
|
2
|
+
import type { ComponentSchema } from "../../../schema/HierarchySchema";
|
|
3
3
|
export declare enum ParserType {
|
|
4
4
|
Prefab = 0,
|
|
5
5
|
Scene = 1
|
|
@@ -7,24 +7,24 @@ export declare enum ParserType {
|
|
|
7
7
|
/**
|
|
8
8
|
* @internal
|
|
9
9
|
*/
|
|
10
|
-
export declare class ParserContext
|
|
10
|
+
export declare class ParserContext {
|
|
11
11
|
readonly engine: Engine;
|
|
12
12
|
readonly type: ParserType;
|
|
13
13
|
readonly resource: ReferResource | Scene;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
/** Runtime Entity instances, indexed by the flat entities[] position. */
|
|
15
|
+
entityInstances: Entity[];
|
|
16
|
+
/** Components waiting for props/calls application (Stage 4). */
|
|
17
|
+
pendingComponents: Array<{
|
|
18
|
+
instance: Component;
|
|
19
|
+
config: ComponentSchema;
|
|
20
|
+
}>;
|
|
20
21
|
readonly resourceManager: ResourceManager;
|
|
21
|
-
private _tasks;
|
|
22
22
|
private _loaded;
|
|
23
23
|
private _total;
|
|
24
|
-
constructor(engine: Engine, type: ParserType, resource: ReferResource | Scene);
|
|
24
|
+
constructor(engine: Engine, type: ParserType | undefined, resource: ReferResource | Scene);
|
|
25
25
|
clear(): void;
|
|
26
26
|
/** @internal */
|
|
27
27
|
_setTaskCompleteProgress: (loaded: number, total: number) => void;
|
|
28
28
|
/** @internal */
|
|
29
|
-
_addDependentAsset(
|
|
29
|
+
_addDependentAsset(promise: AssetPromise<any>): void;
|
|
30
30
|
}
|
|
@@ -1,21 +1,46 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
1
|
+
import { Component } from "@galacean/engine-core";
|
|
2
|
+
import type { CallSpec, MutationBlock, RefItem } from "../../../schema/CommonSchema";
|
|
3
3
|
import { ParserContext } from "./ParserContext";
|
|
4
4
|
export declare class ReflectionParser {
|
|
5
5
|
private readonly _context;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
6
|
+
private readonly _refs;
|
|
7
|
+
/** @internal shared with HierarchyParser; each use must length=0 -> getComponents -> read -> length=0 synchronously. */
|
|
8
|
+
static _componentBuffer: Component[];
|
|
9
|
+
constructor(_context: ParserContext, _refs: RefItem[]);
|
|
10
|
+
/**
|
|
11
|
+
* Apply v2 props to a component/object instance.
|
|
12
|
+
* Each prop value is resolved recursively (handling $ref, $number, $type, $class, $entity, $component, $signal).
|
|
13
|
+
*/
|
|
14
|
+
parseProps(instance: any, props?: Record<string, unknown>): Promise<any>;
|
|
15
|
+
/**
|
|
16
|
+
* Execute calls sequentially on a target instance.
|
|
17
|
+
* Call args are resolved with the same v2 value rules as props.
|
|
18
|
+
*/
|
|
19
|
+
parseCalls(instance: any, calls?: CallSpec[]): Promise<any>;
|
|
20
|
+
/**
|
|
21
|
+
* Apply props before executing calls from the same mutation block.
|
|
22
|
+
*/
|
|
23
|
+
parseMutationBlock(target: any, block?: MutationBlock): Promise<any>;
|
|
24
|
+
/**
|
|
25
|
+
* Resolve a v2 value with $ prefix detection.
|
|
26
|
+
*
|
|
27
|
+
* Priority:
|
|
28
|
+
* 1. null/undefined/primitive → passthrough
|
|
29
|
+
* 2. Array → recurse each element
|
|
30
|
+
* 3. { $ref } → asset reference
|
|
31
|
+
* 4. { $number } → JSON-safe special number
|
|
32
|
+
* 5. { $type, $args? } → polymorphic type construct
|
|
33
|
+
* 6. { $class } → registered class constructor
|
|
34
|
+
* 7. { $entity } → entity reference by path (flat index + optional children descent)
|
|
35
|
+
* 8. { $component } → component reference
|
|
36
|
+
* 9. { $signal } → signal binding
|
|
37
|
+
* 10. plain object → recurse values (modify originValue in place if exists)
|
|
38
|
+
*/
|
|
39
|
+
private _resolveValue;
|
|
40
|
+
private _getRegisteredClass;
|
|
41
|
+
/** Promise-adapt {@link _getRegisteredClass} so $type/$class branches can fold into the resolver chain. */
|
|
42
|
+
private _resolveRegisteredClass;
|
|
43
|
+
private _resolveSignal;
|
|
44
|
+
private _resolveComponent;
|
|
45
|
+
private _resolveEntityRef;
|
|
21
46
|
}
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { Scene } from "@galacean/engine-core";
|
|
2
|
+
import type { SceneFile } from "../../../schema/SceneSchema";
|
|
2
3
|
import { HierarchyParser } from "../parser/HierarchyParser";
|
|
3
4
|
import { ParserContext } from "../parser/ParserContext";
|
|
4
|
-
import { type IScene } from "../schema";
|
|
5
5
|
/** @Internal */
|
|
6
|
-
export declare class SceneParser extends HierarchyParser<Scene, ParserContext
|
|
6
|
+
export declare class SceneParser extends HierarchyParser<Scene, ParserContext> {
|
|
7
7
|
readonly scene: Scene;
|
|
8
|
-
constructor(data:
|
|
8
|
+
constructor(data: SceneFile, context: ParserContext, scene: Scene);
|
|
9
9
|
/**
|
|
10
10
|
* @internal
|
|
11
11
|
*/
|
|
12
|
-
_collectDependentAssets(data:
|
|
13
|
-
protected
|
|
12
|
+
_collectDependentAssets(data: SceneFile): void;
|
|
13
|
+
protected _getRootIndices(): number[];
|
|
14
|
+
protected _handleRootEntity(index: number): void;
|
|
14
15
|
protected _clearAndResolve(): Scene;
|
|
15
|
-
private _parseDependentAssets;
|
|
16
|
-
private _searchDependentAssets;
|
|
17
16
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import type { FileHeader } from "./FileHeader";
|
|
1
2
|
export declare class BufferReader {
|
|
2
3
|
data: Uint8Array;
|
|
4
|
+
readonly header?: Readonly<FileHeader> | undefined;
|
|
3
5
|
private _dataView;
|
|
4
6
|
private _littleEndian;
|
|
5
7
|
private _position;
|
|
6
8
|
private _baseOffset;
|
|
7
|
-
constructor(data: Uint8Array, byteOffset?: number, byteLength?: number, littleEndian?: boolean);
|
|
9
|
+
constructor(data: Uint8Array, byteOffset?: number, byteLength?: number, littleEndian?: boolean, header?: Readonly<FileHeader> | undefined);
|
|
8
10
|
get position(): number;
|
|
9
11
|
get offset(): number;
|
|
10
12
|
nextUint8(): number;
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export type Vec3Tuple = [number, number, number];
|
|
2
|
+
export type Vec4Tuple = [number, number, number, number];
|
|
3
|
+
export interface RefItem {
|
|
4
|
+
url: string;
|
|
5
|
+
key?: string;
|
|
6
|
+
}
|
|
7
|
+
/** path[0] = flat index into top-level entities[]; subsequent indices descend via children. */
|
|
8
|
+
export type EntityRef = number[];
|
|
9
|
+
export interface ComponentRef {
|
|
10
|
+
entity: EntityRef;
|
|
11
|
+
type: string;
|
|
12
|
+
index: number;
|
|
13
|
+
}
|
|
14
|
+
/** Reference to a registered runtime class constructor. */
|
|
15
|
+
export interface ClassRef {
|
|
16
|
+
$class: string;
|
|
17
|
+
}
|
|
18
|
+
/** Registered runtime value with optional recursively-resolved constructor arguments. */
|
|
19
|
+
export interface TypeValue {
|
|
20
|
+
$type: string;
|
|
21
|
+
$args?: unknown[];
|
|
22
|
+
[key: string]: unknown;
|
|
23
|
+
}
|
|
24
|
+
/** JSON-safe encoding for positive infinity. */
|
|
25
|
+
export interface SpecialNumberValue {
|
|
26
|
+
$number: "Infinity";
|
|
27
|
+
}
|
|
28
|
+
export interface SignalListener {
|
|
29
|
+
target: {
|
|
30
|
+
$component: ComponentRef;
|
|
31
|
+
};
|
|
32
|
+
methodName: string;
|
|
33
|
+
args?: unknown[];
|
|
34
|
+
}
|
|
35
|
+
export interface CallSpec {
|
|
36
|
+
/** Optional property path from the mutation root to the method owner. */
|
|
37
|
+
target?: string[];
|
|
38
|
+
method: string;
|
|
39
|
+
args?: unknown[];
|
|
40
|
+
result?: MutationBlock;
|
|
41
|
+
}
|
|
42
|
+
export interface MutationBlock {
|
|
43
|
+
props?: Record<string, unknown>;
|
|
44
|
+
calls?: CallSpec[];
|
|
45
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { MutationBlock, RefItem, Vec3Tuple } from "./CommonSchema";
|
|
2
|
+
export interface ComponentSchema extends MutationBlock {
|
|
3
|
+
type: string;
|
|
4
|
+
script?: number;
|
|
5
|
+
}
|
|
6
|
+
export interface EntityOverrideProps {
|
|
7
|
+
name?: string;
|
|
8
|
+
isActive?: boolean;
|
|
9
|
+
layer?: number;
|
|
10
|
+
position?: Vec3Tuple;
|
|
11
|
+
rotation?: Vec3Tuple;
|
|
12
|
+
scale?: Vec3Tuple;
|
|
13
|
+
}
|
|
14
|
+
export interface AddedEntityOverride {
|
|
15
|
+
/** Parent path from prefab instance root via children indices. `[]` = instance root. */
|
|
16
|
+
parent: number[];
|
|
17
|
+
/** Index into the top-level entities[] array. */
|
|
18
|
+
entity: number;
|
|
19
|
+
}
|
|
20
|
+
export interface AddedComponentOverride {
|
|
21
|
+
/** Target entity path from prefab instance root via children indices. `[]` = instance root. */
|
|
22
|
+
target: number[];
|
|
23
|
+
/** Index into the top-level components[] array. */
|
|
24
|
+
component: number;
|
|
25
|
+
}
|
|
26
|
+
export interface EntityPropOverride extends EntityOverrideProps {
|
|
27
|
+
/** Path from prefab instance root via children indices. `[]` = instance root. */
|
|
28
|
+
path: number[];
|
|
29
|
+
}
|
|
30
|
+
export interface ComponentSelector {
|
|
31
|
+
type: string;
|
|
32
|
+
index: number;
|
|
33
|
+
}
|
|
34
|
+
export interface ComponentOverride extends MutationBlock {
|
|
35
|
+
/** Path from prefab instance root via children indices. `[]` = instance root. */
|
|
36
|
+
path: number[];
|
|
37
|
+
selector: ComponentSelector;
|
|
38
|
+
}
|
|
39
|
+
export interface RemovedComponentOverride {
|
|
40
|
+
/** Path from prefab instance root via children indices. `[]` = instance root. */
|
|
41
|
+
path: number[];
|
|
42
|
+
selectors: ComponentSelector[];
|
|
43
|
+
}
|
|
44
|
+
export interface InstanceOverrides {
|
|
45
|
+
entityProps?: EntityPropOverride[];
|
|
46
|
+
componentProps?: ComponentOverride[];
|
|
47
|
+
/** Each element is a path from prefab instance root via children indices. */
|
|
48
|
+
removedEntities?: number[][];
|
|
49
|
+
removedComponents?: RemovedComponentOverride[];
|
|
50
|
+
addedEntities?: AddedEntityOverride[];
|
|
51
|
+
addedComponents?: AddedComponentOverride[];
|
|
52
|
+
}
|
|
53
|
+
export interface InstanceSchema {
|
|
54
|
+
asset: number;
|
|
55
|
+
overrides?: InstanceOverrides;
|
|
56
|
+
}
|
|
57
|
+
export interface NormalEntitySchema extends EntityOverrideProps {
|
|
58
|
+
children?: number[];
|
|
59
|
+
components?: number[];
|
|
60
|
+
}
|
|
61
|
+
export interface PrefabInstanceEntitySchema {
|
|
62
|
+
instance: InstanceSchema;
|
|
63
|
+
}
|
|
64
|
+
export type EntitySchema = NormalEntitySchema | PrefabInstanceEntitySchema;
|
|
65
|
+
/** Common base for v2 scene and prefab files. */
|
|
66
|
+
export interface HierarchyFile {
|
|
67
|
+
version: "2.0";
|
|
68
|
+
refs: RefItem[];
|
|
69
|
+
entities: EntitySchema[];
|
|
70
|
+
components: ComponentSchema[];
|
|
71
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { RefItem } from "./CommonSchema";
|
|
2
|
+
import type { IColor, IVector2, IVector3, IVector4 } from "./BasicSchema";
|
|
3
|
+
interface MaterialData {
|
|
4
|
+
name: string;
|
|
5
|
+
shaderData: Record<string, MaterialShaderProperty>;
|
|
6
|
+
macros: Array<{
|
|
7
|
+
name: string;
|
|
8
|
+
value?: string;
|
|
9
|
+
}>;
|
|
10
|
+
}
|
|
11
|
+
interface MaterialWithShaderName extends MaterialData {
|
|
12
|
+
/** Registered shader name used to resolve the material's shader. */
|
|
13
|
+
shader: string;
|
|
14
|
+
shaderRef?: undefined;
|
|
15
|
+
}
|
|
16
|
+
interface MaterialWithShaderReference extends MaterialData {
|
|
17
|
+
/** Shader asset reference that determines the material's shader. */
|
|
18
|
+
shaderRef: RefItem;
|
|
19
|
+
/** Optional shader name retained alongside the explicit reference. */
|
|
20
|
+
shader?: string;
|
|
21
|
+
}
|
|
22
|
+
/** Serialized material with a shader name or an explicit shader asset reference. */
|
|
23
|
+
export type IMaterialSchema = MaterialWithShaderName | MaterialWithShaderReference;
|
|
24
|
+
/** Serialized shader property whose type determines the value representation. */
|
|
25
|
+
export type MaterialShaderProperty = {
|
|
26
|
+
type: MaterialLoaderType.Vector2;
|
|
27
|
+
value: IVector2;
|
|
28
|
+
} | {
|
|
29
|
+
type: MaterialLoaderType.Vector3;
|
|
30
|
+
value: IVector3;
|
|
31
|
+
} | {
|
|
32
|
+
type: MaterialLoaderType.Vector4;
|
|
33
|
+
value: IVector4;
|
|
34
|
+
} | {
|
|
35
|
+
type: MaterialLoaderType.Color;
|
|
36
|
+
value: IColor;
|
|
37
|
+
} | {
|
|
38
|
+
type: MaterialLoaderType.Float | MaterialLoaderType.Integer;
|
|
39
|
+
value: number;
|
|
40
|
+
} | {
|
|
41
|
+
type: MaterialLoaderType.Boolean;
|
|
42
|
+
value: boolean;
|
|
43
|
+
} | {
|
|
44
|
+
type: MaterialLoaderType.Texture;
|
|
45
|
+
value: RefItem;
|
|
46
|
+
};
|
|
47
|
+
export declare enum MaterialLoaderType {
|
|
48
|
+
Vector2 = "Vector2",
|
|
49
|
+
Vector3 = "Vector3",
|
|
50
|
+
Vector4 = "Vector4",
|
|
51
|
+
Color = "Color",
|
|
52
|
+
Float = "Float",
|
|
53
|
+
Texture = "Texture",
|
|
54
|
+
Boolean = "Boolean",
|
|
55
|
+
Integer = "Integer"
|
|
56
|
+
}
|
|
57
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { BackgroundMode, BackgroundTextureFillMode, DiffuseMode, FogMode, ShadowCascadesMode, ShadowResolution } from "@galacean/engine-core";
|
|
2
|
+
import type { HierarchyFile } from "./HierarchySchema";
|
|
3
|
+
import type { Vec3Tuple, Vec4Tuple } from "./CommonSchema";
|
|
4
|
+
export declare enum SpecularMode {
|
|
5
|
+
Sky = 0,
|
|
6
|
+
Custom = 1
|
|
7
|
+
}
|
|
8
|
+
export interface SceneFile extends HierarchyFile {
|
|
9
|
+
scene: {
|
|
10
|
+
name?: string;
|
|
11
|
+
rootEntities: number[];
|
|
12
|
+
background: {
|
|
13
|
+
mode: BackgroundMode;
|
|
14
|
+
color: Vec4Tuple;
|
|
15
|
+
texture?: number;
|
|
16
|
+
textureFillMode?: BackgroundTextureFillMode;
|
|
17
|
+
skyMesh?: number;
|
|
18
|
+
skyMaterial?: number;
|
|
19
|
+
};
|
|
20
|
+
ambient?: {
|
|
21
|
+
diffuseMode: DiffuseMode;
|
|
22
|
+
ambientLight?: number;
|
|
23
|
+
customAmbientLight?: number;
|
|
24
|
+
diffuseSolidColor?: Vec4Tuple;
|
|
25
|
+
diffuseIntensity: number;
|
|
26
|
+
specularIntensity: number;
|
|
27
|
+
specularMode: SpecularMode;
|
|
28
|
+
};
|
|
29
|
+
shadow?: {
|
|
30
|
+
castShadows?: boolean;
|
|
31
|
+
enableTransparentShadow?: boolean;
|
|
32
|
+
shadowResolution?: ShadowResolution;
|
|
33
|
+
shadowDistance?: number;
|
|
34
|
+
shadowCascades?: ShadowCascadesMode;
|
|
35
|
+
shadowTwoCascadeSplits?: number;
|
|
36
|
+
shadowFourCascadeSplits?: Vec3Tuple;
|
|
37
|
+
shadowFadeBorder?: number;
|
|
38
|
+
};
|
|
39
|
+
fog?: {
|
|
40
|
+
fogMode?: FogMode;
|
|
41
|
+
fogStart?: number;
|
|
42
|
+
fogEnd?: number;
|
|
43
|
+
fogDensity?: number;
|
|
44
|
+
fogColor?: Vec4Tuple;
|
|
45
|
+
};
|
|
46
|
+
ambientOcclusion?: {
|
|
47
|
+
enabledAmbientOcclusion?: boolean;
|
|
48
|
+
quality?: number;
|
|
49
|
+
intensity?: number;
|
|
50
|
+
radius?: number;
|
|
51
|
+
bias?: number;
|
|
52
|
+
power?: number;
|
|
53
|
+
bilateralThreshold?: number;
|
|
54
|
+
minHorizonAngle?: number;
|
|
55
|
+
};
|
|
56
|
+
/** Not supported in scene yet; presence triggers a warning. */
|
|
57
|
+
postProcess?: unknown;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
export * from "./CommonSchema";
|
|
2
|
+
export * from "./HierarchySchema";
|
|
3
|
+
export * from "./SceneSchema";
|
|
4
|
+
export * from "./PrefabSchema";
|
|
1
5
|
export * from "./BasicSchema";
|
|
2
6
|
export * from "./MaterialSchema";
|
|
3
7
|
export * from "./ProjectSchema";
|
|
4
|
-
export * from "./SceneSchema";
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { AssetPromise, LoadItem, Loader, ResourceManager } from "@galacean/engine-core";
|
|
2
|
-
export declare class ShaderChunkLoader extends Loader<void[]> {
|
|
3
|
-
private static _shaderIncludeRegex;
|
|
4
|
-
/**
|
|
5
|
-
* @internal
|
|
6
|
-
*/
|
|
7
|
-
static _loadChunksInCode(code: string, basePath: string, resourceManager: ResourceManager): Promise<void[]>;
|
|
8
|
-
load(item: LoadItem, resourceManager: ResourceManager): AssetPromise<void[]>;
|
|
9
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { AssetPromise, Engine, ModelMesh } from "@galacean/engine-core";
|
|
2
|
-
import type { BufferReader } from "../../utils/BufferReader";
|
|
3
|
-
/**
|
|
4
|
-
* @todo refactor
|
|
5
|
-
*/
|
|
6
|
-
export declare class MeshDecoder {
|
|
7
|
-
static decode(engine: Engine, bufferReader: BufferReader, restoredMesh?: ModelMesh): AssetPromise<ModelMesh>;
|
|
8
|
-
}
|