@galacean/engine-loader 1.1.0-beta.2 → 1.1.0-beta.20
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 +331 -232
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +331 -232
- package/dist/module.js +332 -233
- package/dist/module.js.map +1 -1
- package/package.json +5 -5
- package/types/GLTFLoader.d.ts +1 -0
- package/types/gltf/GLTFUtil.d.ts +3 -3
- package/types/gltf/parser/GLTFParserContext.d.ts +4 -2
- package/types/gltf/parser/GLTFSceneParser.d.ts +0 -1
- package/types/index.d.ts +1 -0
- package/types/ktx2/KTX2Loader.d.ts +4 -3
- package/types/ktx2/transcoder/AbstractTranscoder.d.ts +1 -1
- package/types/ktx2/transcoder/BinomialLLCTranscoder.d.ts +1 -1
- package/types/ktx2/transcoder/BinomialLLCWorkerCode.d.ts +1 -1
- package/types/resource-deserialize/resources/parser/ReflectionParser.d.ts +12 -8
- package/types/resource-deserialize/resources/scene/SceneParser.d.ts +1 -0
- package/types/resource-deserialize/resources/scene/SceneParserContext.d.ts +3 -1
- package/types/resource-deserialize/resources/schema/BasicSchema.d.ts +18 -15
- package/types/resource-deserialize/resources/schema/MaterialSchema.d.ts +1 -1
- package/types/resource-deserialize/utils/BufferReader.d.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@galacean/engine-loader",
|
|
3
|
-
"version": "1.1.0-beta.
|
|
3
|
+
"version": "1.1.0-beta.20",
|
|
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-draco": "1.1.0-beta.
|
|
19
|
-
"@galacean/engine-
|
|
20
|
-
"@galacean/engine-
|
|
21
|
-
"@galacean/engine-rhi-webgl": "1.1.0-beta.
|
|
18
|
+
"@galacean/engine-draco": "1.1.0-beta.20",
|
|
19
|
+
"@galacean/engine-core": "1.1.0-beta.20",
|
|
20
|
+
"@galacean/engine-math": "1.1.0-beta.20",
|
|
21
|
+
"@galacean/engine-rhi-webgl": "1.1.0-beta.20"
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
24
24
|
"b:types": "tsc"
|
package/types/GLTFLoader.d.ts
CHANGED
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 { BufferInfo, ParserContext } from "./parser/ParserContext";
|
|
4
|
+
import { AccessorComponentType, AccessorType, IAccessor, IBufferView, IGLTF } from "./Schema";
|
|
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: ParserContext, gltf: IGLTF, accessor: IAccessor): BufferInfo;
|
|
27
27
|
/**
|
|
28
28
|
* @deprecated
|
|
29
29
|
* Get accessor data.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Buffer, Entity, ResourceManager, TypedArray } from "@galacean/engine-core";
|
|
2
2
|
import { BufferDataRestoreInfo, GLTFContentRestorer } from "../../GLTFContentRestorer";
|
|
3
|
+
import { GLTFParams } from "../../GLTFLoader";
|
|
3
4
|
import { GLTFResource } from "../GLTFResource";
|
|
4
5
|
import type { IGLTF } from "../GLTFSchema";
|
|
5
6
|
import { GLTFParser } from "./GLTFParser";
|
|
@@ -9,7 +10,7 @@ import { GLTFParser } from "./GLTFParser";
|
|
|
9
10
|
export declare class GLTFParserContext {
|
|
10
11
|
glTFResource: GLTFResource;
|
|
11
12
|
resourceManager: ResourceManager;
|
|
12
|
-
|
|
13
|
+
params: GLTFParams;
|
|
13
14
|
private static readonly _parsers;
|
|
14
15
|
static addParser(parserType: GLTFParserType, parser: GLTFParser): void;
|
|
15
16
|
glTF: IGLTF;
|
|
@@ -17,7 +18,7 @@ export declare class GLTFParserContext {
|
|
|
17
18
|
contentRestorer: GLTFContentRestorer;
|
|
18
19
|
buffers?: ArrayBuffer[];
|
|
19
20
|
private _resourceCache;
|
|
20
|
-
constructor(glTFResource: GLTFResource, resourceManager: ResourceManager,
|
|
21
|
+
constructor(glTFResource: GLTFResource, resourceManager: ResourceManager, params: GLTFParams);
|
|
21
22
|
get<T>(type: GLTFParserType.Entity, index: number): Entity;
|
|
22
23
|
get<T>(type: GLTFParserType.Entity): Entity[];
|
|
23
24
|
get<T>(type: GLTFParserType.Schema): Promise<T>;
|
|
@@ -25,6 +26,7 @@ export declare class GLTFParserContext {
|
|
|
25
26
|
get<T>(type: GLTFParserType, index: number): Promise<T>;
|
|
26
27
|
get<T>(type: GLTFParserType): Promise<T[]>;
|
|
27
28
|
parse(): Promise<GLTFResource>;
|
|
29
|
+
private _createAnimator;
|
|
28
30
|
private _handleSubAsset;
|
|
29
31
|
}
|
|
30
32
|
/**
|
package/types/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ import "./SpriteAtlasLoader";
|
|
|
15
15
|
import "./SpriteLoader";
|
|
16
16
|
import "./Texture2DLoader";
|
|
17
17
|
import "./TextureCubeLoader";
|
|
18
|
+
import "./ProjectLoader";
|
|
18
19
|
import "./ktx2/KTX2Loader";
|
|
19
20
|
export type { GLTFParams } from "./GLTFLoader";
|
|
20
21
|
export * from "./SceneLoader";
|
|
@@ -5,6 +5,7 @@ export declare class KTX2Loader extends Loader<Texture2D | TextureCube> {
|
|
|
5
5
|
private static _isBinomialInit;
|
|
6
6
|
private static _binomialLLCTranscoder;
|
|
7
7
|
private static _khronosTranscoder;
|
|
8
|
+
private static _priorityFormats;
|
|
8
9
|
private static _supportedMap;
|
|
9
10
|
/**
|
|
10
11
|
* Destroy ktx2 transcoder worker.
|
|
@@ -37,7 +38,7 @@ export declare class KTX2Loader extends Loader<Texture2D | TextureCube> {
|
|
|
37
38
|
* KTX2 loader params interface.
|
|
38
39
|
*/
|
|
39
40
|
export interface KTX2Params {
|
|
40
|
-
/** Priority transcoding format queue, default is ASTC/ETC/
|
|
41
|
+
/** Priority transcoding format queue which is preferred options, default is BC7/ASTC/BC3_BC1/ETC/PVRTC/R8G8B8A8. */
|
|
41
42
|
priorityFormats: KTX2TargetFormat[];
|
|
42
43
|
}
|
|
43
44
|
declare module "@galacean/engine-core" {
|
|
@@ -46,8 +47,8 @@ declare module "@galacean/engine-core" {
|
|
|
46
47
|
ktx2Loader?: {
|
|
47
48
|
/** Worker count for transcoder, default is 4. */
|
|
48
49
|
workerCount?: number;
|
|
49
|
-
/**
|
|
50
|
-
priorityFormats?: KTX2TargetFormat[]
|
|
50
|
+
/** Global transcoding format queue which will be used if not specified in per-instance param, default is BC7/ASTC/BC3_BC1/ETC/PVRTC/R8G8B8A8. */
|
|
51
|
+
priorityFormats?: KTX2TargetFormat[];
|
|
51
52
|
};
|
|
52
53
|
}
|
|
53
54
|
}
|
|
@@ -20,7 +20,7 @@ export interface InitMessage extends BaseMessage {
|
|
|
20
20
|
export interface BinomialTranscodeMessage extends BaseMessage {
|
|
21
21
|
type: "transcode";
|
|
22
22
|
format: number;
|
|
23
|
-
buffer:
|
|
23
|
+
buffer: Uint8Array;
|
|
24
24
|
}
|
|
25
25
|
export type IBinomialMessage = InitMessage | BinomialTranscodeMessage;
|
|
26
26
|
export type TranscodeResult = {
|
|
@@ -4,5 +4,5 @@ import { AbstractTranscoder, TranscodeResult } from "./AbstractTranscoder";
|
|
|
4
4
|
export declare class BinomialLLCTranscoder extends AbstractTranscoder {
|
|
5
5
|
constructor(workerLimitCount: number);
|
|
6
6
|
_initTranscodeWorkerPool(): Promise<any>;
|
|
7
|
-
transcode(buffer:
|
|
7
|
+
transcode(buffer: Uint8Array, format: KTX2TargetFormat): Promise<TranscodeResult>;
|
|
8
8
|
}
|
|
@@ -3,4 +3,4 @@ import { TranscodeResult } from "./AbstractTranscoder";
|
|
|
3
3
|
export declare function TranscodeWorkerCode(): void;
|
|
4
4
|
export declare const _init: () => (wasmBinary?: ArrayBuffer) => any;
|
|
5
5
|
export declare const init: (wasmBinary?: ArrayBuffer) => any;
|
|
6
|
-
export declare function transcode(buffer:
|
|
6
|
+
export declare function transcode(buffer: Uint8Array, targetFormat: any, KTX2File: any): TranscodeResult;
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Entity } from "@galacean/engine-core";
|
|
2
2
|
import type { IBasicType, IClassObject, IEntity } from "../schema";
|
|
3
|
+
import { SceneParserContext } from "../scene/SceneParserContext";
|
|
3
4
|
export declare class ReflectionParser {
|
|
5
|
+
private readonly _context;
|
|
4
6
|
static customParseComponentHandles: Map<string, Function>;
|
|
5
7
|
static registerCustomParseComponent(componentType: string, handle: Function): void;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
constructor(_context: SceneParserContext);
|
|
9
|
+
parseEntity(entityConfig: IEntity): Promise<Entity>;
|
|
10
|
+
parseClassObject(item: IClassObject): Promise<any>;
|
|
11
|
+
parsePropsAndMethods(instance: any, item: Omit<IClassObject, "class">): Promise<any>;
|
|
12
|
+
parseMethod(instance: any, methodName: string, methodParams: Array<IBasicType>): Promise<any>;
|
|
13
|
+
parseBasicType(value: IBasicType, originValue?: any): Promise<any>;
|
|
14
|
+
private _getEntityByConfig;
|
|
12
15
|
private static _isClass;
|
|
13
|
-
private static
|
|
16
|
+
private static _isAssetRef;
|
|
17
|
+
private static _isEntityRef;
|
|
14
18
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component, Entity, Scene } from "@galacean/engine-core";
|
|
1
|
+
import { Component, Engine, Entity, ResourceManager, Scene } from "@galacean/engine-core";
|
|
2
2
|
import type { IEntity, IScene } from "../schema";
|
|
3
3
|
export declare class SceneParserContext {
|
|
4
4
|
readonly originalData: IScene;
|
|
@@ -8,6 +8,8 @@ export declare class SceneParserContext {
|
|
|
8
8
|
assets: Map<string, any>;
|
|
9
9
|
entityConfigMap: Map<string, IEntity>;
|
|
10
10
|
rootIds: string[];
|
|
11
|
+
readonly engine: Engine;
|
|
12
|
+
readonly resourceManager: ResourceManager;
|
|
11
13
|
constructor(originalData: IScene, scene: Scene);
|
|
12
14
|
destroy(): void;
|
|
13
15
|
}
|
|
@@ -23,21 +23,6 @@ export interface IPrefabFile {
|
|
|
23
23
|
entities: Array<IEntity>;
|
|
24
24
|
}
|
|
25
25
|
export type IMethodParams = Array<IBasicType>;
|
|
26
|
-
export type IClassObject = {
|
|
27
|
-
class: string;
|
|
28
|
-
constructParams?: IMethodParams;
|
|
29
|
-
methods?: {
|
|
30
|
-
[methodName: string]: Array<IMethodParams>;
|
|
31
|
-
};
|
|
32
|
-
props?: {
|
|
33
|
-
[key: string]: IBasicType | IMethodParams;
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
export type IBasicType = string | number | boolean | null | undefined | IAssetRef | IClassObject | IMethodParams;
|
|
37
|
-
export type IAssetRef = {
|
|
38
|
-
key?: string;
|
|
39
|
-
refId: string;
|
|
40
|
-
};
|
|
41
26
|
export interface IBasicEntity {
|
|
42
27
|
name?: string;
|
|
43
28
|
id?: string;
|
|
@@ -59,3 +44,21 @@ export type IComponent = {
|
|
|
59
44
|
id: string;
|
|
60
45
|
refId?: string;
|
|
61
46
|
} & IClassObject;
|
|
47
|
+
export type IClassObject = {
|
|
48
|
+
class: string;
|
|
49
|
+
constructParams?: IMethodParams;
|
|
50
|
+
methods?: {
|
|
51
|
+
[methodName: string]: Array<IMethodParams>;
|
|
52
|
+
};
|
|
53
|
+
props?: {
|
|
54
|
+
[key: string]: IBasicType | IMethodParams;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
export type IBasicType = string | number | boolean | null | undefined | IAssetRef | IClassObject | IMethodParams | IEntityRef;
|
|
58
|
+
export type IAssetRef = {
|
|
59
|
+
key?: string;
|
|
60
|
+
refId: string;
|
|
61
|
+
};
|
|
62
|
+
export type IEntityRef = {
|
|
63
|
+
entityId: string;
|
|
64
|
+
};
|
|
@@ -79,7 +79,7 @@ export interface IMaterialSchema {
|
|
|
79
79
|
shader: string;
|
|
80
80
|
shaderData: {
|
|
81
81
|
[key: string]: {
|
|
82
|
-
type: "Vector2" | "Vector3" | "Vector4" | "Color" | "Float" | "Texture";
|
|
82
|
+
type: "Vector2" | "Vector3" | "Vector4" | "Color" | "Float" | "Texture" | "Boolean" | "Integer";
|
|
83
83
|
value: IVector3 | IVector2 | IColor | number | IAssetRef;
|
|
84
84
|
};
|
|
85
85
|
};
|
|
@@ -2,7 +2,7 @@ export declare class BufferReader {
|
|
|
2
2
|
data: Uint8Array;
|
|
3
3
|
private _dataView;
|
|
4
4
|
private _littleEndian;
|
|
5
|
-
private
|
|
5
|
+
private _position;
|
|
6
6
|
private _baseOffset;
|
|
7
7
|
constructor(data: Uint8Array, byteOffset?: number, byteLength?: number, littleEndian?: boolean);
|
|
8
8
|
get position(): number;
|