@galacean/engine-loader 1.1.0-alpha.0 → 1.1.0-alpha.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.
- package/dist/main.js +4843 -3713
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +4842 -3712
- package/dist/module.js +4847 -3708
- package/dist/module.js.map +1 -1
- package/package.json +5 -5
- package/types/GLTFContentRestorer.d.ts +17 -7
- package/types/GLTFLoader.d.ts +2 -5
- package/types/gltf/GLTFResource.d.ts +2 -6
- package/types/gltf/GLTFSchema.d.ts +7 -1
- package/types/gltf/GLTFUtil.d.ts +3 -3
- package/types/gltf/GLTFUtils.d.ts +6 -4
- package/types/gltf/extensions/GLTFExtensionParser.d.ts +0 -6
- package/types/gltf/extensions/KHR_texture_basisu.d.ts +1 -0
- package/types/gltf/extensions/index.d.ts +1 -1
- package/types/gltf/index.d.ts +0 -1
- package/types/gltf/parser/GLTFAnimationParser.d.ts +3 -3
- package/types/gltf/parser/GLTFBufferParser.d.ts +2 -3
- package/types/gltf/parser/GLTFEntityParser.d.ts +2 -5
- package/types/gltf/parser/GLTFMaterialParser.d.ts +5 -2
- package/types/gltf/parser/GLTFMeshParser.d.ts +6 -6
- package/types/gltf/parser/GLTFParser.d.ts +3 -9
- package/types/gltf/parser/GLTFParserContext.d.ts +29 -23
- package/types/gltf/parser/GLTFSceneParser.d.ts +4 -3
- package/types/gltf/parser/GLTFSchemaParser.d.ts +7 -0
- package/types/gltf/parser/GLTFSkinParser.d.ts +3 -2
- package/types/gltf/parser/GLTFTextureParser.d.ts +9 -5
- package/types/gltf/parser/GLTFValidator.d.ts +1 -2
- package/types/gltf/parser/index.d.ts +2 -1
- package/types/index.d.ts +6 -3
- package/types/ktx2/BinomialLLCTranscoder/BinomialLLCTranscoder.d.ts +13 -0
- package/types/ktx2/BinomialLLCTranscoder/TranscodeWorkerCode.d.ts +33 -0
- package/types/ktx2/KTX2Container.d.ts +72 -0
- package/types/ktx2/KTX2Loader.d.ts +53 -0
- package/types/ktx2/KTX2TargetFormat.d.ts +21 -0
- package/types/ktx2/KhronosTranscoder/KhronosTranscoder.d.ts +17 -0
- package/types/ktx2/KhronosTranscoder/TranscoderWorkerCode.d.ts +34 -0
- package/types/ktx2/TranscodeResult.d.ts +10 -0
- package/types/ktx2/WorkerPool.d.ts +32 -0
- package/types/ktx2/constants.d.ts +7 -0
- package/types/ktx2/transcoder/AbstractTranscoder.d.ts +55 -0
- package/types/ktx2/transcoder/BinomialLLCTranscoder.d.ts +8 -0
- package/types/ktx2/transcoder/BinomialLLCWorkerCode.d.ts +2 -0
- package/types/ktx2/transcoder/KhronosTranscoder.d.ts +13 -0
- package/types/ktx2/transcoder/KhronosWorkerCode.d.ts +1 -0
- package/types/ktx2/zstddec.d.ts +62 -0
- package/types/resource-deserialize/resources/prefab/PrefabDesign.d.ts +4 -4
- package/types/resource-deserialize/utils/BufferReader.d.ts +6 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@galacean/engine-loader",
|
|
3
|
-
"version": "1.1.0-alpha.
|
|
3
|
+
"version": "1.1.0-alpha.2",
|
|
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-
|
|
19
|
-
"@galacean/engine-
|
|
20
|
-
"@galacean/engine-
|
|
21
|
-
"@galacean/engine-
|
|
18
|
+
"@galacean/engine-rhi-webgl": "1.1.0-alpha.2",
|
|
19
|
+
"@galacean/engine-math": "1.1.0-alpha.2",
|
|
20
|
+
"@galacean/engine-core": "1.1.0-alpha.2",
|
|
21
|
+
"@galacean/engine-draco": "1.1.0-alpha.2"
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
24
24
|
"b:types": "tsc"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AssetPromise, BlendShape, Buffer, ContentRestorer, ModelMesh, Texture2D } from "@galacean/engine-core";
|
|
1
|
+
import { AssetPromise, BlendShape, Buffer, ContentRestorer, ModelMesh, Texture2D, TypedArray } from "@galacean/engine-core";
|
|
2
2
|
import { RequestConfig } from "@galacean/engine-core/types/asset/request";
|
|
3
3
|
import { Vector2 } from "@galacean/engine-math";
|
|
4
4
|
import { GLTFResource } from "./gltf/GLTFResource";
|
|
@@ -65,18 +65,28 @@ export declare class BufferDataRestoreInfo {
|
|
|
65
65
|
*/
|
|
66
66
|
export declare class RestoreDataAccessor {
|
|
67
67
|
bufferIndex: number;
|
|
68
|
-
TypedArray: new (buffer: ArrayBuffer, byteOffset: number, length?: number) =>
|
|
68
|
+
TypedArray: new (buffer: ArrayBuffer, byteOffset: number, length?: number) => TypedArray;
|
|
69
69
|
byteOffset: number;
|
|
70
70
|
length: number;
|
|
71
|
-
constructor(bufferIndex: number, TypedArray: new (buffer: ArrayBuffer, byteOffset: number, length?: number) =>
|
|
71
|
+
constructor(bufferIndex: number, TypedArray: new (buffer: ArrayBuffer, byteOffset: number, length?: number) => TypedArray, byteOffset: number, length: number);
|
|
72
72
|
}
|
|
73
73
|
/**
|
|
74
74
|
* @internal
|
|
75
75
|
*/
|
|
76
76
|
export declare class BlendShapeRestoreInfo {
|
|
77
77
|
blendShape: BlendShape;
|
|
78
|
-
position:
|
|
79
|
-
normal?:
|
|
80
|
-
tangent?:
|
|
81
|
-
constructor(blendShape: BlendShape, position:
|
|
78
|
+
position: BlendShapeDataRestoreInfo;
|
|
79
|
+
normal?: BlendShapeDataRestoreInfo;
|
|
80
|
+
tangent?: BlendShapeDataRestoreInfo;
|
|
81
|
+
constructor(blendShape: BlendShape, position: BlendShapeDataRestoreInfo, normal?: BlendShapeDataRestoreInfo, tangent?: BlendShapeDataRestoreInfo);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* @internal
|
|
85
|
+
*/
|
|
86
|
+
export declare class BlendShapeDataRestoreInfo {
|
|
87
|
+
buffer: BufferDataRestoreInfo;
|
|
88
|
+
stride: number;
|
|
89
|
+
byteOffset: number;
|
|
90
|
+
count: number;
|
|
91
|
+
constructor(buffer: BufferDataRestoreInfo, stride: number, byteOffset: number, count: number);
|
|
82
92
|
}
|
package/types/GLTFLoader.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { AssetPromise, Loader, LoadItem, ResourceManager } from "@galacean/engine-core";
|
|
2
|
-
import { GLTFPipeline } from "./gltf/GLTFPipeline";
|
|
3
2
|
import { GLTFResource } from "./gltf/GLTFResource";
|
|
4
3
|
export declare class GLTFLoader extends Loader<GLTFResource> {
|
|
5
|
-
load(item: LoadItem, resourceManager: ResourceManager):
|
|
4
|
+
load(item: LoadItem, resourceManager: ResourceManager): AssetPromise<GLTFResource>;
|
|
6
5
|
}
|
|
7
6
|
/**
|
|
8
7
|
* GlTF loader params.
|
|
@@ -12,7 +11,5 @@ export interface GLTFParams {
|
|
|
12
11
|
* @beta Now only contains vertex information, need to improve.
|
|
13
12
|
* Keep raw mesh data for glTF parser, default is false.
|
|
14
13
|
*/
|
|
15
|
-
keepMeshData
|
|
16
|
-
/** Custom glTF pipeline. */
|
|
17
|
-
pipeline: GLTFPipeline;
|
|
14
|
+
keepMeshData?: boolean;
|
|
18
15
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { AnimationClip, Camera, Engine,
|
|
1
|
+
import { AnimationClip, Camera, Engine, Entity, Light, Material, ModelMesh, ReferResource, Skin, Texture2D } from "@galacean/engine-core";
|
|
2
2
|
/**
|
|
3
3
|
* Product after glTF parser, usually, `defaultSceneRoot` is only needed to use.
|
|
4
4
|
*/
|
|
5
|
-
export declare class GLTFResource extends
|
|
5
|
+
export declare class GLTFResource extends ReferResource {
|
|
6
6
|
/** glTF file url. */
|
|
7
7
|
url: string;
|
|
8
8
|
/** Texture2D after TextureParser. */
|
|
@@ -28,8 +28,4 @@ export declare class GLTFResource extends EngineObject {
|
|
|
28
28
|
/** Extensions data. */
|
|
29
29
|
extensionsData: Record<string, any>;
|
|
30
30
|
constructor(engine: Engine, url: string);
|
|
31
|
-
/**
|
|
32
|
-
* @internal
|
|
33
|
-
*/
|
|
34
|
-
protected _onDestroy(): void;
|
|
35
31
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Module for glTF 2.0 Interface
|
|
3
3
|
*/
|
|
4
|
-
import { MeshTopology } from "@galacean/engine-core";
|
|
4
|
+
import type { MeshTopology, TextureFilterMode, TextureWrapMode as EngineTextureWrapMode } from "@galacean/engine-core";
|
|
5
5
|
/**
|
|
6
6
|
* The datatype of the components in the attribute
|
|
7
7
|
*/
|
|
@@ -814,3 +814,9 @@ export interface IGLTF extends IProperty {
|
|
|
814
814
|
}
|
|
815
815
|
/** glTF extensible owner schema. */
|
|
816
816
|
export type GLTFExtensionOwnerSchema = IMeshPrimitive | IMaterial | ITextureInfo | INode;
|
|
817
|
+
export interface ISamplerInfo {
|
|
818
|
+
filterMode?: TextureFilterMode;
|
|
819
|
+
wrapModeU?: EngineTextureWrapMode;
|
|
820
|
+
wrapModeV?: EngineTextureWrapMode;
|
|
821
|
+
mipmap?: boolean;
|
|
822
|
+
}
|
package/types/gltf/GLTFUtil.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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
|
*/
|
|
@@ -23,7 +23,7 @@ export declare class GLTFUtil {
|
|
|
23
23
|
*/
|
|
24
24
|
static getComponentType(componentType: AccessorComponentType): Int8ArrayConstructor | Uint8ArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Uint32ArrayConstructor | Float32ArrayConstructor;
|
|
25
25
|
static getNormalizedComponentScale(componentType: AccessorComponentType): number;
|
|
26
|
-
static getAccessorBuffer(context:
|
|
26
|
+
static getAccessorBuffer(context: GLTFParserContext, gltf: IGLTF, accessor: IAccessor): BufferInfo;
|
|
27
27
|
/**
|
|
28
28
|
* @deprecated
|
|
29
29
|
* Get accessor data.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { IndexFormat, TypedArray, VertexElementFormat } from "@galacean/engine-core";
|
|
1
|
+
import { IndexFormat, Texture2D, TypedArray, VertexElementFormat } from "@galacean/engine-core";
|
|
2
2
|
import { Color, Vector2, Vector3, Vector4 } from "@galacean/engine-math";
|
|
3
|
-
import { AccessorComponentType, AccessorType, IAccessor, IBufferView, IGLTF } from "./GLTFSchema";
|
|
3
|
+
import { AccessorComponentType, AccessorType, IAccessor, IBufferView, IGLTF, ISampler, ISamplerInfo } from "./GLTFSchema";
|
|
4
4
|
import { BufferInfo, GLTFParserContext } from "./parser/GLTFParserContext";
|
|
5
5
|
/**
|
|
6
6
|
* @internal
|
|
@@ -19,7 +19,8 @@ export declare class GLTFUtils {
|
|
|
19
19
|
*/
|
|
20
20
|
static getComponentType(componentType: AccessorComponentType): Float32ArrayConstructor | Uint32ArrayConstructor | Uint8ArrayConstructor | Uint16ArrayConstructor | Int8ArrayConstructor | Int16ArrayConstructor;
|
|
21
21
|
static getNormalizedComponentScale(componentType: AccessorComponentType): number;
|
|
22
|
-
static getAccessorBuffer(context: GLTFParserContext, bufferViews: IBufferView[], accessor: IAccessor): BufferInfo
|
|
22
|
+
static getAccessorBuffer(context: GLTFParserContext, bufferViews: IBufferView[], accessor: IAccessor): Promise<BufferInfo>;
|
|
23
|
+
static bufferToVector3Array(data: TypedArray, byteStride: number, accessorByteOffset: number, count: number): Vector3[];
|
|
23
24
|
/**
|
|
24
25
|
* @deprecated
|
|
25
26
|
* Get accessor data.
|
|
@@ -43,5 +44,6 @@ export declare class GLTFUtils {
|
|
|
43
44
|
glTF: IGLTF;
|
|
44
45
|
buffers: ArrayBuffer[];
|
|
45
46
|
};
|
|
46
|
-
|
|
47
|
+
static parseSampler(texture: Texture2D, samplerInfo: ISamplerInfo): void;
|
|
48
|
+
static getSamplerInfo(sampler: ISampler): ISamplerInfo;
|
|
47
49
|
}
|
|
@@ -11,12 +11,6 @@ export declare abstract class GLTFExtensionParser {
|
|
|
11
11
|
* The extension mode.
|
|
12
12
|
*/
|
|
13
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
14
|
/**
|
|
21
15
|
* Create and parse the resource.
|
|
22
16
|
* @remarks This method overrides the default resource creation.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -6,7 +6,7 @@ import "./KHR_materials_pbrSpecularGlossiness";
|
|
|
6
6
|
import "./KHR_materials_sheen";
|
|
7
7
|
import "./KHR_materials_transmission";
|
|
8
8
|
import "./KHR_materials_unlit";
|
|
9
|
-
|
|
9
|
+
import "./KHR_materials_variants";
|
|
10
10
|
import "./KHR_materials_volume";
|
|
11
11
|
import "./KHR_mesh_quantization";
|
|
12
12
|
import "./KHR_texture_basisu";
|
package/types/gltf/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnimationClip
|
|
1
|
+
import { AnimationClip } from "@galacean/engine-core";
|
|
2
2
|
import { IAnimation } from "../GLTFSchema";
|
|
3
3
|
import { GLTFParser } from "./GLTFParser";
|
|
4
4
|
import { GLTFParserContext } from "./GLTFParserContext";
|
|
@@ -6,7 +6,7 @@ export declare class GLTFAnimationParser extends GLTFParser {
|
|
|
6
6
|
/**
|
|
7
7
|
* @internal
|
|
8
8
|
*/
|
|
9
|
-
static _parseStandardProperty(context: GLTFParserContext, animationClip: AnimationClip, animationInfo: IAnimation):
|
|
9
|
+
static _parseStandardProperty(context: GLTFParserContext, animationClip: AnimationClip, animationInfo: IAnimation): Promise<AnimationClip>;
|
|
10
10
|
private static _addCurve;
|
|
11
|
-
parse(context: GLTFParserContext):
|
|
11
|
+
parse(context: GLTFParserContext, index: number): Promise<AnimationClip>;
|
|
12
12
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { AssetPromise } from "@galacean/engine-core";
|
|
2
1
|
import { GLTFParser } from "./GLTFParser";
|
|
3
2
|
import { GLTFParserContext } from "./GLTFParserContext";
|
|
4
3
|
export declare class GLTFBufferParser extends GLTFParser {
|
|
5
|
-
parse(context: GLTFParserContext):
|
|
6
|
-
private
|
|
4
|
+
parse(context: GLTFParserContext, index: number): Promise<ArrayBuffer>;
|
|
5
|
+
private _parseSingleBuffer;
|
|
7
6
|
}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
+
import { Entity } from "@galacean/engine-core";
|
|
1
2
|
import { GLTFParser } from "./GLTFParser";
|
|
2
3
|
import { GLTFParserContext } from "./GLTFParserContext";
|
|
3
4
|
export declare class GLTFEntityParser extends GLTFParser {
|
|
4
|
-
|
|
5
|
-
static _defaultName: String;
|
|
6
|
-
parse(context: GLTFParserContext): void;
|
|
7
|
-
private _buildEntityTree;
|
|
8
|
-
private _createSceneRoots;
|
|
5
|
+
parse(context: GLTFParserContext, index: number): Entity;
|
|
9
6
|
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BlinnPhongMaterial, Engine, Material, PBRMaterial, PBRSpecularMaterial, UnlitMaterial } from "@galacean/engine-core";
|
|
2
2
|
import { IMaterial, ITextureInfo } from "../GLTFSchema";
|
|
3
3
|
import { GLTFParser } from "./GLTFParser";
|
|
4
4
|
import { GLTFParserContext } from "./GLTFParserContext";
|
|
5
5
|
export declare class GLTFMaterialParser extends GLTFParser {
|
|
6
|
+
/** @internal */
|
|
7
|
+
static _getDefaultMaterial(engine: Engine): BlinnPhongMaterial;
|
|
8
|
+
private static _defaultMaterial;
|
|
6
9
|
/**
|
|
7
10
|
* @internal
|
|
8
11
|
*/
|
|
@@ -11,5 +14,5 @@ export declare class GLTFMaterialParser extends GLTFParser {
|
|
|
11
14
|
* @internal
|
|
12
15
|
*/
|
|
13
16
|
static _parseStandardProperty(context: GLTFParserContext, material: UnlitMaterial | PBRMaterial | PBRSpecularMaterial, materialInfo: IMaterial): void;
|
|
14
|
-
parse(context: GLTFParserContext):
|
|
17
|
+
parse(context: GLTFParserContext, index: number): Promise<Material>;
|
|
15
18
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ModelMesh, TypedArray } from "@galacean/engine-core";
|
|
2
2
|
import { ModelMeshRestoreInfo } from "../../GLTFContentRestorer";
|
|
3
|
-
import type { IGLTF, IMesh, IMeshPrimitive } from "../GLTFSchema";
|
|
3
|
+
import type { IAccessor, IGLTF, IMesh, IMeshPrimitive } from "../GLTFSchema";
|
|
4
4
|
import { GLTFParser } from "./GLTFParser";
|
|
5
5
|
import { BufferInfo, GLTFParserContext } from "./GLTFParserContext";
|
|
6
6
|
export declare class GLTFMeshParser extends GLTFParser {
|
|
@@ -8,12 +8,12 @@ export declare class GLTFMeshParser extends GLTFParser {
|
|
|
8
8
|
/**
|
|
9
9
|
* @internal
|
|
10
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
|
|
11
|
+
static _parseMeshFromGLTFPrimitive(context: GLTFParserContext, mesh: ModelMesh, meshRestoreInfo: ModelMeshRestoreInfo, gltfMesh: IMesh, gltfPrimitive: IMeshPrimitive, gltf: IGLTF, getVertexBufferData: (semantic: string) => TypedArray, getBlendShapeData: (semantic: string, shapeIndex: number) => Promise<BufferInfo>, getIndexBufferData: () => Promise<TypedArray>, keepMeshData: boolean): Promise<ModelMesh>;
|
|
12
12
|
/**
|
|
13
13
|
* @internal
|
|
14
14
|
*/
|
|
15
|
-
static _createBlendShape(mesh: ModelMesh, meshRestoreInfo: ModelMeshRestoreInfo, glTFMesh: IMesh, glTFTargets: {
|
|
15
|
+
static _createBlendShape(mesh: ModelMesh, meshRestoreInfo: ModelMeshRestoreInfo, glTFMesh: IMesh, accessors: IAccessor[], glTFTargets: {
|
|
16
16
|
[name: string]: number;
|
|
17
|
-
}[], getBlendShapeData: (semantic: string, shapeIndex: number) => BufferInfo): void
|
|
18
|
-
parse(context: GLTFParserContext):
|
|
17
|
+
}[], getBlendShapeData: (semantic: string, shapeIndex: number) => Promise<BufferInfo>): Promise<void[]>;
|
|
18
|
+
parse(context: GLTFParserContext, index: number): Promise<ModelMesh[]>;
|
|
19
19
|
}
|
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { GLTFExtensionMode, GLTFExtensionParser } from "../extensions/GLTFExtensionParser";
|
|
1
|
+
import { EngineObject } from "@galacean/engine-core";
|
|
3
2
|
import type { GLTFExtensionOwnerSchema } from "../GLTFSchema";
|
|
3
|
+
import { GLTFExtensionMode, GLTFExtensionParser } from "../extensions/GLTFExtensionParser";
|
|
4
4
|
import { GLTFParserContext } from "./GLTFParserContext";
|
|
5
5
|
/**
|
|
6
6
|
* Base class of glTF parser.
|
|
7
7
|
*/
|
|
8
8
|
export declare abstract class GLTFParser {
|
|
9
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
10
|
/**
|
|
17
11
|
* Execute all parses of extension to create resource.
|
|
18
12
|
* @param extensions - Related extensions field
|
|
@@ -54,7 +48,7 @@ export declare abstract class GLTFParser {
|
|
|
54
48
|
static _addExtensionParser(extensionName: string, extensionParser: GLTFExtensionParser): void;
|
|
55
49
|
private static _createAndParse;
|
|
56
50
|
private static _additiveParse;
|
|
57
|
-
abstract parse(context: GLTFParserContext):
|
|
51
|
+
abstract parse(context: GLTFParserContext, index?: number): any;
|
|
58
52
|
}
|
|
59
53
|
/**
|
|
60
54
|
* Declare ExtensionParser's decorator.
|
|
@@ -1,28 +1,31 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Buffer, Entity, ResourceManager, TypedArray } from "@galacean/engine-core";
|
|
2
2
|
import { BufferDataRestoreInfo, GLTFContentRestorer } from "../../GLTFContentRestorer";
|
|
3
3
|
import { GLTFResource } from "../GLTFResource";
|
|
4
4
|
import type { IGLTF } from "../GLTFSchema";
|
|
5
|
+
import { GLTFParser } from "./GLTFParser";
|
|
5
6
|
/**
|
|
6
7
|
* @internal
|
|
7
8
|
*/
|
|
8
9
|
export declare class GLTFParserContext {
|
|
9
|
-
glTF: IGLTF;
|
|
10
|
-
buffers: ArrayBuffer[];
|
|
11
10
|
glTFResource: GLTFResource;
|
|
11
|
+
resourceManager: ResourceManager;
|
|
12
12
|
keepMeshData: boolean;
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
private static readonly _parsers;
|
|
14
|
+
static addParser(parserType: GLTFParserType, parser: GLTFParser): void;
|
|
15
|
+
glTF: IGLTF;
|
|
15
16
|
accessorBufferCache: Record<string, BufferInfo>;
|
|
16
|
-
texturesPromiseInfo: PromiseInfo<Texture2D[]>;
|
|
17
|
-
materialsPromiseInfo: PromiseInfo<Material[]>;
|
|
18
|
-
meshesPromiseInfo: PromiseInfo<ModelMesh[][]>;
|
|
19
|
-
animationClipsPromiseInfo: PromiseInfo<AnimationClip[]>;
|
|
20
|
-
defaultSceneRootPromiseInfo: PromiseInfo<Entity>;
|
|
21
|
-
masterPromiseInfo: PromiseInfo<GLTFResource>;
|
|
22
|
-
promiseMap: Record<string, AssetPromise<any>>;
|
|
23
17
|
contentRestorer: GLTFContentRestorer;
|
|
24
|
-
|
|
25
|
-
private
|
|
18
|
+
buffers?: ArrayBuffer[];
|
|
19
|
+
private _resourceCache;
|
|
20
|
+
constructor(glTFResource: GLTFResource, resourceManager: ResourceManager, keepMeshData: boolean);
|
|
21
|
+
get<T>(type: GLTFParserType.Entity, index: number): Entity;
|
|
22
|
+
get<T>(type: GLTFParserType.Entity): Entity[];
|
|
23
|
+
get<T>(type: GLTFParserType.Schema): Promise<T>;
|
|
24
|
+
get<T>(type: GLTFParserType.Validator): Promise<T>;
|
|
25
|
+
get<T>(type: GLTFParserType, index: number): Promise<T>;
|
|
26
|
+
get<T>(type: GLTFParserType): Promise<T[]>;
|
|
27
|
+
parse(): Promise<GLTFResource>;
|
|
28
|
+
private _handleSubAsset;
|
|
26
29
|
}
|
|
27
30
|
/**
|
|
28
31
|
* @internal
|
|
@@ -36,13 +39,16 @@ export declare class BufferInfo {
|
|
|
36
39
|
restoreInfo: BufferDataRestoreInfo;
|
|
37
40
|
constructor(data: TypedArray, interleaved: boolean, stride: number);
|
|
38
41
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
42
|
+
export declare enum GLTFParserType {
|
|
43
|
+
Schema = 0,
|
|
44
|
+
Validator = 1,
|
|
45
|
+
Scene = 2,
|
|
46
|
+
Buffer = 3,
|
|
47
|
+
Texture = 4,
|
|
48
|
+
Material = 5,
|
|
49
|
+
Mesh = 6,
|
|
50
|
+
Entity = 7,
|
|
51
|
+
Skin = 8,
|
|
52
|
+
Animation = 9
|
|
48
53
|
}
|
|
54
|
+
export declare function registerGLTFParser(pipeline: GLTFParserType): (Parser: new () => GLTFParser) => void;
|
|
@@ -2,10 +2,11 @@ import { 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
|
-
|
|
6
|
-
private
|
|
7
|
-
parse(context: GLTFParserContext): import("@galacean/engine-core").AssetPromise<Entity>;
|
|
5
|
+
parse(context: GLTFParserContext, index: number): Promise<Entity>;
|
|
6
|
+
private _parseEntityComponent;
|
|
8
7
|
private _createCamera;
|
|
9
8
|
private _createRenderer;
|
|
10
9
|
private _createAnimator;
|
|
10
|
+
private _computeLocalBounds;
|
|
11
|
+
private _computeApproximateBindMatrix;
|
|
11
12
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IGLTF } from "../GLTFSchema";
|
|
2
|
+
import { GLTFParser } from "./GLTFParser";
|
|
3
|
+
import { GLTFParserContext } from "./GLTFParserContext";
|
|
4
|
+
export declare class GLTFSchemaParser extends GLTFParser {
|
|
5
|
+
parse(context: GLTFParserContext): Promise<IGLTF>;
|
|
6
|
+
private _isGLB;
|
|
7
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Skin } from "@galacean/engine-core";
|
|
2
2
|
import { GLTFParser } from "./GLTFParser";
|
|
3
|
+
import { GLTFParserContext } from "./GLTFParserContext";
|
|
3
4
|
export declare class GLTFSkinParser extends GLTFParser {
|
|
4
|
-
parse(context: GLTFParserContext):
|
|
5
|
+
parse(context: GLTFParserContext, index: number): Promise<Skin>;
|
|
5
6
|
private _findSkeletonRootBone;
|
|
6
7
|
}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Texture, TextureWrapMode } from "@galacean/engine-core";
|
|
2
2
|
import { GLTFParser } from "./GLTFParser";
|
|
3
|
-
import { GLTFParserContext } from "
|
|
3
|
+
import { GLTFParserContext } from "./GLTFParserContext";
|
|
4
4
|
export declare class GLTFTextureParser extends GLTFParser {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
/** @internal */
|
|
6
|
+
static _wrapMap: {
|
|
7
|
+
33071: TextureWrapMode;
|
|
8
|
+
33648: TextureWrapMode;
|
|
9
|
+
10497: TextureWrapMode;
|
|
10
|
+
};
|
|
11
|
+
parse(context: GLTFParserContext, index: number): Promise<Texture>;
|
|
8
12
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { AssetPromise } from "@galacean/engine-core";
|
|
2
1
|
import { GLTFParser } from "./GLTFParser";
|
|
3
2
|
import { GLTFParserContext } from "./GLTFParserContext";
|
|
4
3
|
export declare class GLTFValidator extends GLTFParser {
|
|
5
|
-
parse(context: GLTFParserContext):
|
|
4
|
+
parse(context: GLTFParserContext): Promise<void>;
|
|
6
5
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { GLTFSchemaParser } from "./GLTFSchemaParser";
|
|
1
2
|
export { GLTFAnimationParser } from "./GLTFAnimationParser";
|
|
2
3
|
export { GLTFBufferParser } from "./GLTFBufferParser";
|
|
3
4
|
export { GLTFEntityParser } from "./GLTFEntityParser";
|
|
@@ -8,4 +9,4 @@ export { GLTFSceneParser } from "./GLTFSceneParser";
|
|
|
8
9
|
export { GLTFSkinParser } from "./GLTFSkinParser";
|
|
9
10
|
export { GLTFTextureParser } from "./GLTFTextureParser";
|
|
10
11
|
export { GLTFValidator } from "./GLTFValidator";
|
|
11
|
-
export { GLTFParserContext } from "./GLTFParserContext";
|
|
12
|
+
export { GLTFParserContext, GLTFParserType, registerGLTFParser } from "./GLTFParserContext";
|
package/types/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "./AnimationClipLoader";
|
|
1
2
|
import "./AnimatorControllerLoader";
|
|
2
3
|
import "./BufferLoader";
|
|
3
4
|
import "./EnvLoader";
|
|
@@ -14,10 +15,12 @@ import "./SpriteAtlasLoader";
|
|
|
14
15
|
import "./SpriteLoader";
|
|
15
16
|
import "./Texture2DLoader";
|
|
16
17
|
import "./TextureCubeLoader";
|
|
17
|
-
import "./
|
|
18
|
-
export { parseSingleKTX } from "./compressed-texture";
|
|
18
|
+
import "./ktx2/KTX2Loader";
|
|
19
19
|
export type { GLTFParams } from "./GLTFLoader";
|
|
20
|
-
export * from "./resource-deserialize";
|
|
21
20
|
export * from "./SceneLoader";
|
|
22
21
|
export type { Texture2DParams } from "./Texture2DLoader";
|
|
22
|
+
export { parseSingleKTX } from "./compressed-texture";
|
|
23
23
|
export * from "./gltf";
|
|
24
|
+
export { KTX2Loader } from "./ktx2/KTX2Loader";
|
|
25
|
+
export { KTX2TargetFormat } from "./ktx2/KTX2TargetFormat";
|
|
26
|
+
export * from "./resource-deserialize";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { KTX2TargetFormat } from "../KTX2TargetFormat";
|
|
2
|
+
import { TranscodeResult } from "../TranscodeResult";
|
|
3
|
+
/** @internal */
|
|
4
|
+
export declare class BinomialLLCTranscoder {
|
|
5
|
+
readonly workerLimit: number;
|
|
6
|
+
static MessageId: number;
|
|
7
|
+
private _transcodeWorkerPool;
|
|
8
|
+
private _initPromise;
|
|
9
|
+
constructor(workerLimit: number);
|
|
10
|
+
init(): Promise<any>;
|
|
11
|
+
transcode(buffer: ArrayBuffer, format: KTX2TargetFormat): Promise<TranscodeResult>;
|
|
12
|
+
destroy(): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
type MessageType = "init" | "transcode";
|
|
2
|
+
export interface IBaseMessage {
|
|
3
|
+
type: MessageType;
|
|
4
|
+
}
|
|
5
|
+
export interface IInitMessage extends IBaseMessage {
|
|
6
|
+
type: "init";
|
|
7
|
+
transcoderWasm: ArrayBuffer;
|
|
8
|
+
}
|
|
9
|
+
export interface ITranscodeMessage extends IBaseMessage {
|
|
10
|
+
type: "transcode";
|
|
11
|
+
format: number;
|
|
12
|
+
buffer: ArrayBuffer;
|
|
13
|
+
}
|
|
14
|
+
export type IMessage = IInitMessage | ITranscodeMessage;
|
|
15
|
+
export type TranscodeResult = {
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
hasAlpha: boolean;
|
|
19
|
+
format: number;
|
|
20
|
+
faces: Array<{
|
|
21
|
+
data: Uint8Array;
|
|
22
|
+
width: number;
|
|
23
|
+
height: number;
|
|
24
|
+
}>[];
|
|
25
|
+
faceCount: number;
|
|
26
|
+
};
|
|
27
|
+
export type TranscodeResponse = {
|
|
28
|
+
id: number;
|
|
29
|
+
type: "transcoded";
|
|
30
|
+
} & TranscodeResult;
|
|
31
|
+
/** @internal */
|
|
32
|
+
export declare function TranscodeWorkerCode(): void;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
export declare enum SupercompressionScheme {
|
|
2
|
+
None = 0,
|
|
3
|
+
BasisLZ = 1,
|
|
4
|
+
Zstd = 2,
|
|
5
|
+
ZLib = 3
|
|
6
|
+
}
|
|
7
|
+
/** @internal */
|
|
8
|
+
export declare class KTX2Container {
|
|
9
|
+
vkFormat: number;
|
|
10
|
+
typeSize: number;
|
|
11
|
+
pixelWidth: number;
|
|
12
|
+
pixelHeight: number;
|
|
13
|
+
pixelDepth: number;
|
|
14
|
+
layerCount: number;
|
|
15
|
+
faceCount: number;
|
|
16
|
+
supercompressionScheme: SupercompressionScheme;
|
|
17
|
+
levels: KTX2Level[];
|
|
18
|
+
dataFormatDescriptor: KTX2DataFormatDescriptorBasicFormat;
|
|
19
|
+
keyValue: {
|
|
20
|
+
[key: string]: string | Uint8Array;
|
|
21
|
+
};
|
|
22
|
+
globalData: KTX2GlobalDataBasisLZ | null;
|
|
23
|
+
constructor(buffer: Uint8Array);
|
|
24
|
+
get isSRGB(): boolean;
|
|
25
|
+
get isUASTC(): boolean;
|
|
26
|
+
private parse;
|
|
27
|
+
}
|
|
28
|
+
interface KTX2Level {
|
|
29
|
+
levelData: Uint8Array;
|
|
30
|
+
uncompressedByteLength: number;
|
|
31
|
+
}
|
|
32
|
+
interface KTX2DataFormatDescriptorBasicFormat {
|
|
33
|
+
vendorId: number;
|
|
34
|
+
descriptorType: number;
|
|
35
|
+
versionNumber: number;
|
|
36
|
+
/** @deprecated Inferred. */
|
|
37
|
+
descriptorBlockSize: number;
|
|
38
|
+
colorModel: number;
|
|
39
|
+
colorPrimaries: number;
|
|
40
|
+
transferFunction: number;
|
|
41
|
+
flags: number;
|
|
42
|
+
texelBlockDimension: [number, number, number, number];
|
|
43
|
+
bytesPlane: [number, number, number, number, number, number, number, number];
|
|
44
|
+
samples: KTX2BasicFormatSample[];
|
|
45
|
+
}
|
|
46
|
+
interface KTX2BasicFormatSample {
|
|
47
|
+
bitOffset: number;
|
|
48
|
+
bitLength: number;
|
|
49
|
+
/** @deprecated Renamed to 'channelType'. */
|
|
50
|
+
channelID?: number;
|
|
51
|
+
channelType: number;
|
|
52
|
+
samplePosition: number[];
|
|
53
|
+
sampleLower: number;
|
|
54
|
+
sampleUpper: number;
|
|
55
|
+
}
|
|
56
|
+
interface KTX2GlobalDataBasisLZ {
|
|
57
|
+
endpointCount: number;
|
|
58
|
+
selectorCount: number;
|
|
59
|
+
imageDescs: KTX2GlobalDataBasisLZImageDesc[];
|
|
60
|
+
endpointsData: Uint8Array;
|
|
61
|
+
selectorsData: Uint8Array;
|
|
62
|
+
tablesData: Uint8Array;
|
|
63
|
+
extendedData: Uint8Array;
|
|
64
|
+
}
|
|
65
|
+
interface KTX2GlobalDataBasisLZImageDesc {
|
|
66
|
+
imageFlags: number;
|
|
67
|
+
rgbSliceByteOffset: number;
|
|
68
|
+
rgbSliceByteLength: number;
|
|
69
|
+
alphaSliceByteOffset: number;
|
|
70
|
+
alphaSliceByteLength: number;
|
|
71
|
+
}
|
|
72
|
+
export {};
|