@galacean/engine-loader 0.0.0-experimental-2.0-game.19 → 0.0.0-experimental-2.0-migrate.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 (35) hide show
  1. package/dist/main.js +5707 -5939
  2. package/dist/main.js.map +1 -1
  3. package/dist/module.js +5708 -5940
  4. package/dist/module.js.map +1 -1
  5. package/package.json +4 -4
  6. package/types/HDRDecoder.d.ts +27 -8
  7. package/types/SceneLoader.d.ts +8 -1
  8. package/types/{Texture2DLoader.d.ts → TextureLoader.d.ts} +4 -4
  9. package/types/gltf/GLTFResource.d.ts +5 -0
  10. package/types/gltf/extensions/GLTFExtensionSchema.d.ts +2 -3
  11. package/types/gltf/parser/GLTFSceneParser.d.ts +1 -0
  12. package/types/gltf/parser/GLTFSkinParser.d.ts +5 -2
  13. package/types/index.d.ts +3 -5
  14. package/types/prefab/PrefabParser.d.ts +9 -6
  15. package/types/resource-deserialize/index.d.ts +3 -2
  16. package/types/resource-deserialize/resources/parser/HierarchyParser.d.ts +22 -27
  17. package/types/resource-deserialize/resources/parser/ParserContext.d.ts +11 -11
  18. package/types/resource-deserialize/resources/parser/ReflectionParser.d.ts +41 -18
  19. package/types/resource-deserialize/resources/scene/SceneParser.d.ts +6 -7
  20. package/types/schema/BasicSchema.d.ts +21 -0
  21. package/types/schema/CommonSchema.d.ts +33 -0
  22. package/types/schema/HierarchySchema.d.ts +71 -0
  23. package/types/schema/MaterialSchema.d.ts +27 -0
  24. package/types/schema/PrefabSchema.d.ts +4 -0
  25. package/types/schema/SceneSchema.d.ts +63 -0
  26. package/types/{resource-deserialize/resources/schema → schema}/index.d.ts +4 -1
  27. package/types/schema/refs.d.ts +2 -0
  28. package/types/ShaderChunkLoader.d.ts +0 -9
  29. package/types/resource-deserialize/resources/schema/BasicSchema.d.ts +0 -105
  30. package/types/resource-deserialize/resources/schema/MaterialSchema.d.ts +0 -102
  31. package/types/resource-deserialize/resources/schema/SceneSchema.d.ts +0 -84
  32. package/types/resource-deserialize/resources/texture2D/TextureDecoder.d.ts +0 -9
  33. /package/types/{TextureCubeLoader.d.ts → resource-deserialize/resources/texture2D/Texture2DDecoder.d.ts} +0 -0
  34. /package/types/{gltf/parser/GLTFSkinParser.test.d.ts → resource-deserialize/resources/textureCube/TextureCubeDecoder.d.ts} +0 -0
  35. /package/types/{resource-deserialize/resources/schema → schema}/ProjectSchema.d.ts +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacean/engine-loader",
3
- "version": "0.0.0-experimental-2.0-game.19",
3
+ "version": "0.0.0-experimental-2.0-migrate.2",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -19,9 +19,9 @@
19
19
  "libs/**/*"
20
20
  ],
21
21
  "dependencies": {
22
- "@galacean/engine-core": "0.0.0-experimental-2.0-game.19",
23
- "@galacean/engine-rhi-webgl": "0.0.0-experimental-2.0-game.19",
24
- "@galacean/engine-math": "0.0.0-experimental-2.0-game.19"
22
+ "@galacean/engine-core": "0.0.0-experimental-2.0-migrate.2",
23
+ "@galacean/engine-rhi-webgl": "0.0.0-experimental-2.0-migrate.2",
24
+ "@galacean/engine-math": "0.0.0-experimental-2.0-migrate.2"
25
25
  },
26
26
  "scripts": {
27
27
  "b:types": "tsc"
@@ -1,22 +1,41 @@
1
1
  /**
2
- * HDR panorama to cubemap decoder.
2
+ * HDR (Radiance RGBE) image decoder.
3
+ *
4
+ * Decodes .hdr files into pixel data. Supports parsing the header
5
+ * and decoding RLE-compressed RGBE scanlines into R16G16B16A16 half-float pixels.
3
6
  */
4
7
  export declare class HDRDecoder {
5
8
  private static _float2HalfTables;
6
9
  private static _floatView;
7
10
  private static _uint32View;
8
- private static _one;
9
- private static _faces;
11
+ /**
12
+ * Parse the header of an HDR file.
13
+ * @returns Header info including width, height, and data start position.
14
+ */
10
15
  static parseHeader(uint8array: Uint8Array): IHDRHeader;
11
- static decodeFaces(bufferArray: Uint8Array, header: IHDRHeader, onFace: (faceIndex: number, data: Uint16Array) => void): void;
16
+ /**
17
+ * Decode an HDR file buffer into R16G16B16A16 half-float pixel data.
18
+ * @param buffer - The full HDR file as Uint8Array.
19
+ * @returns Object with width, height, and half-float pixel data.
20
+ */
21
+ static decode(buffer: Uint8Array): {
22
+ width: number;
23
+ height: number;
24
+ pixels: Uint16Array;
25
+ };
26
+ /**
27
+ * Convert RGBE pixel data to R16G16B16A16 half-float.
28
+ */
29
+ static _rgbeToHalfFloat(rgbe: Uint8Array, width: number, height: number): Uint16Array;
30
+ /**
31
+ * Decode RLE-compressed RGBE scanlines into raw RGBE pixel data.
32
+ */
33
+ static _readPixels(buffer: Uint8Array, width: number, height: number): Uint8Array;
12
34
  private static _generateFloat2HalfTables;
13
- private static _createCubemapData;
14
35
  private static _readStringLine;
15
- private static _readPixels;
16
36
  }
17
- interface IHDRHeader {
37
+ export interface IHDRHeader {
18
38
  width: number;
19
39
  height: number;
20
40
  dataPosition: number;
21
41
  }
22
- export {};
@@ -1 +1,8 @@
1
- export {};
1
+ import { ResourceManager, Scene } from "@galacean/engine-core";
2
+ import type { RefItem } from "./schema/CommonSchema";
3
+ import { type SceneFile } from "./schema/SceneSchema";
4
+ /**
5
+ * Apply scene-level data (ambient, background, shadow, fog, AO) to a Scene.
6
+ * @internal
7
+ */
8
+ export declare function applySceneData(scene: Scene, sceneData: SceneFile["scene"], resourceManager: ResourceManager, refs: RefItem[]): Promise<void>;
@@ -1,9 +1,9 @@
1
1
  import { TextureFilterMode, TextureFormat, TextureWrapMode } from "@galacean/engine-core";
2
2
  /**
3
- * Texture2D loader params interface.
3
+ * Texture loader params interface.
4
4
  */
5
- export interface Texture2DParams {
6
- /** Texture format. default `TextureFormat.R8G8B8A8` */
5
+ export interface TextureParams {
6
+ /** Texture format. default `TextureFormat.R8G8B8A8` */
7
7
  format: TextureFormat;
8
8
  /** Whether to use multi-level texture, default is true. */
9
9
  mipmap: boolean;
@@ -15,6 +15,6 @@ export interface Texture2DParams {
15
15
  filterMode: TextureFilterMode;
16
16
  /** Anisotropic level for texture. */
17
17
  anisoLevel: number;
18
- /** Whether the texture data is in sRGB color space, otherwise is linear color space. @defaultValue `true` */
18
+ /** Whether the texture data is in sRGB color space. @defaultValue `true` */
19
19
  isSRGBColorSpace: boolean;
20
20
  }
@@ -37,6 +37,11 @@ export declare class GLTFResource extends ReferResource {
37
37
  * @returns Root entity
38
38
  */
39
39
  instantiateSceneRoot(sceneIndex?: number): Entity;
40
+ /**
41
+ * Scene root templates indexed by the glTF `scenes` array.
42
+ * @remarks This is also the canonical sub-asset query surface, for example `?q=scenes[0]`.
43
+ */
44
+ get scenes(): ReadonlyArray<Entity>;
40
45
  protected _onDestroy(): void;
41
46
  private _disassociationSuperResource;
42
47
  /**
@@ -1,4 +1,5 @@
1
1
  import type { IMaterialNormalTextureInfo, ITextureInfo } from "../GLTFSchema";
2
+ import type { RefItem } from "../../schema/CommonSchema";
2
3
  /**
3
4
  * Interfaces from the KHR_lights_punctual extension
4
5
  */
@@ -133,9 +134,7 @@ export interface IEXTMeshoptCompressionSchema {
133
134
  count: number;
134
135
  filter?: "NONE" | "OCTAHEDRAL" | "QUATERNION" | "EXPONENTIAL";
135
136
  }
136
- export interface IGalaceanMaterialRemap {
137
- url: string;
138
- key?: string;
137
+ export interface IGalaceanMaterialRemap extends RefItem {
139
138
  isClone?: boolean;
140
139
  }
141
140
  export interface IGalaceanAnimation {
@@ -2,6 +2,7 @@ import { AssetPromise, Entity } from "@galacean/engine-core";
2
2
  import { GLTFParser } from "./GLTFParser";
3
3
  import { GLTFParserContext } from "./GLTFParserContext";
4
4
  export declare class GLTFSceneParser extends GLTFParser {
5
+ private static _tempMatrix;
5
6
  parse(context: GLTFParserContext, index: number): AssetPromise<Entity>;
6
7
  private _parseEntityComponent;
7
8
  private _createCamera;
@@ -3,6 +3,9 @@ import { GLTFParser } from "./GLTFParser";
3
3
  import { GLTFParserContext } from "./GLTFParserContext";
4
4
  export declare class GLTFSkinParser extends GLTFParser {
5
5
  parse(context: GLTFParserContext, index: number): AssetPromise<Skin>;
6
- private _findSkinRootBoneByLCA;
7
- private _findRootBoneByLCA;
6
+ /**
7
+ * Resolve the skeleton rootBone as the lowest common ancestor of the joints' parent chains.
8
+ * Returns null when joints share no common ancestor.
9
+ */
10
+ private _findSkeletonRootBone;
8
11
  }
package/types/index.d.ts CHANGED
@@ -16,18 +16,16 @@ import "./SourceFontLoader";
16
16
  import "./SpriteAtlasLoader";
17
17
  import "./SpriteLoader";
18
18
  import "./TextLoader";
19
- import "./Texture2DLoader";
20
- import "./TextureCubeLoader";
19
+ import "./TextureLoader";
21
20
  import "./AudioLoader";
22
21
  import "./ktx2/KTX2Loader";
23
22
  import "./ShaderLoader";
24
- import "./ShaderChunkLoader";
25
23
  import "./PhysicsMaterialLoader";
26
24
  import "./RenderTargetLoader";
27
25
  export { GLTFLoader } from "./GLTFLoader";
28
26
  export type { GLTFParams } from "./GLTFLoader";
29
- export * from "./SceneLoader";
30
- export type { Texture2DParams } from "./Texture2DLoader";
27
+ import "./SceneLoader";
28
+ export type { TextureParams } from "./TextureLoader";
31
29
  export { parseSingleKTX } from "./compressed-texture";
32
30
  export * from "./gltf";
33
31
  export { KTX2Loader } from "./ktx2/KTX2Loader";
@@ -1,12 +1,15 @@
1
1
  import { Engine, Entity } from "@galacean/engine-core";
2
- import { IEntity, IHierarchyFile, ParserContext } from "../resource-deserialize";
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<IHierarchyFile, Entity>> {
7
+ export declare class PrefabParser extends HierarchyParser<PrefabResource, ParserContext> {
6
8
  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 _applyEntityData(entity: Entity, entityConfig?: IEntity): Entity;
10
- protected _handleRootEntity(id: string): void;
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
  }
@@ -3,7 +3,8 @@ export * from "./resources/animationClip/AnimationClipDecoder";
3
3
  export type { IModelMesh } from "./resources/mesh/IModelMesh";
4
4
  export { MeshDecoder } from "./resources/mesh/MeshDecoder";
5
5
  export { ReflectionParser } from "./resources/parser/ReflectionParser";
6
- export { Texture2DDecoder } from "./resources/texture2D/TextureDecoder";
6
+ import "./resources/texture2D/Texture2DDecoder";
7
+ import "./resources/textureCube/TextureCubeDecoder";
7
8
  /**
8
9
  * Decode engine binary resource.
9
10
  * @param arrayBuffer - array buffer of decode binary file
@@ -14,7 +15,7 @@ export declare function decode<T>(arrayBuffer: ArrayBuffer, engine: Engine, ...a
14
15
  export * from "./resources/parser/HierarchyParser";
15
16
  export * from "./resources/parser/ParserContext";
16
17
  export * from "./resources/scene/SceneParser";
17
- export * from "./resources/schema";
18
+ export * from "../schema";
18
19
  export * from "./utils/BufferReader";
19
20
  export * from "./utils/Decorator";
20
21
  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 { IEntity, IHierarchyFile } from "../schema";
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<IHierarchyFile, T>> {
8
- readonly data: IHierarchyFile;
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
- private _prefabContextMap;
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
- protected _applyEntityData(entity: Entity, entityConfig?: IEntity): Entity;
24
- protected abstract _handleRootEntity(id: string): void;
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 _getEntityByConfig;
34
- private _parseEntity;
35
- private _parsePrefab;
36
- private _parseStrippedEntity;
37
- private _parseChildren;
38
- private _addComponents;
39
- private _generateInstanceContext;
40
- private _parseComponentsPropsAndMethods;
41
- private _addComponentPlugin;
42
- private _addEntityPlugin;
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, EngineObject, Entity, ReferResource, ResourceManager, Scene } from "@galacean/engine-core";
2
- import type { IEntity, IHierarchyFile } from "../schema";
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,18 +7,18 @@ export declare enum ParserType {
7
7
  /**
8
8
  * @internal
9
9
  */
10
- export declare class ParserContext<T extends IHierarchyFile, I extends EngineObject> {
10
+ export declare class ParserContext {
11
11
  readonly engine: Engine;
12
12
  readonly type: ParserType;
13
13
  readonly resource: ReferResource | Scene;
14
- entityMap: Map<string, Entity>;
15
- entityConfigMap: Map<string, IEntity>;
16
- components: Map<string, Component>;
17
- componentConfigMap: Map<string, any>;
18
- rootIds: string[];
19
- strippedIds: string[];
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
24
  constructor(engine: Engine, type: ParserType, resource: ReferResource | Scene);
@@ -26,5 +26,5 @@ export declare class ParserContext<T extends IHierarchyFile, I extends EngineObj
26
26
  /** @internal */
27
27
  _setTaskCompleteProgress: (loaded: number, total: number) => void;
28
28
  /** @internal */
29
- _addDependentAsset(url: string, promise: AssetPromise<any>): void;
29
+ _addDependentAsset(promise: AssetPromise<any>): void;
30
30
  }
@@ -1,22 +1,45 @@
1
- import { EngineObject, Entity, Signal } from "@galacean/engine-core";
2
- import type { IBasicType, IClass, IEntity, IHierarchyFile, IMethodParams, ISignalRef } from "../schema";
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
- constructor(_context: ParserContext<IHierarchyFile, EngineObject>);
7
- parseEntity(entityConfig: IEntity): Promise<Entity>;
8
- parseClassObject(item: IClass): Promise<any>;
9
- parsePropsAndMethods(instance: any, item: Omit<IClass, "class">): Promise<any>;
10
- parseMethod(instance: any, methodName: string, methodParams: IMethodParams): Promise<any>;
11
- parseSignal(signalRef: ISignalRef): Promise<Signal>;
12
- parseBasicType(value: IBasicType, originValue?: any): Promise<any>;
13
- private _getEntityByConfig;
14
- private _resolveEntityByPath;
15
- private static _isClass;
16
- private static _isClassType;
17
- private static _isAssetRef;
18
- private static _isEntityRef;
19
- private static _isComponentRef;
20
- private static _isSignalRef;
21
- private static _isMethodObject;
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, $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 and calls from the same mutation block without imposing ordering between them.
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. { $type } → polymorphic type construct
32
+ * 5. { $class } → registered class constructor
33
+ * 6. { $entity } → entity reference by path (flat index + optional children descent)
34
+ * 7. { $component } → component reference
35
+ * 8. { $signal } → signal binding
36
+ * 9. plain object → recurse values (modify originValue in place if exists)
37
+ */
38
+ private _resolveValue;
39
+ private _getRegisteredClass;
40
+ /** Promise-adapt {@link _getRegisteredClass} so $type/$class branches can fold into the resolver chain. */
41
+ private _resolveRegisteredClass;
42
+ private _resolveSignal;
43
+ private _resolveComponent;
44
+ private _resolveEntityRef;
22
45
  }
@@ -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<IScene, Scene>> {
6
+ export declare class SceneParser extends HierarchyParser<Scene, ParserContext> {
7
7
  readonly scene: Scene;
8
- constructor(data: IScene, context: ParserContext<IScene, Scene>, scene: Scene);
8
+ constructor(data: SceneFile, context: ParserContext, scene: Scene);
9
9
  /**
10
10
  * @internal
11
11
  */
12
- _collectDependentAssets(data: IScene): void;
13
- protected _handleRootEntity(id: string): void;
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,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,33 @@
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
+ export interface SignalListener {
19
+ target: {
20
+ $component: ComponentRef;
21
+ };
22
+ methodName: string;
23
+ args?: unknown[];
24
+ }
25
+ export interface CallSpec {
26
+ method: string;
27
+ args?: unknown[];
28
+ result?: MutationBlock;
29
+ }
30
+ export interface MutationBlock {
31
+ props?: Record<string, unknown>;
32
+ calls?: CallSpec[];
33
+ }
@@ -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,27 @@
1
+ import type { RefItem } from "./CommonSchema";
2
+ import type { IColor, IVector2, IVector3 } from "./BasicSchema";
3
+ export interface IMaterialSchema {
4
+ name: string;
5
+ shader: string;
6
+ shaderData: {
7
+ [key: string]: {
8
+ type: MaterialLoaderType;
9
+ value: IVector3 | IVector2 | IColor | number | RefItem;
10
+ };
11
+ };
12
+ macros: Array<{
13
+ name: string;
14
+ value?: string;
15
+ }>;
16
+ shaderRef: RefItem;
17
+ }
18
+ export declare enum MaterialLoaderType {
19
+ Vector2 = "Vector2",
20
+ Vector3 = "Vector3",
21
+ Vector4 = "Vector4",
22
+ Color = "Color",
23
+ Float = "Float",
24
+ Texture = "Texture",
25
+ Boolean = "Boolean",
26
+ Integer = "Integer"
27
+ }
@@ -0,0 +1,4 @@
1
+ import type { HierarchyFile } from "./HierarchySchema";
2
+ export interface PrefabFile extends HierarchyFile {
3
+ root: number;
4
+ }
@@ -0,0 +1,63 @@
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
+ physics?: {
47
+ gravity?: Vec3Tuple;
48
+ fixedTimeStep?: number;
49
+ };
50
+ ambientOcclusion?: {
51
+ enabledAmbientOcclusion?: boolean;
52
+ quality?: number;
53
+ intensity?: number;
54
+ radius?: number;
55
+ bias?: number;
56
+ power?: number;
57
+ bilateralThreshold?: number;
58
+ minHorizonAngle?: number;
59
+ };
60
+ /** Not supported in scene yet; presence triggers a warning. */
61
+ postProcess?: unknown;
62
+ };
63
+ }