@galacean/engine-loader 0.9.19 → 0.9.21
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 +197 -448
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +197 -448
- package/dist/module.js +125 -388
- package/dist/module.js.map +1 -1
- package/package.json +5 -5
- package/types/GLTFContentRestorer.d.ts +17 -7
- package/types/ProjectLoader.d.ts +1 -0
- package/types/gltf/GLTFSchema.d.ts +7 -1
- package/types/gltf/GLTFUtils.d.ts +6 -4
- package/types/gltf/extensions/GLTFExtensionParser.d.ts +0 -6
- 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/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 +6 -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/schema/ProjectSchema.d.ts +9 -0
- package/types/resource-deserialize/resources/schema/index.d.ts +1 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @internal
|
|
3
|
+
* WorkerPool, T is is post message type, U is return type.
|
|
4
|
+
*/
|
|
5
|
+
export declare class WorkerPool<T = any, U = any> {
|
|
6
|
+
readonly limitedCount: number;
|
|
7
|
+
private readonly _workerCreator;
|
|
8
|
+
private _taskQueue;
|
|
9
|
+
private _workerStatus;
|
|
10
|
+
private _workerItems;
|
|
11
|
+
/**
|
|
12
|
+
* Constructor of WorkerPool.
|
|
13
|
+
* @param limitedCount - worker limit count
|
|
14
|
+
* @param _workerCreator - creator of worker
|
|
15
|
+
*/
|
|
16
|
+
constructor(limitedCount: number, _workerCreator: () => Worker | Promise<Worker>);
|
|
17
|
+
prepareWorker(): Promise<Worker[]>;
|
|
18
|
+
/**
|
|
19
|
+
* Post message to worker.
|
|
20
|
+
* @param message - Message which posted to worker
|
|
21
|
+
* @returns Return a promise of message
|
|
22
|
+
*/
|
|
23
|
+
postMessage(message: T): Promise<U>;
|
|
24
|
+
/**
|
|
25
|
+
* Destroy the worker pool.
|
|
26
|
+
*/
|
|
27
|
+
destroy(): void;
|
|
28
|
+
private _initWorker;
|
|
29
|
+
private _getIdleWorkerId;
|
|
30
|
+
private _onMessage;
|
|
31
|
+
private _nextTask;
|
|
32
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { WorkerPool } from "../WorkerPool";
|
|
2
|
+
export declare abstract class AbstractTranscoder {
|
|
3
|
+
readonly workerLimitCount: number;
|
|
4
|
+
protected _transcodeWorkerPool: WorkerPool;
|
|
5
|
+
protected _initPromise: Promise<any>;
|
|
6
|
+
constructor(workerLimitCount: number);
|
|
7
|
+
init(): Promise<any>;
|
|
8
|
+
destroy(): void;
|
|
9
|
+
protected abstract _initTranscodeWorkerPool(): Promise<any>;
|
|
10
|
+
protected _createTranscodePool(workerURL: string, wasmBuffer: ArrayBuffer): Promise<Worker[]>;
|
|
11
|
+
}
|
|
12
|
+
type MessageType = "init" | "transcode";
|
|
13
|
+
export interface BaseMessage {
|
|
14
|
+
type: MessageType;
|
|
15
|
+
}
|
|
16
|
+
export interface InitMessage extends BaseMessage {
|
|
17
|
+
type: "init";
|
|
18
|
+
transcoderWasm: ArrayBuffer;
|
|
19
|
+
}
|
|
20
|
+
export interface BinomialTranscodeMessage extends BaseMessage {
|
|
21
|
+
type: "transcode";
|
|
22
|
+
format: number;
|
|
23
|
+
buffer: ArrayBuffer;
|
|
24
|
+
}
|
|
25
|
+
export type IBinomialMessage = InitMessage | BinomialTranscodeMessage;
|
|
26
|
+
export type TranscodeResult = {
|
|
27
|
+
width: number;
|
|
28
|
+
height: number;
|
|
29
|
+
hasAlpha: boolean;
|
|
30
|
+
format: number;
|
|
31
|
+
faces: Array<{
|
|
32
|
+
data: Uint8Array;
|
|
33
|
+
width: number;
|
|
34
|
+
height: number;
|
|
35
|
+
}>[];
|
|
36
|
+
faceCount: number;
|
|
37
|
+
};
|
|
38
|
+
export type TranscodeResponse = {
|
|
39
|
+
id: number;
|
|
40
|
+
type: "transcoded";
|
|
41
|
+
} & TranscodeResult;
|
|
42
|
+
export interface EncodedData {
|
|
43
|
+
buffer: Uint8Array;
|
|
44
|
+
levelWidth: number;
|
|
45
|
+
levelHeight: number;
|
|
46
|
+
uncompressedByteLength: number;
|
|
47
|
+
}
|
|
48
|
+
export interface KhronosTranscoderMessage extends BaseMessage {
|
|
49
|
+
type: "transcode";
|
|
50
|
+
format: number;
|
|
51
|
+
needZstd: boolean;
|
|
52
|
+
data: EncodedData[][];
|
|
53
|
+
}
|
|
54
|
+
export type IKhronosMessageMessage = InitMessage | KhronosTranscoderMessage;
|
|
55
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { KTX2TargetFormat } from "../KTX2TargetFormat";
|
|
2
|
+
import { AbstractTranscoder, TranscodeResult } from "./AbstractTranscoder";
|
|
3
|
+
/** @internal */
|
|
4
|
+
export declare class BinomialLLCTranscoder extends AbstractTranscoder {
|
|
5
|
+
constructor(workerLimitCount: number);
|
|
6
|
+
_initTranscodeWorkerPool(): Promise<any>;
|
|
7
|
+
transcode(buffer: ArrayBuffer, format: KTX2TargetFormat): Promise<TranscodeResult>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { TranscodeResult } from "./AbstractTranscoder";
|
|
2
|
+
/** @internal */
|
|
3
|
+
export declare function TranscodeWorkerCode(): void;
|
|
4
|
+
export declare const _init: () => (wasmBinary?: ArrayBuffer) => any;
|
|
5
|
+
export declare const init: (wasmBinary?: ArrayBuffer) => any;
|
|
6
|
+
export declare function transcode(buffer: ArrayBuffer, targetFormat: any, KTX2File: any): TranscodeResult;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { KTX2Container } from "../KTX2Container";
|
|
2
|
+
import { KTX2TargetFormat } from "../KTX2TargetFormat";
|
|
3
|
+
import { AbstractTranscoder, TranscodeResult } from "./AbstractTranscoder";
|
|
4
|
+
/** @internal */
|
|
5
|
+
export declare class KhronosTranscoder extends AbstractTranscoder {
|
|
6
|
+
readonly type: KTX2TargetFormat;
|
|
7
|
+
static transcoderMap: {
|
|
8
|
+
0: string;
|
|
9
|
+
};
|
|
10
|
+
constructor(workerLimitCount: number, type: KTX2TargetFormat);
|
|
11
|
+
_initTranscodeWorkerPool(): Promise<Worker[]>;
|
|
12
|
+
transcode(ktx2Container: KTX2Container): Promise<TranscodeResult>;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function TranscodeWorkerCode(): void;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* From https://github.com/donmccurdy/zstddec by Don McCurdy
|
|
3
|
+
*/
|
|
4
|
+
interface DecoderExports {
|
|
5
|
+
memory: Uint8Array;
|
|
6
|
+
ZSTD_findDecompressedSize: (compressedPtr: number, compressedSize: number) => number;
|
|
7
|
+
ZSTD_decompress: (uncompressedPtr: number, uncompressedSize: number, compressedPtr: number, compressedSize: number) => number;
|
|
8
|
+
malloc: (ptr: number) => number;
|
|
9
|
+
free: (ptr: number) => void;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* ZSTD (Zstandard) decoder.
|
|
13
|
+
*/
|
|
14
|
+
export declare class ZSTDDecoder {
|
|
15
|
+
static heap: Uint8Array;
|
|
16
|
+
static IMPORT_OBJECT: {
|
|
17
|
+
env: {
|
|
18
|
+
emscripten_notify_memory_growth: () => void;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
static instance: {
|
|
22
|
+
exports: DecoderExports;
|
|
23
|
+
};
|
|
24
|
+
static WasmModuleURL: string;
|
|
25
|
+
_initPromise: Promise<any>;
|
|
26
|
+
init(): Promise<void>;
|
|
27
|
+
_init(result: WebAssembly.WebAssemblyInstantiatedSource): void;
|
|
28
|
+
decode(array: Uint8Array, uncompressedSize?: number): Uint8Array;
|
|
29
|
+
}
|
|
30
|
+
export {};
|
|
31
|
+
/**
|
|
32
|
+
* BSD License
|
|
33
|
+
*
|
|
34
|
+
* For Zstandard software
|
|
35
|
+
*
|
|
36
|
+
* Copyright (c) 2016-present, Yann Collet, Facebook, Inc. All rights reserved.
|
|
37
|
+
*
|
|
38
|
+
* Redistribution and use in source and binary forms, with or without modification,
|
|
39
|
+
* are permitted provided that the following conditions are met:
|
|
40
|
+
*
|
|
41
|
+
* * Redistributions of source code must retain the above copyright notice, this
|
|
42
|
+
* list of conditions and the following disclaimer.
|
|
43
|
+
*
|
|
44
|
+
* * Redistributions in binary form must reproduce the above copyright notice,
|
|
45
|
+
* this list of conditions and the following disclaimer in the documentation
|
|
46
|
+
* and/or other materials provided with the distribution.
|
|
47
|
+
*
|
|
48
|
+
* * Neither the name Facebook nor the names of its contributors may be used to
|
|
49
|
+
* endorse or promote products derived from this software without specific
|
|
50
|
+
* prior written permission.
|
|
51
|
+
*
|
|
52
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
53
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
54
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
55
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
|
56
|
+
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
57
|
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
58
|
+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
59
|
+
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
60
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
61
|
+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
62
|
+
*/
|