@galacean/engine-loader 1.1.2 → 1.1.3
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 +193 -212
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +193 -212
- package/dist/module.js +193 -213
- package/dist/module.js.map +1 -1
- package/package.json +5 -5
- package/types/GLTFContentRestorer.d.ts +7 -6
- package/types/gltf/GLTFUtils.d.ts +2 -7
- package/types/gltf/parser/GLTFMeshParser.d.ts +11 -6
- package/types/gltf/parser/GLTFParser.d.ts +1 -1
- package/types/gltf/parser/GLTFParserContext.d.ts +7 -6
- package/types/gltf/parser/index.d.ts +2 -1
- package/types/PrimitiveMeshLoader.d.ts +0 -1
- package/types/gltf/GLTFParser.d.ts +0 -9
- package/types/gltf/GLTFPipeline.d.ts +0 -23
- package/types/gltf/GLTFUtil.d.ts +0 -53
- package/types/gltf/Schema.d.ts +0 -814
- package/types/gltf/extensions/EXT_meshopt_compression.d.ts +0 -13
- package/types/gltf/extensions/ExtensionParser.d.ts +0 -8
- package/types/gltf/extensions/KHR_materials_anisotropy.d.ts +0 -1
- package/types/gltf/extensions/MeshoptDecoder.d.ts +0 -8
- package/types/gltf/extensions/Schema.d.ts +0 -142
- 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/ParserContext.d.ts +0 -46
- 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/types/ktx2/BinomialLLCTranscoder/BinomialLLCTranscoder.d.ts +0 -13
- package/types/ktx2/BinomialLLCTranscoder/TranscodeWorkerCode.d.ts +0 -33
- package/types/ktx2/KhronosTranscoder/KhronosTranscoder.d.ts +0 -17
- package/types/ktx2/KhronosTranscoder/TranscoderWorkerCode.d.ts +0 -34
- package/types/ktx2/TranscodeResult.d.ts +0 -10
- package/types/ktx2/constants.d.ts +0 -7
- package/types/ktx2/zstddec.d.ts +0 -62
- package/types/resource-deserialize/resources/parser/HierarchyParser.d.ts +0 -36
- package/types/resource-deserialize/resources/parser/ParserContext.d.ts +0 -29
- package/types/resource-deserialize/resources/prefab/PrefabDesign.d.ts +0 -70
- package/types/resource-deserialize/resources/prefab/PrefabParser.d.ts +0 -14
- package/types/resource-deserialize/resources/prefab/PrefabParserContext.d.ts +0 -5
- package/types/resource-deserialize/resources/prefab/ReflectionParser.d.ts +0 -14
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@galacean/engine-loader",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
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-core": "1.1.3",
|
|
19
|
+
"@galacean/engine-math": "1.1.3",
|
|
20
|
+
"@galacean/engine-rhi-webgl": "1.1.3",
|
|
21
|
+
"@galacean/engine-draco": "1.1.3"
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
24
24
|
"b:types": "tsc"
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { AssetPromise, BlendShape, Buffer, ContentRestorer, ModelMesh, Texture2D
|
|
1
|
+
import { AssetPromise, BlendShape, Buffer, ContentRestorer, ModelMesh, Texture2D } 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";
|
|
5
|
-
import type { IBufferView } from "./gltf/GLTFSchema";
|
|
5
|
+
import type { AccessorComponentType, IBufferView } from "./gltf/GLTFSchema";
|
|
6
6
|
/**
|
|
7
7
|
* @internal
|
|
8
8
|
*/
|
|
@@ -65,10 +65,10 @@ export declare class BufferDataRestoreInfo {
|
|
|
65
65
|
*/
|
|
66
66
|
export declare class RestoreDataAccessor {
|
|
67
67
|
bufferIndex: number;
|
|
68
|
-
TypedArray:
|
|
68
|
+
TypedArray: Uint8ArrayConstructor | Int8ArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Uint32ArrayConstructor | Float32ArrayConstructor;
|
|
69
69
|
byteOffset: number;
|
|
70
70
|
length: number;
|
|
71
|
-
constructor(bufferIndex: number, TypedArray:
|
|
71
|
+
constructor(bufferIndex: number, TypedArray: Uint8ArrayConstructor | Int8ArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Uint32ArrayConstructor | Float32ArrayConstructor, byteOffset: number, length: number);
|
|
72
72
|
}
|
|
73
73
|
/**
|
|
74
74
|
* @internal
|
|
@@ -85,8 +85,9 @@ export declare class BlendShapeRestoreInfo {
|
|
|
85
85
|
*/
|
|
86
86
|
export declare class BlendShapeDataRestoreInfo {
|
|
87
87
|
buffer: BufferDataRestoreInfo;
|
|
88
|
-
stride: number;
|
|
89
88
|
byteOffset: number;
|
|
90
89
|
count: number;
|
|
91
|
-
|
|
90
|
+
normalized: boolean;
|
|
91
|
+
componentType: AccessorComponentType;
|
|
92
|
+
constructor(buffer: BufferDataRestoreInfo, byteOffset: number, count: number, normalized: boolean, componentType: AccessorComponentType);
|
|
92
93
|
}
|
|
@@ -20,17 +20,12 @@ export declare class GLTFUtils {
|
|
|
20
20
|
static getComponentType(componentType: AccessorComponentType): Float32ArrayConstructor | Uint32ArrayConstructor | Uint8ArrayConstructor | Uint16ArrayConstructor | Int8ArrayConstructor | Int16ArrayConstructor;
|
|
21
21
|
static getNormalizedComponentScale(componentType: AccessorComponentType): number;
|
|
22
22
|
static getAccessorBuffer(context: GLTFParserContext, bufferViews: IBufferView[], accessor: IAccessor): Promise<BufferInfo>;
|
|
23
|
-
static bufferToVector3Array(
|
|
24
|
-
/**
|
|
25
|
-
* @deprecated
|
|
26
|
-
* Get accessor data.
|
|
27
|
-
*/
|
|
28
|
-
static getAccessorData(glTF: IGLTF, accessor: IAccessor, buffers: ArrayBuffer[]): TypedArray;
|
|
23
|
+
static bufferToVector3Array(buffer: TypedArray, byteOffset: number, count: number, normalized: boolean, componentType: AccessorComponentType): Vector3[];
|
|
29
24
|
static getBufferViewData(bufferView: IBufferView, buffers: ArrayBuffer[]): ArrayBuffer;
|
|
30
25
|
/**
|
|
31
26
|
* Get accessor data.
|
|
32
27
|
*/
|
|
33
|
-
static processingSparseData(
|
|
28
|
+
static processingSparseData(context: GLTFParserContext, accessor: IAccessor, bufferInfo: BufferInfo): Promise<void>;
|
|
34
29
|
static getIndexFormat(type: AccessorComponentType): IndexFormat;
|
|
35
30
|
static getElementFormat(type: AccessorComponentType, size: number, normalized?: boolean): VertexElementFormat;
|
|
36
31
|
/**
|
|
@@ -1,19 +1,24 @@
|
|
|
1
|
-
import { ModelMesh
|
|
2
|
-
import {
|
|
1
|
+
import { ModelMesh } from "@galacean/engine-core";
|
|
2
|
+
import { Vector3 } from "@galacean/engine-math";
|
|
3
|
+
import { BlendShapeDataRestoreInfo, ModelMeshRestoreInfo } from "../../GLTFContentRestorer";
|
|
3
4
|
import type { IAccessor, IGLTF, IMesh, IMeshPrimitive } from "../GLTFSchema";
|
|
4
5
|
import { GLTFParser } from "./GLTFParser";
|
|
5
|
-
import {
|
|
6
|
+
import { GLTFParserContext } from "./GLTFParserContext";
|
|
6
7
|
export declare class GLTFMeshParser extends GLTFParser {
|
|
7
8
|
private static _tempVector3;
|
|
8
9
|
/**
|
|
9
10
|
* @internal
|
|
10
11
|
*/
|
|
11
|
-
static _parseMeshFromGLTFPrimitive(context: GLTFParserContext, mesh: ModelMesh, meshRestoreInfo: ModelMeshRestoreInfo, gltfMesh: IMesh, gltfPrimitive: IMeshPrimitive, gltf: IGLTF,
|
|
12
|
+
static _parseMeshFromGLTFPrimitive(context: GLTFParserContext, mesh: ModelMesh, meshRestoreInfo: ModelMeshRestoreInfo, gltfMesh: IMesh, gltfPrimitive: IMeshPrimitive, gltf: IGLTF, keepMeshData: boolean): Promise<ModelMesh>;
|
|
13
|
+
private static _getBlendShapeData;
|
|
12
14
|
/**
|
|
13
15
|
* @internal
|
|
14
16
|
*/
|
|
15
|
-
static _createBlendShape(mesh: ModelMesh, meshRestoreInfo: ModelMeshRestoreInfo, glTFMesh: IMesh,
|
|
17
|
+
static _createBlendShape(context: GLTFParserContext, mesh: ModelMesh, meshRestoreInfo: ModelMeshRestoreInfo, glTFMesh: IMesh, gltfPrimitive: IMeshPrimitive, glTFTargets: {
|
|
16
18
|
[name: string]: number;
|
|
17
|
-
}[], getBlendShapeData: (
|
|
19
|
+
}[], getBlendShapeData: (context: GLTFParserContext, glTF: IGLTF, accessor: IAccessor) => Promise<{
|
|
20
|
+
vertices: Vector3[];
|
|
21
|
+
restoreInfo: BlendShapeDataRestoreInfo;
|
|
22
|
+
}>): Promise<void>;
|
|
18
23
|
parse(context: GLTFParserContext, index: number): Promise<ModelMesh[]>;
|
|
19
24
|
}
|
|
@@ -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 | Promise<EngineObject | void>;
|
|
20
|
+
}, context: GLTFParserContext, ownerSchema: GLTFExtensionOwnerSchema, ...extra: any[]): EngineObject | void | Promise<EngineObject | Uint8Array | void>;
|
|
21
21
|
/**
|
|
22
22
|
* Execute all parses of extension to parse resource.
|
|
23
23
|
* @param extensions - Related extensions field
|
|
@@ -46,11 +46,12 @@ export declare enum GLTFParserType {
|
|
|
46
46
|
Validator = 1,
|
|
47
47
|
Scene = 2,
|
|
48
48
|
Buffer = 3,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
49
|
+
BufferView = 4,
|
|
50
|
+
Texture = 5,
|
|
51
|
+
Material = 6,
|
|
52
|
+
Mesh = 7,
|
|
53
|
+
Entity = 8,
|
|
54
|
+
Skin = 9,
|
|
55
|
+
Animation = 10
|
|
55
56
|
}
|
|
56
57
|
export declare function registerGLTFParser(pipeline: GLTFParserType): (Parser: new () => GLTFParser) => void;
|
|
@@ -9,4 +9,5 @@ export { GLTFSceneParser } from "./GLTFSceneParser";
|
|
|
9
9
|
export { GLTFSkinParser } from "./GLTFSkinParser";
|
|
10
10
|
export { GLTFTextureParser } from "./GLTFTextureParser";
|
|
11
11
|
export { GLTFValidator } from "./GLTFValidator";
|
|
12
|
-
export { GLTFParserContext, GLTFParserType, registerGLTFParser } from "./GLTFParserContext";
|
|
12
|
+
export { GLTFParserContext, GLTFParserType, registerGLTFParser, BufferInfo } from "./GLTFParserContext";
|
|
13
|
+
export { GLTFBufferViewParser } from "./GLTFBufferViewParser";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { AssetPromise } from "@galacean/engine-core";
|
|
2
|
-
import { GLTFResource } from "./GLTFResource";
|
|
3
|
-
import { ParserContext } from "./parser/ParserContext";
|
|
4
|
-
export declare class GLTFParser {
|
|
5
|
-
static defaultPipeline: GLTFParser;
|
|
6
|
-
private _pipes;
|
|
7
|
-
private constructor();
|
|
8
|
-
parse(context: ParserContext): AssetPromise<GLTFResource>;
|
|
9
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
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
|
-
}
|
package/types/gltf/GLTFUtil.d.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { IndexFormat, TypedArray, VertexElementFormat } from "@galacean/engine-core";
|
|
2
|
-
import { Color, Vector2, Vector3, Vector4 } from "@galacean/engine-math";
|
|
3
|
-
import { BufferInfo, ParserContext } from "./parser/ParserContext";
|
|
4
|
-
import { AccessorComponentType, AccessorType, IAccessor, IBufferView, IGLTF } from "./Schema";
|
|
5
|
-
/**
|
|
6
|
-
* @internal
|
|
7
|
-
*/
|
|
8
|
-
export declare class GLTFUtil {
|
|
9
|
-
static floatBufferToVector2Array(buffer: Float32Array): Vector2[];
|
|
10
|
-
static floatBufferToVector3Array(buffer: Float32Array): Vector3[];
|
|
11
|
-
static floatBufferToVector4Array(buffer: Float32Array): Vector4[];
|
|
12
|
-
static floatBufferToColorArray(buffer: Float32Array, isColor3: boolean): Color[];
|
|
13
|
-
/**
|
|
14
|
-
* Parse binary text for glb loader.
|
|
15
|
-
*/
|
|
16
|
-
static decodeText(array: Uint8Array): string;
|
|
17
|
-
/**
|
|
18
|
-
* Get the number of bytes occupied by accessor type.
|
|
19
|
-
*/
|
|
20
|
-
static getAccessorTypeSize(accessorType: AccessorType): number;
|
|
21
|
-
/**
|
|
22
|
-
* Get the TypedArray corresponding to the component type.
|
|
23
|
-
*/
|
|
24
|
-
static getComponentType(componentType: AccessorComponentType): Int8ArrayConstructor | Uint8ArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Uint32ArrayConstructor | Float32ArrayConstructor;
|
|
25
|
-
static getNormalizedComponentScale(componentType: AccessorComponentType): number;
|
|
26
|
-
static getAccessorBuffer(context: ParserContext, gltf: IGLTF, accessor: IAccessor): BufferInfo;
|
|
27
|
-
/**
|
|
28
|
-
* @deprecated
|
|
29
|
-
* Get accessor data.
|
|
30
|
-
*/
|
|
31
|
-
static getAccessorData(gltf: IGLTF, accessor: IAccessor, buffers: ArrayBuffer[]): TypedArray;
|
|
32
|
-
static getBufferViewData(bufferView: IBufferView, buffers: ArrayBuffer[]): ArrayBuffer;
|
|
33
|
-
/**
|
|
34
|
-
* Get accessor data.
|
|
35
|
-
*/
|
|
36
|
-
static processingSparseData(gltf: IGLTF, accessor: IAccessor, buffers: ArrayBuffer[], originData: TypedArray): TypedArray;
|
|
37
|
-
static getIndexFormat(type: AccessorComponentType): IndexFormat;
|
|
38
|
-
static getElementFormat(type: AccessorComponentType, size: number, normalized?: boolean): VertexElementFormat;
|
|
39
|
-
/**
|
|
40
|
-
* Load image buffer
|
|
41
|
-
*/
|
|
42
|
-
static loadImageBuffer(imageBuffer: ArrayBuffer, type: string): Promise<HTMLImageElement>;
|
|
43
|
-
static isAbsoluteUrl(url: string): boolean;
|
|
44
|
-
static parseRelativeUrl(baseUrl: string, relativeUrl: string): string;
|
|
45
|
-
/**
|
|
46
|
-
* Parse the glb format.
|
|
47
|
-
*/
|
|
48
|
-
static parseGLB(glb: ArrayBuffer): {
|
|
49
|
-
gltf: IGLTF;
|
|
50
|
-
buffers: ArrayBuffer[];
|
|
51
|
-
};
|
|
52
|
-
private static _formatRelativePath;
|
|
53
|
-
}
|