@galacean/engine-loader 0.9.0 → 1.0.0-beta.0
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 +1449 -1050
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +1470 -1071
- package/dist/module.js +1436 -1052
- package/dist/module.js.map +1 -1
- package/package.json +5 -5
- package/types/AnimationClipLoader.d.ts +1 -0
- package/types/GLTFContentRestorer.d.ts +85 -0
- package/types/GLTFLoader.d.ts +6 -0
- package/types/Texture2DContentRestorer.d.ts +14 -0
- package/types/TextureCubeContentRestorer.d.ts +14 -0
- package/types/gltf/GLTFPipeline.d.ts +23 -0
- package/types/gltf/GLTFResource.d.ts +7 -11
- package/types/gltf/{Schema.d.ts → GLTFSchema.d.ts} +2 -0
- package/types/gltf/{GLTFUtil.d.ts → GLTFUtils.d.ts} +9 -15
- package/types/gltf/extensions/GALACEAN_animation_event.d.ts +1 -0
- package/types/gltf/extensions/GLTFExtensionParser.d.ts +52 -0
- package/types/gltf/extensions/{Schema.d.ts → GLTFExtensionSchema.d.ts} +9 -2
- package/types/gltf/extensions/KHR_materials_variants.d.ts +6 -1
- package/types/gltf/extensions/index.d.ts +4 -1
- package/types/gltf/index.d.ts +6 -0
- package/types/gltf/parser/GLTFAnimationParser.d.ts +12 -0
- package/types/gltf/parser/GLTFBufferParser.d.ts +7 -0
- package/types/gltf/parser/GLTFEntityParser.d.ts +9 -0
- package/types/gltf/parser/GLTFMaterialParser.d.ts +15 -0
- package/types/gltf/parser/GLTFMeshParser.d.ts +19 -0
- package/types/gltf/parser/GLTFParser.d.ts +63 -0
- package/types/gltf/parser/{ParserContext.d.ts → GLTFParserContext.d.ts} +6 -4
- package/types/gltf/parser/GLTFSceneParser.d.ts +11 -0
- package/types/gltf/parser/GLTFSkinParser.d.ts +6 -0
- package/types/gltf/parser/GLTFTextureParser.d.ts +8 -0
- package/types/gltf/parser/GLTFValidator.d.ts +6 -0
- package/types/gltf/parser/index.d.ts +11 -0
- package/types/index.d.ts +2 -2
- package/types/resource-deserialize/resources/prefab/PrefabDesign.d.ts +4 -4
- package/types/gltf/GLTFParser.d.ts +0 -9
- package/types/gltf/extensions/ExtensionParser.d.ts +0 -8
- package/types/gltf/parser/AnimationParser.d.ts +0 -7
- package/types/gltf/parser/BufferParser.d.ts +0 -7
- package/types/gltf/parser/EntityParser.d.ts +0 -9
- package/types/gltf/parser/MaterialParser.d.ts +0 -8
- package/types/gltf/parser/MeshParser.d.ts +0 -13
- package/types/gltf/parser/Parser.d.ts +0 -21
- package/types/gltf/parser/SceneParser.d.ts +0 -11
- package/types/gltf/parser/SkinParser.d.ts +0 -6
- package/types/gltf/parser/TextureParser.d.ts +0 -8
- package/types/gltf/parser/Validator.d.ts +0 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@galacean/engine-loader",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-beta.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
"types/**/*"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@galacean/engine-core": "0.
|
|
19
|
-
"@galacean/engine-
|
|
20
|
-
"@galacean/engine-
|
|
21
|
-
"@galacean/engine-
|
|
18
|
+
"@galacean/engine-core": "1.0.0-beta.0",
|
|
19
|
+
"@galacean/engine-draco": "1.0.0-beta.0",
|
|
20
|
+
"@galacean/engine-math": "1.0.0-beta.0",
|
|
21
|
+
"@galacean/engine-rhi-webgl": "1.0.0-beta.0"
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
24
24
|
"b:types": "tsc"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { AssetPromise, BlendShape, Buffer, ContentRestorer, ModelMesh, Texture2D } from "@galacean/engine-core";
|
|
2
|
+
import { RequestConfig } from "@galacean/engine-core/types/asset/request";
|
|
3
|
+
import { Vector2 } from "@galacean/engine-math";
|
|
4
|
+
import { GLTFResource } from "./gltf/GLTFResource";
|
|
5
|
+
import { IBufferView } from "./gltf/GLTFSchema";
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export declare class GLTFContentRestorer extends ContentRestorer<GLTFResource> {
|
|
10
|
+
isGLB: boolean;
|
|
11
|
+
bufferRequests: BufferRequestInfo[];
|
|
12
|
+
glbBufferSlices: Vector2[];
|
|
13
|
+
bufferTextures: BufferTextureRestoreInfo[];
|
|
14
|
+
meshes: ModelMeshRestoreInfo[];
|
|
15
|
+
/**
|
|
16
|
+
* @override
|
|
17
|
+
*/
|
|
18
|
+
restoreContent(): AssetPromise<GLTFResource>;
|
|
19
|
+
private _getBufferData;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
export declare class BufferRequestInfo {
|
|
25
|
+
url: string;
|
|
26
|
+
config: RequestConfig;
|
|
27
|
+
constructor(url: string, config: RequestConfig);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* @internal
|
|
31
|
+
*/
|
|
32
|
+
export declare class BufferTextureRestoreInfo {
|
|
33
|
+
texture: Texture2D;
|
|
34
|
+
bufferView: IBufferView;
|
|
35
|
+
mimeType: string;
|
|
36
|
+
constructor(texture: Texture2D, bufferView: IBufferView, mimeType: string);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* @internal
|
|
40
|
+
*/
|
|
41
|
+
export declare class ModelMeshRestoreInfo {
|
|
42
|
+
mesh: ModelMesh;
|
|
43
|
+
vertexBuffers: BufferRestoreInfo[];
|
|
44
|
+
indexBuffer: BufferDataRestoreInfo;
|
|
45
|
+
blendShapes: BlendShapeRestoreInfo[];
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* @internal
|
|
49
|
+
*/
|
|
50
|
+
export declare class BufferRestoreInfo {
|
|
51
|
+
buffer: Buffer;
|
|
52
|
+
data: BufferDataRestoreInfo;
|
|
53
|
+
constructor(buffer: Buffer, data: BufferDataRestoreInfo);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* @internal
|
|
57
|
+
*/
|
|
58
|
+
export declare class BufferDataRestoreInfo {
|
|
59
|
+
main: RestoreDataAccessor;
|
|
60
|
+
typeSize?: number;
|
|
61
|
+
sparseCount?: number;
|
|
62
|
+
sparseIndices?: RestoreDataAccessor;
|
|
63
|
+
sparseValues?: RestoreDataAccessor;
|
|
64
|
+
constructor(main: RestoreDataAccessor, typeSize?: number, sparseCount?: number, sparseIndices?: RestoreDataAccessor, sparseValues?: RestoreDataAccessor);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* @internal
|
|
68
|
+
*/
|
|
69
|
+
export declare class RestoreDataAccessor {
|
|
70
|
+
bufferIndex: number;
|
|
71
|
+
TypedArray: new (buffer: ArrayBuffer, byteOffset: number, length?: number) => ArrayBufferView;
|
|
72
|
+
byteOffset: number;
|
|
73
|
+
length: number;
|
|
74
|
+
constructor(bufferIndex: number, TypedArray: new (buffer: ArrayBuffer, byteOffset: number, length?: number) => ArrayBufferView, byteOffset: number, length: number);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* @internal
|
|
78
|
+
*/
|
|
79
|
+
export declare class BlendShapeRestoreInfo {
|
|
80
|
+
blendShape: BlendShape;
|
|
81
|
+
position: BufferDataRestoreInfo;
|
|
82
|
+
normal?: BufferDataRestoreInfo;
|
|
83
|
+
tangent?: BufferDataRestoreInfo;
|
|
84
|
+
constructor(blendShape: BlendShape, position: BufferDataRestoreInfo, normal?: BufferDataRestoreInfo, tangent?: BufferDataRestoreInfo);
|
|
85
|
+
}
|
package/types/GLTFLoader.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { AssetPromise, Loader, LoadItem, ResourceManager } from "@galacean/engine-core";
|
|
2
|
+
import { GLTFPipeline } from "./gltf/GLTFPipeline";
|
|
2
3
|
import { GLTFResource } from "./gltf/GLTFResource";
|
|
3
4
|
export declare class GLTFLoader extends Loader<GLTFResource> {
|
|
5
|
+
/**
|
|
6
|
+
* @override
|
|
7
|
+
*/
|
|
4
8
|
load(item: LoadItem, resourceManager: ResourceManager): Record<string, AssetPromise<any>>;
|
|
5
9
|
}
|
|
6
10
|
/**
|
|
@@ -12,4 +16,6 @@ export interface GLTFParams {
|
|
|
12
16
|
* Keep raw mesh data for glTF parser, default is false.
|
|
13
17
|
*/
|
|
14
18
|
keepMeshData: boolean;
|
|
19
|
+
/** Custom glTF pipeline. */
|
|
20
|
+
pipeline: GLTFPipeline;
|
|
15
21
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AssetPromise, ContentRestorer, Texture2D } from "@galacean/engine-core";
|
|
2
|
+
import { RequestConfig } from "@galacean/engine-core/types/asset/request";
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export declare class Texture2DContentRestorer extends ContentRestorer<Texture2D> {
|
|
7
|
+
url: string;
|
|
8
|
+
requestConfig: RequestConfig;
|
|
9
|
+
constructor(resource: Texture2D, url: string, requestConfig: RequestConfig);
|
|
10
|
+
/**
|
|
11
|
+
* @override
|
|
12
|
+
*/
|
|
13
|
+
restoreContent(): AssetPromise<Texture2D>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AssetPromise, ContentRestorer, TextureCube } from "@galacean/engine-core";
|
|
2
|
+
import { RequestConfig } from "@galacean/engine-core/types/asset/request";
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export declare class TextureCubeContentRestorer extends ContentRestorer<TextureCube> {
|
|
7
|
+
urls: string[];
|
|
8
|
+
requestConfig: RequestConfig;
|
|
9
|
+
constructor(resource: TextureCube, urls: string[], requestConfig: RequestConfig);
|
|
10
|
+
/**
|
|
11
|
+
* @override
|
|
12
|
+
*/
|
|
13
|
+
restoreContent(): AssetPromise<TextureCube>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { AssetPromise } from "@galacean/engine-core";
|
|
2
|
+
import { GLTFResource } from "./GLTFResource";
|
|
3
|
+
import { GLTFParser } from "./parser/GLTFParser";
|
|
4
|
+
import { GLTFParserContext } from "./parser/GLTFParserContext";
|
|
5
|
+
/**
|
|
6
|
+
* GLTF pipeline.
|
|
7
|
+
*/
|
|
8
|
+
export declare class GLTFPipeline {
|
|
9
|
+
/**
|
|
10
|
+
* Default pipeline.
|
|
11
|
+
*/
|
|
12
|
+
static defaultPipeline: GLTFPipeline;
|
|
13
|
+
private _parsers;
|
|
14
|
+
/**
|
|
15
|
+
* Constructor of GLTFPipeline.
|
|
16
|
+
* @param parsers - Parsers to be executed in order
|
|
17
|
+
*/
|
|
18
|
+
constructor(...parsers: (new () => GLTFParser)[]);
|
|
19
|
+
/**
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
_parse(context: GLTFParserContext): AssetPromise<GLTFResource>;
|
|
23
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { AnimationClip, Camera, Engine, EngineObject, Entity, Light, Material, ModelMesh,
|
|
1
|
+
import { AnimationClip, Camera, Engine, EngineObject, Entity, Light, Material, ModelMesh, Skin, Texture2D } from "@galacean/engine-core";
|
|
2
2
|
/**
|
|
3
|
-
* Product after
|
|
3
|
+
* Product after glTF parser, usually, `defaultSceneRoot` is only needed to use.
|
|
4
4
|
*/
|
|
5
5
|
export declare class GLTFResource extends EngineObject {
|
|
6
|
-
/**
|
|
6
|
+
/** glTF file url. */
|
|
7
7
|
url: string;
|
|
8
8
|
/** Texture2D after TextureParser. */
|
|
9
9
|
textures?: Texture2D[];
|
|
@@ -19,21 +19,17 @@ export declare class GLTFResource extends EngineObject {
|
|
|
19
19
|
entities: Entity[];
|
|
20
20
|
/** Camera after SceneParser. */
|
|
21
21
|
cameras?: Camera[];
|
|
22
|
-
/** Export lights in extension KHR_lights_punctual */
|
|
22
|
+
/** Export lights in extension KHR_lights_punctual. */
|
|
23
23
|
lights?: Light[];
|
|
24
24
|
/** RootEntities after SceneParser. */
|
|
25
25
|
sceneRoots: Entity[];
|
|
26
26
|
/** RootEntity after SceneParser. */
|
|
27
27
|
defaultSceneRoot: Entity;
|
|
28
|
-
/**
|
|
29
|
-
|
|
30
|
-
renderer: Renderer;
|
|
31
|
-
material: Material;
|
|
32
|
-
variants: string[];
|
|
33
|
-
}[];
|
|
28
|
+
/** Extensions data. */
|
|
29
|
+
extensionsData: Record<string, any>;
|
|
34
30
|
constructor(engine: Engine, url: string);
|
|
35
31
|
/**
|
|
36
32
|
* @override
|
|
37
33
|
*/
|
|
38
|
-
|
|
34
|
+
protected _onDestroy(): void;
|
|
39
35
|
}
|
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
import { IndexFormat, TypedArray, VertexElementFormat } from "@galacean/engine-core";
|
|
2
2
|
import { Color, Vector2, Vector3, Vector4 } from "@galacean/engine-math";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { AccessorComponentType, AccessorType, IAccessor, IBufferView, IGLTF } from "./GLTFSchema";
|
|
4
|
+
import { BufferInfo, GLTFParserContext } from "./parser/GLTFParserContext";
|
|
5
5
|
/**
|
|
6
6
|
* @internal
|
|
7
7
|
*/
|
|
8
|
-
export declare class
|
|
8
|
+
export declare class GLTFUtils {
|
|
9
9
|
static floatBufferToVector2Array(buffer: Float32Array): Vector2[];
|
|
10
10
|
static floatBufferToVector3Array(buffer: Float32Array): Vector3[];
|
|
11
11
|
static floatBufferToVector4Array(buffer: Float32Array): Vector4[];
|
|
12
12
|
static floatBufferToColorArray(buffer: Float32Array, isColor3: boolean): Color[];
|
|
13
|
-
/**
|
|
14
|
-
* Parse binary text for glb loader.
|
|
15
|
-
*/
|
|
16
|
-
static decodeText(array: Uint8Array): string;
|
|
17
13
|
/**
|
|
18
14
|
* Get the number of bytes occupied by accessor type.
|
|
19
15
|
*/
|
|
@@ -21,32 +17,30 @@ export declare class GLTFUtil {
|
|
|
21
17
|
/**
|
|
22
18
|
* Get the TypedArray corresponding to the component type.
|
|
23
19
|
*/
|
|
24
|
-
static getComponentType(componentType: AccessorComponentType): Uint8ArrayConstructor |
|
|
20
|
+
static getComponentType(componentType: AccessorComponentType): Uint8ArrayConstructor | Int8ArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Uint32ArrayConstructor | Float32ArrayConstructor;
|
|
25
21
|
static getNormalizedComponentScale(componentType: AccessorComponentType): number;
|
|
26
|
-
static getAccessorBuffer(context:
|
|
22
|
+
static getAccessorBuffer(context: GLTFParserContext, bufferViews: IBufferView[], accessor: IAccessor): BufferInfo;
|
|
27
23
|
/**
|
|
28
24
|
* @deprecated
|
|
29
25
|
* Get accessor data.
|
|
30
26
|
*/
|
|
31
|
-
static getAccessorData(
|
|
27
|
+
static getAccessorData(glTF: IGLTF, accessor: IAccessor, buffers: ArrayBuffer[]): TypedArray;
|
|
32
28
|
static getBufferViewData(bufferView: IBufferView, buffers: ArrayBuffer[]): ArrayBuffer;
|
|
33
29
|
/**
|
|
34
30
|
* Get accessor data.
|
|
35
31
|
*/
|
|
36
|
-
static processingSparseData(
|
|
32
|
+
static processingSparseData(bufferViews: IBufferView[], accessor: IAccessor, buffers: ArrayBuffer[], bufferInfo: BufferInfo): void;
|
|
37
33
|
static getIndexFormat(type: AccessorComponentType): IndexFormat;
|
|
38
34
|
static getElementFormat(type: AccessorComponentType, size: number, normalized?: boolean): VertexElementFormat;
|
|
39
35
|
/**
|
|
40
36
|
* Load image buffer
|
|
41
37
|
*/
|
|
42
38
|
static loadImageBuffer(imageBuffer: ArrayBuffer, type: string): Promise<HTMLImageElement>;
|
|
43
|
-
static isAbsoluteUrl(url: string): boolean;
|
|
44
|
-
static parseRelativeUrl(baseUrl: string, relativeUrl: string): string;
|
|
45
39
|
/**
|
|
46
40
|
* Parse the glb format.
|
|
47
41
|
*/
|
|
48
|
-
static parseGLB(glb: ArrayBuffer): {
|
|
49
|
-
|
|
42
|
+
static parseGLB(context: GLTFParserContext, glb: ArrayBuffer): {
|
|
43
|
+
glTF: IGLTF;
|
|
50
44
|
buffers: ArrayBuffer[];
|
|
51
45
|
};
|
|
52
46
|
private static _formatRelativePath;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { EngineObject } from "@galacean/engine-core";
|
|
2
|
+
import { GLTFExtensionOwnerSchema } from "../GLTFSchema";
|
|
3
|
+
import { GLTFParserContext } from "../parser/GLTFParserContext";
|
|
4
|
+
import { GLTFExtensionSchema } from "./GLTFExtensionSchema";
|
|
5
|
+
/**
|
|
6
|
+
* Base class of glTF extension parser.
|
|
7
|
+
*/
|
|
8
|
+
export declare abstract class GLTFExtensionParser {
|
|
9
|
+
/**
|
|
10
|
+
* @internal
|
|
11
|
+
* The extension mode.
|
|
12
|
+
*/
|
|
13
|
+
_mode: GLTFExtensionMode;
|
|
14
|
+
/**
|
|
15
|
+
* Initialize the parser.
|
|
16
|
+
* @remarks Some plugins require initialization.
|
|
17
|
+
* @returns The void or promise
|
|
18
|
+
*/
|
|
19
|
+
initialize(): void | Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Create and parse the resource.
|
|
22
|
+
* @remarks This method overrides the default resource creation.
|
|
23
|
+
* @param context - The parser context
|
|
24
|
+
* @param extensionSchema - The extension schema
|
|
25
|
+
* @param extensionOwnerSchema - The extension owner schema
|
|
26
|
+
* @returns The resource or promise
|
|
27
|
+
*/
|
|
28
|
+
createAndParse(context: GLTFParserContext, extensionSchema: GLTFExtensionSchema, extensionOwnerSchema: GLTFExtensionOwnerSchema, ...extra: any[]): EngineObject | Promise<EngineObject>;
|
|
29
|
+
/**
|
|
30
|
+
* Additive parse to the resource.
|
|
31
|
+
* @param context - The parser context
|
|
32
|
+
* @param parseResource - The parsed resource
|
|
33
|
+
* @param extensionSchema - The extension schema
|
|
34
|
+
* @param extensionOwnerSchema - The extension owner schema
|
|
35
|
+
* @returns The void or promise
|
|
36
|
+
*/
|
|
37
|
+
additiveParse(context: GLTFParserContext, parseResource: EngineObject, extensionSchema: GLTFExtensionSchema, extensionOwnerSchema: GLTFExtensionOwnerSchema, ...extra: any[]): void | Promise<void>;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* glTF Extension mode.
|
|
41
|
+
*/
|
|
42
|
+
export declare enum GLTFExtensionMode {
|
|
43
|
+
/**
|
|
44
|
+
* Cerate instance and parse mode.
|
|
45
|
+
* @remarks
|
|
46
|
+
* If the glTF property has multiple extensions of `CreateAndParse` mode, only execute the last one.
|
|
47
|
+
* If this method is registered, the default pipeline processing will be ignored.
|
|
48
|
+
*/
|
|
49
|
+
CreateAndParse = 0,
|
|
50
|
+
/** Additive parse mode. */
|
|
51
|
+
AdditiveParse = 1
|
|
52
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IMaterialNormalTextureInfo, ITextureInfo } from "../
|
|
1
|
+
import { IMaterialNormalTextureInfo, ITextureInfo } from "../GLTFSchema";
|
|
2
2
|
/**
|
|
3
3
|
* Interfaces from the KHR_lights_punctual extension
|
|
4
4
|
*/
|
|
@@ -139,4 +139,11 @@ export interface IGalaceanMaterialRemap {
|
|
|
139
139
|
key?: string;
|
|
140
140
|
isClone?: boolean;
|
|
141
141
|
}
|
|
142
|
-
export
|
|
142
|
+
export interface IGalaceanAnimation {
|
|
143
|
+
events: {
|
|
144
|
+
time: number;
|
|
145
|
+
functionName: string;
|
|
146
|
+
parameter: any;
|
|
147
|
+
}[];
|
|
148
|
+
}
|
|
149
|
+
export type GLTFExtensionSchema = IKHRLightsPunctual_Light | IKHRDracoMeshCompression | IKHRMaterialsClearcoat | IKHRMaterialsIor | IKHRMaterialsUnlit | IKHRMaterialsPbrSpecularGlossiness | IKHRMaterialsSheen | IKHRMaterialsSpecular | IKHRMaterialsTransmission | IKHRMaterialsTranslucency | IKHRMaterialVariants_Mapping | IKHRMaterialVariants_Variants | IKHRTextureBasisU | IKHRTextureTransform | IKHRXmp | IKHRXmp_Node | IGalaceanAnimation | Object;
|
|
@@ -6,9 +6,12 @@ import "./KHR_materials_pbrSpecularGlossiness";
|
|
|
6
6
|
import "./KHR_materials_sheen";
|
|
7
7
|
import "./KHR_materials_transmission";
|
|
8
8
|
import "./KHR_materials_unlit";
|
|
9
|
-
|
|
9
|
+
export type { IGLTFExtensionVariants } from "./KHR_materials_variants";
|
|
10
10
|
import "./KHR_materials_volume";
|
|
11
11
|
import "./KHR_mesh_quantization";
|
|
12
12
|
import "./KHR_texture_basisu";
|
|
13
13
|
import "./KHR_texture_transform";
|
|
14
14
|
import "./GALACEAN_materials_remap";
|
|
15
|
+
import "./GALACEAN_animation_event";
|
|
16
|
+
export { GLTFExtensionParser, GLTFExtensionMode } from "./GLTFExtensionParser";
|
|
17
|
+
export * from "./GLTFExtensionSchema";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { GLTFPipeline } from "./GLTFPipeline";
|
|
2
|
+
export { GLTFResource } from "./GLTFResource";
|
|
3
|
+
export { GLTFUtils } from "./GLTFUtils";
|
|
4
|
+
export * from "./parser";
|
|
5
|
+
export * from "./extensions/index";
|
|
6
|
+
export type { IMaterial, IMeshPrimitive, ITextureInfo, INode, GLTFExtensionOwnerSchema } from "./GLTFSchema";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AnimationClip, AssetPromise } from "@galacean/engine-core";
|
|
2
|
+
import { IAnimation } from "../GLTFSchema";
|
|
3
|
+
import { GLTFParser } from "./GLTFParser";
|
|
4
|
+
import { GLTFParserContext } from "./GLTFParserContext";
|
|
5
|
+
export declare class GLTFAnimationParser extends GLTFParser {
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
static _parseStandardProperty(context: GLTFParserContext, animationClip: AnimationClip, animationInfo: IAnimation): void;
|
|
10
|
+
private static _addCurve;
|
|
11
|
+
parse(context: GLTFParserContext): AssetPromise<AnimationClip[]>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AssetPromise } from "@galacean/engine-core";
|
|
2
|
+
import { GLTFParser } from "./GLTFParser";
|
|
3
|
+
import { GLTFParserContext } from "./GLTFParserContext";
|
|
4
|
+
export declare class GLTFBufferParser extends GLTFParser {
|
|
5
|
+
parse(context: GLTFParserContext): AssetPromise<void>;
|
|
6
|
+
private _isGLB;
|
|
7
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { GLTFParser } from "./GLTFParser";
|
|
2
|
+
import { GLTFParserContext } from "./GLTFParserContext";
|
|
3
|
+
export declare class GLTFEntityParser extends GLTFParser {
|
|
4
|
+
/** @internal */
|
|
5
|
+
static _defaultName: String;
|
|
6
|
+
parse(context: GLTFParserContext): void;
|
|
7
|
+
private _buildEntityTree;
|
|
8
|
+
private _createSceneRoots;
|
|
9
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AssetPromise, Material, PBRMaterial, PBRSpecularMaterial, UnlitMaterial } from "@galacean/engine-core";
|
|
2
|
+
import { IMaterial, ITextureInfo } from "../GLTFSchema";
|
|
3
|
+
import { GLTFParser } from "./GLTFParser";
|
|
4
|
+
import { GLTFParserContext } from "./GLTFParserContext";
|
|
5
|
+
export declare class GLTFMaterialParser extends GLTFParser {
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
static _checkOtherTextureTransform(texture: ITextureInfo, textureName: string): void;
|
|
10
|
+
/**
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
static _parseStandardProperty(context: GLTFParserContext, material: UnlitMaterial | PBRMaterial | PBRSpecularMaterial, materialInfo: IMaterial): void;
|
|
14
|
+
parse(context: GLTFParserContext): AssetPromise<Material[]>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AssetPromise, ModelMesh, TypedArray } from "@galacean/engine-core";
|
|
2
|
+
import { ModelMeshRestoreInfo } from "../../GLTFContentRestorer";
|
|
3
|
+
import { IGLTF, IMesh, IMeshPrimitive } from "../GLTFSchema";
|
|
4
|
+
import { GLTFParser } from "./GLTFParser";
|
|
5
|
+
import { BufferInfo, GLTFParserContext } from "./GLTFParserContext";
|
|
6
|
+
export declare class GLTFMeshParser extends GLTFParser {
|
|
7
|
+
private static _tempVector3;
|
|
8
|
+
/**
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
static _parseMeshFromGLTFPrimitive(context: GLTFParserContext, mesh: ModelMesh, meshRestoreInfo: ModelMeshRestoreInfo, gltfMesh: IMesh, gltfPrimitive: IMeshPrimitive, gltf: IGLTF, getVertexBufferData: (semantic: string) => TypedArray, getBlendShapeData: (semantic: string, shapeIndex: number) => BufferInfo, getIndexBufferData: () => TypedArray, keepMeshData: boolean): Promise<ModelMesh>;
|
|
12
|
+
/**
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
static _createBlendShape(mesh: ModelMesh, meshRestoreInfo: ModelMeshRestoreInfo, glTFMesh: IMesh, glTFTargets: {
|
|
16
|
+
[name: string]: number;
|
|
17
|
+
}[], getBlendShapeData: (semantic: string, shapeIndex: number) => BufferInfo): void;
|
|
18
|
+
parse(context: GLTFParserContext): AssetPromise<ModelMesh[][]>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { AnimationClip, AssetPromise, EngineObject, Material, Mesh } from "@galacean/engine-core";
|
|
2
|
+
import { GLTFExtensionMode, GLTFExtensionParser } from "../extensions/GLTFExtensionParser";
|
|
3
|
+
import { GLTFExtensionOwnerSchema } from "../GLTFSchema";
|
|
4
|
+
import { GLTFParserContext } from "./GLTFParserContext";
|
|
5
|
+
/**
|
|
6
|
+
* Base class of glTF parser.
|
|
7
|
+
*/
|
|
8
|
+
export declare abstract class GLTFParser {
|
|
9
|
+
private static readonly _extensionParsers;
|
|
10
|
+
/**
|
|
11
|
+
* Execute all parses of extension to initialize plugin.
|
|
12
|
+
* @remarks Some plugins require initialization.
|
|
13
|
+
* @returns The void or promise
|
|
14
|
+
*/
|
|
15
|
+
static executeExtensionsInitialize(extensionName: string): void | Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* Execute all parses of extension to create resource.
|
|
18
|
+
* @param extensions - Related extensions field
|
|
19
|
+
* @param context - The parser context
|
|
20
|
+
* @param ownerSchema - The extension owner schema
|
|
21
|
+
* @param extra - Extra params
|
|
22
|
+
* @returns
|
|
23
|
+
*/
|
|
24
|
+
static executeExtensionsCreateAndParse(extensions: {
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
}, context: GLTFParserContext, ownerSchema: GLTFExtensionOwnerSchema, ...extra: any[]): EngineObject | void | Promise<EngineObject | void>;
|
|
27
|
+
/**
|
|
28
|
+
* Execute all parses of extension to parse resource.
|
|
29
|
+
* @param extensions - Related extensions field
|
|
30
|
+
* @param context - The parser context
|
|
31
|
+
* @param parseResource - The parsed resource
|
|
32
|
+
* @param ownerSchema - The extension owner schema
|
|
33
|
+
* @param extra - Extra params
|
|
34
|
+
*/
|
|
35
|
+
static executeExtensionsAdditiveAndParse(extensions: {
|
|
36
|
+
[key: string]: any;
|
|
37
|
+
}, context: GLTFParserContext, parseResource: EngineObject, ownerSchema: GLTFExtensionOwnerSchema, ...extra: any[]): void;
|
|
38
|
+
/**
|
|
39
|
+
* Whether the plugin is registered.
|
|
40
|
+
* @param extensionName - Extension name
|
|
41
|
+
* @returns Boolean
|
|
42
|
+
*/
|
|
43
|
+
static hasExtensionParser(extensionName: string): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Get the last plugin by glTF extension mode.
|
|
46
|
+
* @param extensionName - Extension name
|
|
47
|
+
* @param mode - GLTF extension mode
|
|
48
|
+
* @returns GLTF extension parser
|
|
49
|
+
*/
|
|
50
|
+
static getExtensionParser(extensionName: string, mode: GLTFExtensionMode): GLTFExtensionParser | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* @internal
|
|
53
|
+
*/
|
|
54
|
+
static _addExtensionParser(extensionName: string, extensionParser: GLTFExtensionParser): void;
|
|
55
|
+
private static _createAndParse;
|
|
56
|
+
private static _additiveParse;
|
|
57
|
+
abstract parse(context: GLTFParserContext): AssetPromise<any> | void | Material | AnimationClip | Mesh;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Declare ExtensionParser's decorator.
|
|
61
|
+
* @param extensionName - Extension name
|
|
62
|
+
*/
|
|
63
|
+
export declare function registerGLTFExtension(extensionName: string, mode: GLTFExtensionMode): (parser: new () => GLTFExtensionParser) => void;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { AnimationClip, AssetPromise, Buffer, Entity, Material, ModelMesh, Texture2D, TypedArray } from "@galacean/engine-core";
|
|
2
|
+
import { BufferDataRestoreInfo, GLTFContentRestorer } from "../../GLTFContentRestorer";
|
|
2
3
|
import { GLTFResource } from "../GLTFResource";
|
|
3
|
-
import { IGLTF } from "../
|
|
4
|
+
import { IGLTF } from "../GLTFSchema";
|
|
4
5
|
/**
|
|
5
6
|
* @internal
|
|
6
7
|
*/
|
|
7
|
-
export declare class
|
|
8
|
-
|
|
8
|
+
export declare class GLTFParserContext {
|
|
9
|
+
glTF: IGLTF;
|
|
9
10
|
buffers: ArrayBuffer[];
|
|
10
11
|
glTFResource: GLTFResource;
|
|
11
12
|
keepMeshData: boolean;
|
|
12
13
|
hasSkinned: boolean;
|
|
13
|
-
/** chain asset promise */
|
|
14
14
|
chainPromises: AssetPromise<any>[];
|
|
15
15
|
accessorBufferCache: Record<string, BufferInfo>;
|
|
16
16
|
texturesPromiseInfo: PromiseInfo<Texture2D[]>;
|
|
@@ -20,6 +20,7 @@ export declare class ParserContext {
|
|
|
20
20
|
defaultSceneRootPromiseInfo: PromiseInfo<Entity>;
|
|
21
21
|
masterPromiseInfo: PromiseInfo<GLTFResource>;
|
|
22
22
|
promiseMap: Record<string, AssetPromise<any>>;
|
|
23
|
+
contentRestorer: GLTFContentRestorer;
|
|
23
24
|
constructor(url: string);
|
|
24
25
|
private _initPromiseInfo;
|
|
25
26
|
}
|
|
@@ -32,6 +33,7 @@ export declare class BufferInfo {
|
|
|
32
33
|
stride: number;
|
|
33
34
|
vertexBuffer: Buffer;
|
|
34
35
|
vertexBindingInfos: Record<number, number>;
|
|
36
|
+
restoreInfo: BufferDataRestoreInfo;
|
|
35
37
|
constructor(data: TypedArray, interleaved: boolean, stride: number);
|
|
36
38
|
}
|
|
37
39
|
/**
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Entity } from "@galacean/engine-core";
|
|
2
|
+
import { GLTFParser } from "./GLTFParser";
|
|
3
|
+
import { GLTFParserContext } from "./GLTFParserContext";
|
|
4
|
+
export declare class GLTFSceneParser extends GLTFParser {
|
|
5
|
+
private static _defaultMaterial;
|
|
6
|
+
private static _getDefaultMaterial;
|
|
7
|
+
parse(context: GLTFParserContext): import("@galacean/engine-core").AssetPromise<Entity>;
|
|
8
|
+
private _createCamera;
|
|
9
|
+
private _createRenderer;
|
|
10
|
+
private _createAnimator;
|
|
11
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AssetPromise, Texture2D } from "@galacean/engine-core";
|
|
2
|
+
import { GLTFParser } from "./GLTFParser";
|
|
3
|
+
import { GLTFParserContext } from ".";
|
|
4
|
+
export declare class GLTFTextureParser extends GLTFParser {
|
|
5
|
+
private static _wrapMap;
|
|
6
|
+
parse(context: GLTFParserContext): AssetPromise<Texture2D[]>;
|
|
7
|
+
private _parseSampler;
|
|
8
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AssetPromise } from "@galacean/engine-core";
|
|
2
|
+
import { GLTFParser } from "./GLTFParser";
|
|
3
|
+
import { GLTFParserContext } from "./GLTFParserContext";
|
|
4
|
+
export declare class GLTFValidator extends GLTFParser {
|
|
5
|
+
parse(context: GLTFParserContext): AssetPromise<void>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { GLTFAnimationParser } from "./GLTFAnimationParser";
|
|
2
|
+
export { GLTFBufferParser } from "./GLTFBufferParser";
|
|
3
|
+
export { GLTFEntityParser } from "./GLTFEntityParser";
|
|
4
|
+
export { GLTFMaterialParser } from "./GLTFMaterialParser";
|
|
5
|
+
export { GLTFMeshParser } from "./GLTFMeshParser";
|
|
6
|
+
export { GLTFParser, registerGLTFExtension } from "./GLTFParser";
|
|
7
|
+
export { GLTFSceneParser } from "./GLTFSceneParser";
|
|
8
|
+
export { GLTFSkinParser } from "./GLTFSkinParser";
|
|
9
|
+
export { GLTFTextureParser } from "./GLTFTextureParser";
|
|
10
|
+
export { GLTFValidator } from "./GLTFValidator";
|
|
11
|
+
export { GLTFParserContext } from "./GLTFParserContext";
|
package/types/index.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import "./AnimatorControllerLoader";
|
|
|
2
2
|
import "./BufferLoader";
|
|
3
3
|
import "./EnvLoader";
|
|
4
4
|
import "./FontLoader";
|
|
5
|
-
import "./gltf/extensions/index";
|
|
6
5
|
import "./GLTFLoader";
|
|
7
6
|
import "./HDRLoader";
|
|
8
7
|
import "./JSONLoader";
|
|
@@ -15,9 +14,10 @@ import "./SpriteAtlasLoader";
|
|
|
15
14
|
import "./SpriteLoader";
|
|
16
15
|
import "./Texture2DLoader";
|
|
17
16
|
import "./TextureCubeLoader";
|
|
17
|
+
import "./AnimationClipLoader";
|
|
18
18
|
export { parseSingleKTX } from "./compressed-texture";
|
|
19
|
-
export { GLTFResource } from "./gltf/GLTFResource";
|
|
20
19
|
export type { GLTFParams } from "./GLTFLoader";
|
|
21
20
|
export * from "./resource-deserialize";
|
|
22
21
|
export * from "./SceneLoader";
|
|
23
22
|
export type { Texture2DParams } from "./Texture2DLoader";
|
|
23
|
+
export * from "./gltf";
|