@galacean/engine-loader 1.1.0-beta.8 → 1.2.0-alpha.0
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 +499 -245
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +499 -245
- package/dist/module.js +501 -247
- package/dist/module.js.map +1 -1
- package/package.json +5 -5
- package/types/GLTFLoader.d.ts +1 -0
- package/types/Texture2DLoader.d.ts +9 -1
- package/types/gltf/GLTFResource.d.ts +50 -16
- package/types/gltf/extensions/GLTFExtensionSchema.d.ts +9 -1
- package/types/gltf/extensions/KHR_materials_anisotropy.d.ts +1 -0
- package/types/gltf/extensions/index.d.ts +1 -0
- package/types/gltf/parser/GLTFJSONParser.d.ts +7 -0
- package/types/gltf/parser/GLTFParserContext.d.ts +17 -2
- package/types/gltf/parser/GLTFSceneParser.d.ts +0 -1
- package/types/index.d.ts +1 -1
- package/types/ktx2/KTX2Loader.d.ts +16 -5
- 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 +1 -1
- package/types/resource-deserialize/resources/schema/MaterialSchema.d.ts +1 -1
- package/types/resource-deserialize/resources/schema/SceneSchema.d.ts +3 -1
- package/types/resource-deserialize/utils/BufferReader.d.ts +1 -1
- 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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@galacean/engine-loader",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0-alpha.0",
|
|
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.2.0-alpha.0",
|
|
19
|
+
"@galacean/engine-core": "1.2.0-alpha.0",
|
|
20
|
+
"@galacean/engine-draco": "1.2.0-alpha.0",
|
|
21
|
+
"@galacean/engine-math": "1.2.0-alpha.0"
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
24
24
|
"b:types": "tsc"
|
package/types/GLTFLoader.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TextureFormat } from "@galacean/engine-core";
|
|
1
|
+
import { TextureFilterMode, TextureFormat, TextureWrapMode } from "@galacean/engine-core";
|
|
2
2
|
/**
|
|
3
3
|
* Texture2D loader params interface.
|
|
4
4
|
*/
|
|
@@ -7,4 +7,12 @@ export interface Texture2DParams {
|
|
|
7
7
|
format: TextureFormat;
|
|
8
8
|
/** Whether to use multi-level texture, default is true. */
|
|
9
9
|
mipmap: boolean;
|
|
10
|
+
/** Wrapping mode for texture coordinate S. */
|
|
11
|
+
wrapModeU: TextureWrapMode;
|
|
12
|
+
/** Wrapping mode for texture coordinate T. */
|
|
13
|
+
wrapModeV: TextureWrapMode;
|
|
14
|
+
/** Filter mode for texture. */
|
|
15
|
+
filterMode: TextureFilterMode;
|
|
16
|
+
/** Anisotropic level for texture. */
|
|
17
|
+
anisoLevel: number;
|
|
10
18
|
}
|
|
@@ -4,28 +4,62 @@ import { AnimationClip, Camera, Engine, Entity, Light, Material, ModelMesh, Refe
|
|
|
4
4
|
*/
|
|
5
5
|
export declare class GLTFResource extends ReferResource {
|
|
6
6
|
/** glTF file url. */
|
|
7
|
-
url: string;
|
|
7
|
+
readonly url: string;
|
|
8
8
|
/** Texture2D after TextureParser. */
|
|
9
|
-
textures?: Texture2D[];
|
|
9
|
+
readonly textures?: Texture2D[];
|
|
10
10
|
/** Material after MaterialParser. */
|
|
11
|
-
materials?: Material[];
|
|
11
|
+
readonly materials?: Material[];
|
|
12
12
|
/** ModelMesh after MeshParser. */
|
|
13
|
-
meshes?: ModelMesh[][];
|
|
13
|
+
readonly meshes?: ModelMesh[][];
|
|
14
14
|
/** Skin after SkinParser. */
|
|
15
|
-
skins?: Skin[];
|
|
15
|
+
readonly skins?: Skin[];
|
|
16
16
|
/** AnimationClip after AnimationParser. */
|
|
17
|
-
animations?: AnimationClip[];
|
|
18
|
-
/**
|
|
17
|
+
readonly animations?: AnimationClip[];
|
|
18
|
+
/** @internal */
|
|
19
|
+
_defaultSceneRoot: Entity;
|
|
20
|
+
/** @internal */
|
|
21
|
+
_sceneRoots: Entity[];
|
|
22
|
+
/** @internal */
|
|
23
|
+
_extensionsData: Record<string, any>;
|
|
24
|
+
/**
|
|
25
|
+
* Extensions data.
|
|
26
|
+
*/
|
|
27
|
+
get extensionsData(): Record<string, any>;
|
|
28
|
+
/**
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
constructor(engine: Engine, url: string);
|
|
32
|
+
/**
|
|
33
|
+
* Instantiate scene root entity.
|
|
34
|
+
* @param sceneIndex - Scene index
|
|
35
|
+
* @returns Root entity
|
|
36
|
+
*/
|
|
37
|
+
instantiateSceneRoot(sceneIndex?: number): Entity;
|
|
38
|
+
protected _onDestroy(): void;
|
|
39
|
+
private _disassociationSuperResource;
|
|
40
|
+
/**
|
|
41
|
+
* @deprecated
|
|
42
|
+
* Entity after EntityParser.
|
|
43
|
+
*/
|
|
19
44
|
entities: Entity[];
|
|
20
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* @deprecated
|
|
47
|
+
* Camera after SceneParser.
|
|
48
|
+
*/
|
|
21
49
|
cameras?: Camera[];
|
|
22
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
* @deprecated
|
|
52
|
+
* Export lights in extension KHR_lights_punctual.
|
|
53
|
+
*/
|
|
23
54
|
lights?: Light[];
|
|
24
|
-
/**
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
55
|
+
/**
|
|
56
|
+
* @deprecated Please use `instantiateSceneRoot` instead.
|
|
57
|
+
* RootEntities after SceneParser.
|
|
58
|
+
*/
|
|
59
|
+
get sceneRoots(): Entity[];
|
|
60
|
+
/**
|
|
61
|
+
* @deprecated Please use `instantiateSceneRoot` instead.
|
|
62
|
+
* RootEntity after SceneParser.
|
|
63
|
+
*/
|
|
64
|
+
get defaultSceneRoot(): Entity;
|
|
31
65
|
}
|
|
@@ -105,6 +105,14 @@ export interface IKHRMaterialVariants_Variant {
|
|
|
105
105
|
extensions?: any;
|
|
106
106
|
extras?: any;
|
|
107
107
|
}
|
|
108
|
+
/**
|
|
109
|
+
* Interfaces from the KHR_materials_clearcoat extension
|
|
110
|
+
*/
|
|
111
|
+
export interface IKHRMaterialsAnisotropy {
|
|
112
|
+
anisotropyStrength: number;
|
|
113
|
+
anisotropyRotation: number;
|
|
114
|
+
anisotropyTexture: ITextureInfo;
|
|
115
|
+
}
|
|
108
116
|
export interface IKHRMaterialVariants_Variants {
|
|
109
117
|
variants: Array<IKHRMaterialVariants_Variant>;
|
|
110
118
|
}
|
|
@@ -146,4 +154,4 @@ export interface IGalaceanAnimation {
|
|
|
146
154
|
parameter: any;
|
|
147
155
|
}[];
|
|
148
156
|
}
|
|
149
|
-
export type GLTFExtensionSchema = IKHRLightsPunctual_Light | IKHRDracoMeshCompression | IKHRMaterialsClearcoat | IKHRMaterialsIor | IKHRMaterialsUnlit | IKHRMaterialsPbrSpecularGlossiness | IKHRMaterialsSheen | IKHRMaterialsSpecular | IKHRMaterialsTransmission | IKHRMaterialsTranslucency | IKHRMaterialVariants_Mapping | IKHRMaterialVariants_Variants | IKHRTextureBasisU | IKHRTextureTransform | IKHRXmp | IKHRXmp_Node | IGalaceanAnimation | Object;
|
|
157
|
+
export type GLTFExtensionSchema = IKHRLightsPunctual_Light | IKHRDracoMeshCompression | IKHRMaterialsClearcoat | IKHRMaterialsIor | IKHRMaterialsUnlit | IKHRMaterialsPbrSpecularGlossiness | IKHRMaterialsSheen | IKHRMaterialsSpecular | IKHRMaterialsTransmission | IKHRMaterialsTranslucency | IKHRMaterialVariants_Mapping | IKHRMaterialVariants_Variants | IKHRMaterialsAnisotropy | IKHRTextureBasisU | IKHRTextureTransform | IKHRXmp | IKHRXmp_Node | IGalaceanAnimation | Object;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -14,5 +14,6 @@ import "./KHR_texture_transform";
|
|
|
14
14
|
import "./KHR_materials_ior";
|
|
15
15
|
import "./GALACEAN_materials_remap";
|
|
16
16
|
import "./GALACEAN_animation_event";
|
|
17
|
+
import "./KHR_materials_anisotropy";
|
|
17
18
|
export { GLTFExtensionParser, GLTFExtensionMode } from "./GLTFExtensionParser";
|
|
18
19
|
export * from "./GLTFExtensionSchema";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IGLTF } from "../GLTFSchema";
|
|
2
|
+
import { GLTFParser } from "./GLTFParser";
|
|
3
|
+
import { GLTFParserContext } from "./GLTFParserContext";
|
|
4
|
+
export declare class GLTFJSONParser extends GLTFParser {
|
|
5
|
+
parse(context: GLTFParserContext): Promise<IGLTF>;
|
|
6
|
+
private _isGLB;
|
|
7
|
+
}
|
|
@@ -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,12 @@ export declare class GLTFParserContext {
|
|
|
17
18
|
contentRestorer: GLTFContentRestorer;
|
|
18
19
|
buffers?: ArrayBuffer[];
|
|
19
20
|
private _resourceCache;
|
|
20
|
-
|
|
21
|
+
private _progress;
|
|
22
|
+
/** @internal */
|
|
23
|
+
_setTaskCompleteProgress: (loaded: number, total: number) => void;
|
|
24
|
+
/** @internal */
|
|
25
|
+
_setTaskDetailProgress: (url: string, loaded: number, total: number) => void;
|
|
26
|
+
constructor(glTFResource: GLTFResource, resourceManager: ResourceManager, params: GLTFParams);
|
|
21
27
|
get<T>(type: GLTFParserType.Entity, index: number): Entity;
|
|
22
28
|
get<T>(type: GLTFParserType.Entity): Entity[];
|
|
23
29
|
get<T>(type: GLTFParserType.Schema): Promise<T>;
|
|
@@ -25,6 +31,15 @@ export declare class GLTFParserContext {
|
|
|
25
31
|
get<T>(type: GLTFParserType, index: number): Promise<T>;
|
|
26
32
|
get<T>(type: GLTFParserType): Promise<T[]>;
|
|
27
33
|
parse(): Promise<GLTFResource>;
|
|
34
|
+
/**
|
|
35
|
+
* @internal
|
|
36
|
+
*/
|
|
37
|
+
_onTaskDetail: (url: string, loaded: number, total: number) => void;
|
|
38
|
+
/**
|
|
39
|
+
* @internal
|
|
40
|
+
*/
|
|
41
|
+
_addTaskCompletePromise(taskPromise: Promise<any>): void;
|
|
42
|
+
private _createAnimator;
|
|
28
43
|
private _handleSubAsset;
|
|
29
44
|
}
|
|
30
45
|
/**
|
package/types/index.d.ts
CHANGED
|
@@ -22,6 +22,6 @@ export * from "./SceneLoader";
|
|
|
22
22
|
export type { Texture2DParams } from "./Texture2DLoader";
|
|
23
23
|
export { parseSingleKTX } from "./compressed-texture";
|
|
24
24
|
export * from "./gltf";
|
|
25
|
-
export { KTX2Loader } from "./ktx2/KTX2Loader";
|
|
25
|
+
export { KTX2Loader, KTX2Transcoder } from "./ktx2/KTX2Loader";
|
|
26
26
|
export { KTX2TargetFormat } from "./ktx2/KTX2TargetFormat";
|
|
27
27
|
export * from "./resource-deserialize";
|
|
@@ -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.
|
|
@@ -24,30 +25,40 @@ export declare class KTX2Loader extends Loader<Texture2D | TextureCube> {
|
|
|
24
25
|
private static _getBinomialLLCTranscoder;
|
|
25
26
|
private static _getKhronosTranscoder;
|
|
26
27
|
private static _getEngineTextureFormat;
|
|
27
|
-
initialize(
|
|
28
|
+
initialize(_: Engine, configuration: EngineConfiguration): Promise<void>;
|
|
28
29
|
/**
|
|
29
30
|
* @internal
|
|
30
31
|
*/
|
|
31
32
|
load(item: LoadItem & {
|
|
32
33
|
params?: KTX2Params;
|
|
33
34
|
}, resourceManager: ResourceManager): AssetPromise<Texture2D | TextureCube>;
|
|
34
|
-
private _isKhronosSupported;
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
37
|
* KTX2 loader params interface.
|
|
38
38
|
*/
|
|
39
39
|
export interface KTX2Params {
|
|
40
|
-
/** Priority transcoding format queue, default is ASTC/ETC/
|
|
40
|
+
/** Priority transcoding format queue which is preferred options, default is BC7/ASTC/BC3_BC1/ETC/PVRTC/R8G8B8A8. */
|
|
41
|
+
/** @deprecated */
|
|
41
42
|
priorityFormats: KTX2TargetFormat[];
|
|
42
43
|
}
|
|
44
|
+
/** Used for initialize KTX2 transcoder. */
|
|
45
|
+
export declare enum KTX2Transcoder {
|
|
46
|
+
/** BinomialLLC transcoder. */
|
|
47
|
+
BinomialLLC = 0,
|
|
48
|
+
/** Khronos transcoder. */
|
|
49
|
+
Khronos = 1
|
|
50
|
+
}
|
|
43
51
|
declare module "@galacean/engine-core" {
|
|
44
52
|
interface EngineConfiguration {
|
|
45
53
|
/** KTX2 loader options. */
|
|
46
54
|
ktx2Loader?: {
|
|
47
55
|
/** Worker count for transcoder, default is 4. */
|
|
48
56
|
workerCount?: number;
|
|
49
|
-
/**
|
|
50
|
-
|
|
57
|
+
/** Global transcoding format queue which will be used if not specified in per-instance param, default is BC7/ASTC/BC3_BC1/ETC/PVRTC/R8G8B8A8. */
|
|
58
|
+
/** @deprecated */
|
|
59
|
+
priorityFormats?: KTX2TargetFormat[];
|
|
60
|
+
/** Used for initialize KTX2 transcoder, default is BinomialLLC. */
|
|
61
|
+
transcoder?: KTX2Transcoder;
|
|
51
62
|
};
|
|
52
63
|
}
|
|
53
64
|
}
|
|
@@ -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;
|
|
@@ -10,7 +10,7 @@ export declare class ReflectionParser {
|
|
|
10
10
|
parseClassObject(item: IClassObject): Promise<any>;
|
|
11
11
|
parsePropsAndMethods(instance: any, item: Omit<IClassObject, "class">): Promise<any>;
|
|
12
12
|
parseMethod(instance: any, methodName: string, methodParams: Array<IBasicType>): Promise<any>;
|
|
13
|
-
parseBasicType(value: IBasicType): Promise<any>;
|
|
13
|
+
parseBasicType(value: IBasicType, originValue?: any): Promise<any>;
|
|
14
14
|
private _getEntityByConfig;
|
|
15
15
|
private static _isClass;
|
|
16
16
|
private static _isAssetRef;
|
|
@@ -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
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BackgroundMode, DiffuseMode, ShadowCascadesMode, ShadowResolution } from "@galacean/engine-core";
|
|
2
2
|
import type { IReferable } from "@galacean/engine-core/types/asset/IReferable";
|
|
3
|
-
import type { IColor, IPrefabFile } from "./BasicSchema";
|
|
3
|
+
import type { IColor, IPrefabFile, IVector3 } from "./BasicSchema";
|
|
4
4
|
export declare enum SpecularMode {
|
|
5
5
|
Sky = "Sky",
|
|
6
6
|
Custom = "Custom"
|
|
@@ -30,6 +30,8 @@ export interface IScene extends IPrefabFile {
|
|
|
30
30
|
shadowResolution: ShadowResolution;
|
|
31
31
|
shadowDistance: number;
|
|
32
32
|
shadowCascades: ShadowCascadesMode;
|
|
33
|
+
shadowTwoCascadeSplits: number;
|
|
34
|
+
shadowFourCascadeSplits: IVector3;
|
|
33
35
|
};
|
|
34
36
|
};
|
|
35
37
|
files: Array<{
|
|
@@ -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;
|
|
@@ -1,13 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
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 {};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { KTX2Container } from "../KTX2Container";
|
|
2
|
-
import { KTX2TargetFormat } from "../KTX2TargetFormat";
|
|
3
|
-
import { TranscodeResult } from "./TranscoderWorkerCode";
|
|
4
|
-
/** @internal */
|
|
5
|
-
export declare class KhronosTranscoder {
|
|
6
|
-
readonly workerLimit: number;
|
|
7
|
-
readonly type: KTX2TargetFormat;
|
|
8
|
-
static transcoderMap: {
|
|
9
|
-
0: string;
|
|
10
|
-
};
|
|
11
|
-
private _transcodeWorkerPool;
|
|
12
|
-
private _initPromise;
|
|
13
|
-
constructor(workerLimit: number, type: KTX2TargetFormat);
|
|
14
|
-
init(): Promise<any>;
|
|
15
|
-
transcode(ktx2Container: KTX2Container): Promise<TranscodeResult>;
|
|
16
|
-
destroy(): void;
|
|
17
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export interface EncodedData {
|
|
2
|
-
buffer: Uint8Array;
|
|
3
|
-
levelWidth: number;
|
|
4
|
-
levelHeight: number;
|
|
5
|
-
uncompressedByteLength: number;
|
|
6
|
-
}
|
|
7
|
-
type MessageType = "init" | "transcode";
|
|
8
|
-
export interface IBaseMessage {
|
|
9
|
-
type: MessageType;
|
|
10
|
-
}
|
|
11
|
-
export interface IInitMessage extends IBaseMessage {
|
|
12
|
-
type: "init";
|
|
13
|
-
transcoderWasm: ArrayBuffer;
|
|
14
|
-
}
|
|
15
|
-
export interface ITranscodeMessage extends IBaseMessage {
|
|
16
|
-
type: "transcode";
|
|
17
|
-
format: number;
|
|
18
|
-
needZstd: boolean;
|
|
19
|
-
data: EncodedData[][];
|
|
20
|
-
}
|
|
21
|
-
export type IMessage = IInitMessage | ITranscodeMessage;
|
|
22
|
-
export type TranscodeResult = {
|
|
23
|
-
data: Array<{
|
|
24
|
-
data: Uint8Array;
|
|
25
|
-
width: number;
|
|
26
|
-
height: number;
|
|
27
|
-
}>;
|
|
28
|
-
};
|
|
29
|
-
export type TranscodeResponse = {
|
|
30
|
-
id: number;
|
|
31
|
-
type: "transcoded";
|
|
32
|
-
} & TranscodeResult;
|
|
33
|
-
export declare function TranscodeWorkerCode(): void;
|
|
34
|
-
export {};
|
package/types/ktx2/zstddec.d.ts
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
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
|
-
*/
|