@galacean/engine-loader 0.9.20 → 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.
Files changed (42) hide show
  1. package/dist/main.js +186 -443
  2. package/dist/main.js.map +1 -1
  3. package/dist/miniprogram.js +186 -443
  4. package/dist/module.js +114 -383
  5. package/dist/module.js.map +1 -1
  6. package/package.json +5 -5
  7. package/types/ProjectLoader.d.ts +1 -0
  8. package/types/gltf/GLTFSchema.d.ts +7 -1
  9. package/types/gltf/GLTFUtils.d.ts +4 -3
  10. package/types/gltf/extensions/GLTFExtensionParser.d.ts +0 -6
  11. package/types/gltf/index.d.ts +0 -1
  12. package/types/gltf/parser/GLTFAnimationParser.d.ts +3 -3
  13. package/types/gltf/parser/GLTFBufferParser.d.ts +2 -3
  14. package/types/gltf/parser/GLTFEntityParser.d.ts +2 -5
  15. package/types/gltf/parser/GLTFMaterialParser.d.ts +5 -2
  16. package/types/gltf/parser/GLTFMeshParser.d.ts +2 -2
  17. package/types/gltf/parser/GLTFParser.d.ts +3 -9
  18. package/types/gltf/parser/GLTFParserContext.d.ts +29 -28
  19. package/types/gltf/parser/GLTFSceneParser.d.ts +5 -4
  20. package/types/gltf/parser/GLTFSchemaParser.d.ts +7 -0
  21. package/types/gltf/parser/GLTFSkinParser.d.ts +3 -3
  22. package/types/gltf/parser/GLTFTextureParser.d.ts +9 -6
  23. package/types/gltf/parser/GLTFValidator.d.ts +1 -2
  24. package/types/gltf/parser/index.d.ts +2 -1
  25. package/types/ktx2/BinomialLLCTranscoder/BinomialLLCTranscoder.d.ts +13 -0
  26. package/types/ktx2/BinomialLLCTranscoder/TranscodeWorkerCode.d.ts +33 -0
  27. package/types/ktx2/KTX2Container.d.ts +72 -0
  28. package/types/ktx2/KTX2Loader.d.ts +53 -0
  29. package/types/ktx2/KTX2TargetFormat.d.ts +21 -0
  30. package/types/ktx2/KhronosTranscoder/KhronosTranscoder.d.ts +17 -0
  31. package/types/ktx2/KhronosTranscoder/TranscoderWorkerCode.d.ts +34 -0
  32. package/types/ktx2/TranscodeResult.d.ts +10 -0
  33. package/types/ktx2/WorkerPool.d.ts +32 -0
  34. package/types/ktx2/constants.d.ts +7 -0
  35. package/types/ktx2/transcoder/AbstractTranscoder.d.ts +55 -0
  36. package/types/ktx2/transcoder/BinomialLLCTranscoder.d.ts +8 -0
  37. package/types/ktx2/transcoder/BinomialLLCWorkerCode.d.ts +6 -0
  38. package/types/ktx2/transcoder/KhronosTranscoder.d.ts +13 -0
  39. package/types/ktx2/transcoder/KhronosWorkerCode.d.ts +1 -0
  40. package/types/ktx2/zstddec.d.ts +62 -0
  41. package/types/resource-deserialize/resources/schema/ProjectSchema.d.ts +9 -0
  42. package/types/resource-deserialize/resources/schema/index.d.ts +1 -0
@@ -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
+ */
@@ -0,0 +1,9 @@
1
+ export interface IProject {
2
+ scene: string;
3
+ files: {
4
+ virtualPath: string;
5
+ path: string;
6
+ type: string;
7
+ id: string;
8
+ }[];
9
+ }
@@ -1,3 +1,4 @@
1
1
  export * from "./BasicSchema";
2
2
  export * from "./MaterialSchema";
3
+ export * from "./ProjectSchema";
3
4
  export * from "./SceneSchema";