@galacean/engine-loader 2.0.0-alpha.5 → 2.0.0-alpha.50
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 +3139 -3376
- package/dist/main.js.map +1 -1
- package/dist/module.js +3139 -3377
- package/dist/module.js.map +1 -1
- package/package.json +4 -4
- package/types/GLTFContentRestorer.d.ts +13 -13
- package/types/HDRDecoder.d.ts +43 -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 +2 -3
- package/types/gltf/extensions/MeshoptDecoder.d.ts +1 -1
- 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 +6 -7
- package/types/ktx2/KTX2Container.d.ts +1 -0
- package/types/ktx2/KTX2Loader.d.ts +1 -1
- 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 -3
- package/types/resource-deserialize/resources/mesh/IModelMesh.d.ts +123 -0
- 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/textureCube/TextureCubeDecoder.d.ts +1 -0
- package/types/resource-deserialize/utils/BufferReader.d.ts +3 -1
- package/types/resource-deserialize/utils/FileHeader.d.ts +5 -0
- 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 +27 -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/Texture2DContentRestorer.d.ts +0 -10
- package/types/TextureCubeContentRestorer.d.ts +0 -10
- package/types/resource-deserialize/resources/scene/EditorTextureLoader.d.ts +0 -4
- 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 -5
- /package/types/{EnvLoader.d.ts → AmbientLightLoader.d.ts} +0 -0
- /package/types/{HDRLoader.d.ts → RenderTargetLoader.d.ts} +0 -0
- /package/types/{TextureCubeLoader.d.ts → resource-deserialize/resources/texture2D/Texture2DDecoder.d.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@galacean/engine-loader",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.50",
|
|
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-
|
|
23
|
-
"@galacean/engine-
|
|
24
|
-
"@galacean/engine-
|
|
22
|
+
"@galacean/engine-core": "2.0.0-alpha.50",
|
|
23
|
+
"@galacean/engine-rhi-webgl": "2.0.0-alpha.50",
|
|
24
|
+
"@galacean/engine-math": "2.0.0-alpha.50"
|
|
25
25
|
},
|
|
26
26
|
"scripts": {
|
|
27
27
|
"b:types": "tsc"
|
|
@@ -53,21 +53,21 @@ export declare class BufferRestoreInfo {
|
|
|
53
53
|
*/
|
|
54
54
|
export declare class BufferDataRestoreInfo {
|
|
55
55
|
main: RestoreDataAccessor;
|
|
56
|
-
typeSize?: number;
|
|
57
|
-
sparseCount?: number;
|
|
58
|
-
sparseIndices?: RestoreDataAccessor;
|
|
59
|
-
sparseValues?: RestoreDataAccessor;
|
|
60
|
-
constructor(main: RestoreDataAccessor, typeSize?: number, sparseCount?: number, sparseIndices?: RestoreDataAccessor, sparseValues?: RestoreDataAccessor);
|
|
56
|
+
typeSize?: number | undefined;
|
|
57
|
+
sparseCount?: number | undefined;
|
|
58
|
+
sparseIndices?: RestoreDataAccessor | undefined;
|
|
59
|
+
sparseValues?: RestoreDataAccessor | undefined;
|
|
60
|
+
constructor(main: RestoreDataAccessor, typeSize?: number | undefined, sparseCount?: number | undefined, sparseIndices?: RestoreDataAccessor | undefined, sparseValues?: RestoreDataAccessor | undefined);
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
63
63
|
* @internal
|
|
64
64
|
*/
|
|
65
65
|
export declare class RestoreDataAccessor {
|
|
66
|
-
bufferIndex: number;
|
|
66
|
+
bufferIndex: number | undefined;
|
|
67
67
|
TypedArray: Uint8ArrayConstructor | Int8ArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Uint32ArrayConstructor | Float32ArrayConstructor;
|
|
68
|
-
byteOffset: number;
|
|
68
|
+
byteOffset: number | undefined;
|
|
69
69
|
length: number;
|
|
70
|
-
constructor(bufferIndex: number, TypedArray: Uint8ArrayConstructor | Int8ArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Uint32ArrayConstructor | Float32ArrayConstructor, byteOffset: number, length: number);
|
|
70
|
+
constructor(bufferIndex: number | undefined, TypedArray: Uint8ArrayConstructor | Int8ArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Uint32ArrayConstructor | Float32ArrayConstructor, byteOffset: number | undefined, length: number);
|
|
71
71
|
}
|
|
72
72
|
/**
|
|
73
73
|
* @internal
|
|
@@ -75,9 +75,9 @@ export declare class RestoreDataAccessor {
|
|
|
75
75
|
export declare class BlendShapeRestoreInfo {
|
|
76
76
|
blendShape: BlendShape;
|
|
77
77
|
position: BlendShapeDataRestoreInfo;
|
|
78
|
-
normal?: BlendShapeDataRestoreInfo;
|
|
79
|
-
tangent?: BlendShapeDataRestoreInfo;
|
|
80
|
-
constructor(blendShape: BlendShape, position: BlendShapeDataRestoreInfo, normal?: BlendShapeDataRestoreInfo, tangent?: BlendShapeDataRestoreInfo);
|
|
78
|
+
normal?: (BlendShapeDataRestoreInfo | null) | undefined;
|
|
79
|
+
tangent?: (BlendShapeDataRestoreInfo | null) | undefined;
|
|
80
|
+
constructor(blendShape: BlendShape, position: BlendShapeDataRestoreInfo, normal?: (BlendShapeDataRestoreInfo | null) | undefined, tangent?: (BlendShapeDataRestoreInfo | null) | undefined);
|
|
81
81
|
}
|
|
82
82
|
/**
|
|
83
83
|
* @internal
|
|
@@ -86,7 +86,7 @@ export declare class BlendShapeDataRestoreInfo {
|
|
|
86
86
|
buffer: BufferDataRestoreInfo;
|
|
87
87
|
byteOffset: number;
|
|
88
88
|
count: number;
|
|
89
|
-
normalized: boolean;
|
|
89
|
+
normalized: boolean | undefined;
|
|
90
90
|
componentType: AccessorComponentType;
|
|
91
|
-
constructor(buffer: BufferDataRestoreInfo, byteOffset: number, count: number, normalized: boolean, componentType: AccessorComponentType);
|
|
91
|
+
constructor(buffer: BufferDataRestoreInfo, byteOffset: number, count: number, normalized: boolean | undefined, componentType: AccessorComponentType);
|
|
92
92
|
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
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.
|
|
6
|
+
*/
|
|
7
|
+
export declare class HDRDecoder {
|
|
8
|
+
private static _float2HalfTables;
|
|
9
|
+
private static _floatView;
|
|
10
|
+
private static _uint32View;
|
|
11
|
+
/**
|
|
12
|
+
* Parse the header of an HDR file.
|
|
13
|
+
* @returns Header info including width, height, and data start position.
|
|
14
|
+
*/
|
|
15
|
+
static parseHeader(uint8array: Uint8Array): IHDRHeader;
|
|
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
|
+
* @internal
|
|
28
|
+
* Convert RGBE pixel data to R16G16B16A16 half-float.
|
|
29
|
+
*/
|
|
30
|
+
static _rgbeToHalfFloat(rgbe: Uint8Array, width: number, height: number): Uint16Array;
|
|
31
|
+
/**
|
|
32
|
+
* @internal
|
|
33
|
+
* Decode RLE-compressed RGBE scanlines into raw RGBE pixel data.
|
|
34
|
+
*/
|
|
35
|
+
static _readPixels(buffer: Uint8Array, width: number, height: number): Uint8Array;
|
|
36
|
+
private static _generateFloat2HalfTables;
|
|
37
|
+
private static _readStringLine;
|
|
38
|
+
}
|
|
39
|
+
export interface IHDRHeader {
|
|
40
|
+
width: number;
|
|
41
|
+
height: number;
|
|
42
|
+
dataPosition: number;
|
|
43
|
+
}
|
package/types/SceneLoader.d.ts
CHANGED
|
@@ -1 +1,8 @@
|
|
|
1
|
-
|
|
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
|
-
*
|
|
3
|
+
* Texture loader params interface.
|
|
4
4
|
*/
|
|
5
|
-
export interface
|
|
6
|
-
/** Texture format. default
|
|
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
|
|
18
|
+
/** Whether the texture data is in sRGB color space. @defaultValue `true` */
|
|
19
19
|
isSRGBColorSpace: boolean;
|
|
20
20
|
}
|
|
@@ -32,13 +32,13 @@ export declare class GLTFResource extends ReferResource {
|
|
|
32
32
|
*/
|
|
33
33
|
constructor(engine: Engine, url: string);
|
|
34
34
|
/**
|
|
35
|
-
* Instantiate scene root
|
|
36
|
-
* @param sceneIndex -
|
|
37
|
-
* @returns
|
|
35
|
+
* Instantiate a glTF scene root Entity.
|
|
36
|
+
* @param sceneIndex - The scene index
|
|
37
|
+
* @returns A detached scene-root instance that must be added to a parent Entity or Scene to update and render
|
|
38
38
|
*/
|
|
39
39
|
instantiateSceneRoot(sceneIndex?: number): Entity;
|
|
40
40
|
protected _onDestroy(): void;
|
|
41
|
-
private
|
|
41
|
+
private _disassociateResources;
|
|
42
42
|
/**
|
|
43
43
|
* @deprecated
|
|
44
44
|
* Entity after EntityParser.
|
|
@@ -17,17 +17,17 @@ export declare class GLTFUtils {
|
|
|
17
17
|
/**
|
|
18
18
|
* Get the TypedArray corresponding to the component type.
|
|
19
19
|
*/
|
|
20
|
-
static getComponentType(componentType: AccessorComponentType):
|
|
20
|
+
static getComponentType(componentType: AccessorComponentType): Uint8ArrayConstructor | Float32ArrayConstructor | Uint32ArrayConstructor | Uint16ArrayConstructor | Int8ArrayConstructor | Int16ArrayConstructor;
|
|
21
21
|
static getNormalizedComponentScale(componentType: AccessorComponentType): number;
|
|
22
|
-
static getAccessorBuffer(context: GLTFParserContext, bufferViews: IBufferView[], accessor: IAccessor): AssetPromise<BufferInfo>;
|
|
23
|
-
static bufferToVector3Array(buffer: TypedArray, byteOffset: number, count: number, normalized: boolean, componentType: AccessorComponentType): Vector3[];
|
|
22
|
+
static getAccessorBuffer(context: GLTFParserContext, bufferViews: IBufferView[] | undefined, accessor: IAccessor): AssetPromise<BufferInfo>;
|
|
23
|
+
static bufferToVector3Array(buffer: TypedArray, byteOffset: number, count: number, normalized: boolean | undefined, componentType: AccessorComponentType): Vector3[];
|
|
24
24
|
static getBufferViewData(bufferView: IBufferView, buffers: ArrayBuffer[]): ArrayBuffer;
|
|
25
25
|
/**
|
|
26
26
|
* Get accessor data.
|
|
27
27
|
*/
|
|
28
28
|
static processingSparseData(context: GLTFParserContext, accessor: IAccessor, bufferInfo: BufferInfo): AssetPromise<void>;
|
|
29
|
-
static getIndexFormat(type: AccessorComponentType): IndexFormat;
|
|
30
|
-
static getElementFormat(type: AccessorComponentType, size: number, normalized?: boolean): VertexElementFormat;
|
|
29
|
+
static getIndexFormat(type: AccessorComponentType): IndexFormat | undefined;
|
|
30
|
+
static getElementFormat(type: AccessorComponentType, size: number, normalized?: boolean): VertexElementFormat | undefined;
|
|
31
31
|
/**
|
|
32
32
|
* Load image buffer
|
|
33
33
|
*/
|
|
@@ -39,7 +39,7 @@ export declare class GLTFUtils {
|
|
|
39
39
|
glTF?: IGLTF;
|
|
40
40
|
buffers?: ArrayBuffer[];
|
|
41
41
|
originBuffer?: ArrayBuffer;
|
|
42
|
-
};
|
|
42
|
+
} | null;
|
|
43
43
|
static parseSampler(texture: Texture2D, samplerInfo: ISamplerInfo): void;
|
|
44
44
|
static getSamplerInfo(sampler: ISampler): ISamplerInfo;
|
|
45
45
|
}
|
|
@@ -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 | AssetPromise<EngineObject | Uint8Array>;
|
|
22
|
+
createAndParse(context: GLTFParserContext, extensionSchema: GLTFExtensionSchema, extensionOwnerSchema: GLTFExtensionOwnerSchema, ...extra: any[]): EngineObject | AssetPromise<EngineObject | Uint8Array | null>;
|
|
23
23
|
/**
|
|
24
24
|
* Additive parse to the resource.
|
|
25
25
|
* @param context - The parser context
|
|
@@ -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
|
-
refId: string;
|
|
138
|
-
key?: string;
|
|
137
|
+
export interface IGalaceanMaterialRemap extends RefItem {
|
|
139
138
|
isClone?: boolean;
|
|
140
139
|
}
|
|
141
140
|
export interface IGalaceanAnimation {
|
|
@@ -3,7 +3,7 @@ export declare let ready: Promise<{
|
|
|
3
3
|
useWorkers: (count?: number) => void;
|
|
4
4
|
decodeGltfBuffer: (count: any, stride: any, source: any, mode: any, filter: any) => Promise<Uint8Array>;
|
|
5
5
|
release: () => void;
|
|
6
|
-
}
|
|
6
|
+
}> | undefined;
|
|
7
7
|
export declare function getMeshoptDecoder(): Promise<{
|
|
8
8
|
workerCount: number;
|
|
9
9
|
useWorkers: (count?: number) => void;
|
|
@@ -2,6 +2,6 @@ import { AnimatorController, AssetPromise } from "@galacean/engine-core";
|
|
|
2
2
|
import { GLTFParser } from "./GLTFParser";
|
|
3
3
|
import { GLTFParserContext } from "./GLTFParserContext";
|
|
4
4
|
export declare class GLTFAnimatorControllerParser extends GLTFParser {
|
|
5
|
-
parse(context: GLTFParserContext): AssetPromise<AnimatorController>;
|
|
5
|
+
parse(context: GLTFParserContext): AssetPromise<AnimatorController | null>;
|
|
6
6
|
private _createAnimatorController;
|
|
7
7
|
}
|
|
@@ -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 | AssetPromise<EngineObject | Uint8Array | void>;
|
|
20
|
+
} | undefined, context: GLTFParserContext, ownerSchema: GLTFExtensionOwnerSchema, ...extra: any[]): EngineObject | void | AssetPromise<EngineObject | Uint8Array | void>;
|
|
21
21
|
/**
|
|
22
22
|
* Execute all parses of extension to parse resource.
|
|
23
23
|
* @param extensions - Related extensions field
|
|
@@ -28,7 +28,7 @@ export declare abstract class GLTFParser {
|
|
|
28
28
|
*/
|
|
29
29
|
static executeExtensionsAdditiveAndParse(extensions: {
|
|
30
30
|
[key: string]: any;
|
|
31
|
-
}, context: GLTFParserContext, parseResource: EngineObject, ownerSchema: GLTFExtensionOwnerSchema, ...extra: any[]): void;
|
|
31
|
+
} | undefined, context: GLTFParserContext, parseResource: EngineObject, ownerSchema: GLTFExtensionOwnerSchema, ...extra: any[]): void;
|
|
32
32
|
/**
|
|
33
33
|
* Whether the plugin is registered.
|
|
34
34
|
* @param extensionName - Extension name
|
|
@@ -21,6 +21,7 @@ export declare class GLTFParserContext {
|
|
|
21
21
|
/** @internal */
|
|
22
22
|
_getPromises: AssetPromise<unknown>[];
|
|
23
23
|
private _resourceCache;
|
|
24
|
+
private readonly _remoteAssetBaseURL;
|
|
24
25
|
private _progress;
|
|
25
26
|
/** @internal */
|
|
26
27
|
_setTaskCompleteProgress: (loaded: number, total: number) => void;
|
|
@@ -30,10 +31,10 @@ export declare class GLTFParserContext {
|
|
|
30
31
|
get<T>(type: GLTFParserType.Entity, index: number): Entity;
|
|
31
32
|
get<T>(type: GLTFParserType.Entity): Entity[];
|
|
32
33
|
get<T>(type: GLTFParserType.Schema): AssetPromise<T>;
|
|
33
|
-
get<T>(type: GLTFParserType.Validator): AssetPromise<T>;
|
|
34
|
-
get<T>(type: GLTFParserType.AnimatorController): AssetPromise<T>;
|
|
34
|
+
get<T>(type: GLTFParserType.Validator): AssetPromise<T | null>;
|
|
35
|
+
get<T>(type: GLTFParserType.AnimatorController): AssetPromise<T | null>;
|
|
35
36
|
get<T>(type: GLTFParserType, index: number): AssetPromise<T>;
|
|
36
|
-
get<T>(type: GLTFParserType): AssetPromise<T[]>;
|
|
37
|
+
get<T>(type: GLTFParserType): AssetPromise<T[] | null>;
|
|
37
38
|
parse(): AssetPromise<GLTFResource>;
|
|
38
39
|
/**
|
|
39
40
|
* @internal
|
|
@@ -2,10 +2,10 @@ 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;
|
|
8
9
|
private _createRenderer;
|
|
9
10
|
private _computeLocalBounds;
|
|
10
|
-
private _computeApproximateBindMatrix;
|
|
11
11
|
}
|
|
@@ -3,5 +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
|
+
/**
|
|
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
|
+
*/
|
|
6
10
|
private _findSkeletonRootBone;
|
|
7
11
|
}
|
|
@@ -2,5 +2,5 @@ import { AssetPromise } from "@galacean/engine-core";
|
|
|
2
2
|
import { GLTFParser } from "./GLTFParser";
|
|
3
3
|
import { GLTFParserContext } from "./GLTFParserContext";
|
|
4
4
|
export declare class GLTFValidator extends GLTFParser {
|
|
5
|
-
parse(context: GLTFParserContext): AssetPromise<
|
|
5
|
+
parse(context: GLTFParserContext): AssetPromise<null>;
|
|
6
6
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import "./AnimationClipLoader";
|
|
2
2
|
import "./AnimatorControllerLoader";
|
|
3
3
|
import "./BufferLoader";
|
|
4
|
-
import "./
|
|
4
|
+
import "./AmbientLightLoader";
|
|
5
5
|
import "./FontLoader";
|
|
6
6
|
import "./GLTFLoader";
|
|
7
7
|
import "./PrefabLoader";
|
|
8
|
-
import "./HDRLoader";
|
|
9
8
|
import "./JSONLoader";
|
|
10
9
|
import "./KTXCubeLoader";
|
|
11
10
|
import "./KTXLoader";
|
|
@@ -17,20 +16,20 @@ import "./SourceFontLoader";
|
|
|
17
16
|
import "./SpriteAtlasLoader";
|
|
18
17
|
import "./SpriteLoader";
|
|
19
18
|
import "./TextLoader";
|
|
20
|
-
import "./
|
|
21
|
-
import "./TextureCubeLoader";
|
|
19
|
+
import "./TextureLoader";
|
|
22
20
|
import "./AudioLoader";
|
|
23
21
|
import "./ktx2/KTX2Loader";
|
|
24
22
|
import "./ShaderLoader";
|
|
25
|
-
import "./ShaderChunkLoader";
|
|
26
23
|
import "./PhysicsMaterialLoader";
|
|
24
|
+
import "./RenderTargetLoader";
|
|
27
25
|
export { GLTFLoader } from "./GLTFLoader";
|
|
28
26
|
export type { GLTFParams } from "./GLTFLoader";
|
|
29
|
-
|
|
30
|
-
export type {
|
|
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";
|
|
34
32
|
export { KTX2TargetFormat } from "./ktx2/KTX2TargetFormat";
|
|
35
33
|
export * from "./resource-deserialize";
|
|
36
34
|
export * from "./prefab/PrefabResource";
|
|
35
|
+
export { HDRDecoder } from "./HDRDecoder";
|
|
@@ -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
|
*/
|
|
@@ -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
|
/**
|
|
@@ -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
|
-
|
|
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
|
|
@@ -13,9 +14,8 @@ export { Texture2DDecoder } from "./resources/texture2D/TextureDecoder";
|
|
|
13
14
|
export declare function decode<T>(arrayBuffer: ArrayBuffer, engine: Engine, ...args: any[]): AssetPromise<T>;
|
|
14
15
|
export * from "./resources/parser/HierarchyParser";
|
|
15
16
|
export * from "./resources/parser/ParserContext";
|
|
16
|
-
export * from "./resources/scene/EditorTextureLoader";
|
|
17
17
|
export * from "./resources/scene/SceneParser";
|
|
18
|
-
export * from "
|
|
18
|
+
export * from "../schema";
|
|
19
19
|
export * from "./utils/BufferReader";
|
|
20
20
|
export * from "./utils/Decorator";
|
|
21
21
|
export * from "./utils/FileHeader";
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { MeshTopology } from "@galacean/engine-core";
|
|
2
|
+
import type { IColor, IVector2, IVector3, IVector4 } from "../../../schema/BasicSchema";
|
|
3
|
+
export interface IEncodedModelMesh {
|
|
4
|
+
positions: {
|
|
5
|
+
start: number;
|
|
6
|
+
end: number;
|
|
7
|
+
};
|
|
8
|
+
normals?: {
|
|
9
|
+
start: number;
|
|
10
|
+
end: number;
|
|
11
|
+
};
|
|
12
|
+
uvs?: {
|
|
13
|
+
start: number;
|
|
14
|
+
end: number;
|
|
15
|
+
};
|
|
16
|
+
uv1?: {
|
|
17
|
+
start: number;
|
|
18
|
+
end: number;
|
|
19
|
+
};
|
|
20
|
+
uv2?: {
|
|
21
|
+
start: number;
|
|
22
|
+
end: number;
|
|
23
|
+
};
|
|
24
|
+
uv3?: {
|
|
25
|
+
start: number;
|
|
26
|
+
end: number;
|
|
27
|
+
};
|
|
28
|
+
uv4?: {
|
|
29
|
+
start: number;
|
|
30
|
+
end: number;
|
|
31
|
+
};
|
|
32
|
+
uv5?: {
|
|
33
|
+
start: number;
|
|
34
|
+
end: number;
|
|
35
|
+
};
|
|
36
|
+
uv6?: {
|
|
37
|
+
start: number;
|
|
38
|
+
end: number;
|
|
39
|
+
};
|
|
40
|
+
uv7?: {
|
|
41
|
+
start: number;
|
|
42
|
+
end: number;
|
|
43
|
+
};
|
|
44
|
+
colors?: {
|
|
45
|
+
start: number;
|
|
46
|
+
end: number;
|
|
47
|
+
};
|
|
48
|
+
tangents?: {
|
|
49
|
+
start: number;
|
|
50
|
+
end: number;
|
|
51
|
+
};
|
|
52
|
+
boneWeights?: {
|
|
53
|
+
start: number;
|
|
54
|
+
end: number;
|
|
55
|
+
};
|
|
56
|
+
boneIndices?: {
|
|
57
|
+
start: number;
|
|
58
|
+
end: number;
|
|
59
|
+
};
|
|
60
|
+
blendShapes?: {
|
|
61
|
+
name: string;
|
|
62
|
+
frames: {
|
|
63
|
+
weight: number;
|
|
64
|
+
deltaPosition: {
|
|
65
|
+
start: number;
|
|
66
|
+
end: number;
|
|
67
|
+
};
|
|
68
|
+
deltaNormals?: {
|
|
69
|
+
start: number;
|
|
70
|
+
end: number;
|
|
71
|
+
};
|
|
72
|
+
deltaTangents?: {
|
|
73
|
+
start: number;
|
|
74
|
+
end: number;
|
|
75
|
+
};
|
|
76
|
+
}[];
|
|
77
|
+
}[];
|
|
78
|
+
indices?: {
|
|
79
|
+
type: number;
|
|
80
|
+
start: number;
|
|
81
|
+
end: number;
|
|
82
|
+
};
|
|
83
|
+
bounds?: {
|
|
84
|
+
min: IVector3[];
|
|
85
|
+
max: IVector3[];
|
|
86
|
+
};
|
|
87
|
+
subMeshes: {
|
|
88
|
+
start: number;
|
|
89
|
+
topology: MeshTopology;
|
|
90
|
+
count: number;
|
|
91
|
+
}[];
|
|
92
|
+
}
|
|
93
|
+
export interface IModelMesh {
|
|
94
|
+
positions: IVector3[];
|
|
95
|
+
normals?: IVector3[];
|
|
96
|
+
uvs?: IVector2[];
|
|
97
|
+
uv1?: IVector2[];
|
|
98
|
+
uv2?: IVector2[];
|
|
99
|
+
uv3?: IVector2[];
|
|
100
|
+
uv4?: IVector2[];
|
|
101
|
+
uv5?: IVector2[];
|
|
102
|
+
uv6?: IVector2[];
|
|
103
|
+
uv7?: IVector2[];
|
|
104
|
+
colors?: IColor[];
|
|
105
|
+
tangents?: IVector4[];
|
|
106
|
+
boneWeights?: IVector4[];
|
|
107
|
+
boneIndices?: IVector4[];
|
|
108
|
+
blendShapes?: {
|
|
109
|
+
name: string;
|
|
110
|
+
frames: {
|
|
111
|
+
weight: number;
|
|
112
|
+
deltaPositions: IVector3[];
|
|
113
|
+
deltaNormals: IVector3[];
|
|
114
|
+
deltaTangents: IVector4[];
|
|
115
|
+
}[];
|
|
116
|
+
}[];
|
|
117
|
+
indices?: number[];
|
|
118
|
+
subMeshes: {
|
|
119
|
+
start: number;
|
|
120
|
+
topology: MeshTopology;
|
|
121
|
+
count: number;
|
|
122
|
+
}[];
|
|
123
|
+
}
|
|
@@ -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
|
}
|