@galacean/engine-loader 1.0.0-beta.9 → 1.0.1
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 +534 -411
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +534 -411
- package/dist/module.js +536 -413
- package/dist/module.js.map +1 -1
- package/package.json +5 -5
- package/types/GLTFContentRestorer.d.ts +18 -8
- package/types/ProjectLoader.d.ts +1 -0
- package/types/gltf/GLTFResource.d.ts +2 -6
- package/types/gltf/GLTFUtil.d.ts +3 -3
- package/types/gltf/GLTFUtils.d.ts +3 -2
- package/types/gltf/extensions/GLTFExtensionSchema.d.ts +1 -1
- package/types/gltf/parser/GLTFAnimationParser.d.ts +2 -2
- package/types/gltf/parser/GLTFMeshParser.d.ts +5 -5
- package/types/gltf/parser/GLTFParser.d.ts +1 -1
- package/types/gltf/parser/GLTFParserContext.d.ts +7 -2
- package/types/gltf/parser/GLTFSceneParser.d.ts +2 -2
- package/types/gltf/parser/GLTFSchemaParser.d.ts +7 -0
- package/types/gltf/parser/GLTFSkinParser.d.ts +2 -1
- package/types/gltf/parser/GLTFTextureParser.d.ts +3 -2
- 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 +2 -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/index.d.ts +3 -3
- package/types/resource-deserialize/resources/mesh/MeshDecoder.d.ts +1 -1
- package/types/resource-deserialize/resources/parser/PrefabParser.d.ts +5 -0
- package/types/resource-deserialize/resources/parser/ReflectionParser.d.ts +14 -0
- package/types/resource-deserialize/resources/prefab/PrefabDesign.d.ts +4 -4
- package/types/resource-deserialize/resources/scene/SceneParser.d.ts +1 -1
- package/types/resource-deserialize/resources/scene/SceneParserContext.d.ts +1 -1
- package/types/resource-deserialize/resources/schema/BasicSchema.d.ts +61 -0
- package/types/resource-deserialize/resources/schema/MaterialSchema.d.ts +91 -0
- package/types/resource-deserialize/resources/schema/ProjectSchema.d.ts +9 -0
- package/types/resource-deserialize/resources/schema/SceneSchema.d.ts +41 -0
- package/types/resource-deserialize/resources/schema/index.d.ts +3 -0
|
@@ -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
|
+
*/
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Engine } from "@galacean/engine-core";
|
|
2
2
|
export { MeshDecoder } from "./resources/mesh/MeshDecoder";
|
|
3
3
|
export { Texture2DDecoder } from "./resources/texture2D/TextureDecoder";
|
|
4
|
-
export { ReflectionParser } from "./resources/
|
|
5
|
-
export { PrefabParser } from "./resources/
|
|
4
|
+
export { ReflectionParser } from "./resources/parser/ReflectionParser";
|
|
5
|
+
export { PrefabParser } from "./resources/parser/PrefabParser";
|
|
6
6
|
export * from "./resources/animationClip/AnimationClipDecoder";
|
|
7
7
|
export type { IModelMesh } from "./resources/mesh/IModelMesh";
|
|
8
8
|
/**
|
|
@@ -12,7 +12,7 @@ export type { IModelMesh } from "./resources/mesh/IModelMesh";
|
|
|
12
12
|
* @returns
|
|
13
13
|
*/
|
|
14
14
|
export declare function decode<T>(arrayBuffer: ArrayBuffer, engine: Engine): Promise<T>;
|
|
15
|
-
export * from "./resources/
|
|
15
|
+
export * from "./resources/schema";
|
|
16
16
|
export * from "./resources/scene/SceneParser";
|
|
17
17
|
export * from "./resources/scene/MeshLoader";
|
|
18
18
|
export * from "./resources/scene/EditorTextureLoader";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Engine, Entity } from "@galacean/engine-core";
|
|
2
|
+
import type { IBasicType, IClassObject, IEntity } from "../schema";
|
|
3
|
+
export declare class ReflectionParser {
|
|
4
|
+
static customParseComponentHandles: Map<string, Function>;
|
|
5
|
+
static registerCustomParseComponent(componentType: string, handle: Function): void;
|
|
6
|
+
static parseEntity(entityConfig: IEntity, engine: Engine): Promise<Entity>;
|
|
7
|
+
private static getEntityByConfig;
|
|
8
|
+
static parseClassObject(item: IClassObject, engine: Engine, resourceManager?: any): Promise<any>;
|
|
9
|
+
static parseBasicType(value: IBasicType, engine: Engine, resourceManager?: any): Promise<any>;
|
|
10
|
+
static parsePropsAndMethods(instance: any, item: Omit<IClassObject, "class">, engine: Engine, resourceManager?: any): Promise<any>;
|
|
11
|
+
static parseMethod(instance: any, methodName: string, methodParams: Array<IBasicType>, engine: Engine, resourceManager?: any): Promise<any>;
|
|
12
|
+
private static _isClass;
|
|
13
|
+
private static _isRef;
|
|
14
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BackgroundMode } from "@galacean/engine-core";
|
|
2
|
-
import {
|
|
2
|
+
import { IRefObject } from "@galacean/engine-core/types/asset/IRefObject";
|
|
3
3
|
import { IColor } from "../mesh/IModelMesh";
|
|
4
4
|
export interface IPrefabFile {
|
|
5
5
|
entities: Array<IEntity>;
|
|
@@ -9,11 +9,11 @@ export interface IScene extends IPrefabFile {
|
|
|
9
9
|
background: {
|
|
10
10
|
mode: BackgroundMode;
|
|
11
11
|
color: IColor;
|
|
12
|
-
texture?:
|
|
13
|
-
sky?:
|
|
12
|
+
texture?: IRefObject;
|
|
13
|
+
sky?: IRefObject;
|
|
14
14
|
};
|
|
15
15
|
ambient: {
|
|
16
|
-
ambientLight:
|
|
16
|
+
ambientLight: IRefObject;
|
|
17
17
|
diffuseSolidColor: IColor;
|
|
18
18
|
diffuseIntensity: number;
|
|
19
19
|
specularIntensity: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Component, Entity, Scene } from "@galacean/engine-core";
|
|
2
|
-
import { IEntity, IScene } from "../
|
|
2
|
+
import type { IEntity, IScene } from "../schema";
|
|
3
3
|
export declare class SceneParserContext {
|
|
4
4
|
readonly originalData: IScene;
|
|
5
5
|
readonly scene: Scene;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export interface IVector3 {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
z: number;
|
|
5
|
+
}
|
|
6
|
+
export interface IVector2 {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
}
|
|
10
|
+
export interface IVector4 {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
z: number;
|
|
14
|
+
w: number;
|
|
15
|
+
}
|
|
16
|
+
export interface IColor {
|
|
17
|
+
r: number;
|
|
18
|
+
g: number;
|
|
19
|
+
b: number;
|
|
20
|
+
a: number;
|
|
21
|
+
}
|
|
22
|
+
export interface IPrefabFile {
|
|
23
|
+
entities: Array<IEntity>;
|
|
24
|
+
}
|
|
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
|
+
export interface IBasicEntity {
|
|
42
|
+
name?: string;
|
|
43
|
+
id?: string;
|
|
44
|
+
components?: Array<IComponent>;
|
|
45
|
+
isActive?: boolean;
|
|
46
|
+
position?: IVector3;
|
|
47
|
+
rotation?: IVector3;
|
|
48
|
+
scale?: IVector3;
|
|
49
|
+
children?: Array<string>;
|
|
50
|
+
parent?: string;
|
|
51
|
+
}
|
|
52
|
+
export type IEntity = IBasicEntity | IRefEntity;
|
|
53
|
+
export interface IRefEntity extends IBasicEntity {
|
|
54
|
+
assetRefId: string;
|
|
55
|
+
key?: string;
|
|
56
|
+
isClone?: boolean;
|
|
57
|
+
}
|
|
58
|
+
export type IComponent = {
|
|
59
|
+
id: string;
|
|
60
|
+
refId?: string;
|
|
61
|
+
} & IClassObject;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { BlendFactor, BlendOperation, ColorWriteMask, CompareFunction, CullMode, RenderQueueType, StencilOperation } from "@galacean/engine-core";
|
|
2
|
+
import type { IAssetRef, IColor, IVector2, IVector3 } from "./BasicSchema";
|
|
3
|
+
export interface IRenderState {
|
|
4
|
+
/** Blend state. */
|
|
5
|
+
blendState: {
|
|
6
|
+
/** The blend state of the render target. */
|
|
7
|
+
targetBlendState: {
|
|
8
|
+
/** Whether to enable blend. */
|
|
9
|
+
enabled: boolean;
|
|
10
|
+
/** color (RGB) blend operation. */
|
|
11
|
+
colorBlendOperation: BlendOperation;
|
|
12
|
+
/** alpha (A) blend operation. */
|
|
13
|
+
alphaBlendOperation: BlendOperation;
|
|
14
|
+
/** color blend factor (RGB) for source. */
|
|
15
|
+
sourceColorBlendFactor: BlendFactor;
|
|
16
|
+
/** alpha blend factor (A) for source. */
|
|
17
|
+
sourceAlphaBlendFactor: BlendFactor;
|
|
18
|
+
/** color blend factor (RGB) for destination. */
|
|
19
|
+
destinationColorBlendFactor: BlendFactor;
|
|
20
|
+
/** alpha blend factor (A) for destination. */
|
|
21
|
+
destinationAlphaBlendFactor: BlendFactor;
|
|
22
|
+
/** color mask. */
|
|
23
|
+
colorWriteMask: ColorWriteMask;
|
|
24
|
+
};
|
|
25
|
+
blendColor: IColor;
|
|
26
|
+
/** Whether to use (Alpha-to-Coverage) technology. */
|
|
27
|
+
alphaToCoverage: boolean;
|
|
28
|
+
};
|
|
29
|
+
/** Depth state. */
|
|
30
|
+
depthState: {
|
|
31
|
+
/** Whether to enable the depth test. */
|
|
32
|
+
enabled: boolean;
|
|
33
|
+
/** Whether the depth value can be written.*/
|
|
34
|
+
writeEnabled: boolean;
|
|
35
|
+
/** Depth comparison function. */
|
|
36
|
+
compareFunction: CompareFunction;
|
|
37
|
+
};
|
|
38
|
+
/** Stencil state. */
|
|
39
|
+
stencilState: {
|
|
40
|
+
/** Whether to enable stencil test. */
|
|
41
|
+
enabled: boolean;
|
|
42
|
+
/** Write the reference value of the stencil buffer. */
|
|
43
|
+
referenceValue: number;
|
|
44
|
+
/** Specifying a bit-wise mask that is used to AND the reference value and the stored stencil value when the test is done. */
|
|
45
|
+
mask: number;
|
|
46
|
+
/** Specifying a bit mask to enable or disable writing of individual bits in the stencil planes. */
|
|
47
|
+
writeMask: number;
|
|
48
|
+
/** The comparison function of the reference value of the front face of the geometry and the current buffer storage value. */
|
|
49
|
+
compareFunctionFront: CompareFunction;
|
|
50
|
+
/** The comparison function of the reference value of the back of the geometry and the current buffer storage value. */
|
|
51
|
+
compareFunctionBack: CompareFunction;
|
|
52
|
+
/** specifying the function to use for front face when both the stencil test and the depth test pass. */
|
|
53
|
+
passOperationFront: StencilOperation;
|
|
54
|
+
/** specifying the function to use for back face when both the stencil test and the depth test pass. */
|
|
55
|
+
passOperationBack: StencilOperation;
|
|
56
|
+
/** specifying the function to use for front face when the stencil test fails. */
|
|
57
|
+
failOperationFront: StencilOperation;
|
|
58
|
+
/** specifying the function to use for back face when the stencil test fails. */
|
|
59
|
+
failOperationBack: StencilOperation;
|
|
60
|
+
/** specifying the function to use for front face when the stencil test passes, but the depth test fails. */
|
|
61
|
+
zFailOperationFront: StencilOperation;
|
|
62
|
+
/** specifying the function to use for back face when the stencil test passes, but the depth test fails. */
|
|
63
|
+
zFailOperationBack: StencilOperation;
|
|
64
|
+
};
|
|
65
|
+
/** Raster state. */
|
|
66
|
+
rasterState: {
|
|
67
|
+
/** Specifies whether or not front- and/or back-facing polygons can be culled. */
|
|
68
|
+
cullMode: CullMode;
|
|
69
|
+
/** The multiplier by which an implementation-specific value is multiplied with to create a constant depth offset. */
|
|
70
|
+
depthBias: number;
|
|
71
|
+
/** The scale factor for the variable depth offset for each polygon. */
|
|
72
|
+
slopeScaledDepthBias: number;
|
|
73
|
+
};
|
|
74
|
+
/** Render queue type. */
|
|
75
|
+
renderQueueType: RenderQueueType;
|
|
76
|
+
}
|
|
77
|
+
export interface IMaterialSchema {
|
|
78
|
+
name: string;
|
|
79
|
+
shader: string;
|
|
80
|
+
shaderData: {
|
|
81
|
+
[key: string]: {
|
|
82
|
+
type: "Vector2" | "Vector3" | "Vector4" | "Color" | "Float" | "Texture";
|
|
83
|
+
value: IVector3 | IVector2 | IColor | number | IAssetRef;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
macros: Array<{
|
|
87
|
+
name: string;
|
|
88
|
+
value?: string;
|
|
89
|
+
}>;
|
|
90
|
+
renderState: IRenderState;
|
|
91
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { BackgroundMode, DiffuseMode, ShadowCascadesMode, ShadowResolution } from "@galacean/engine-core";
|
|
2
|
+
import type { IReferable } from "@galacean/engine-core/types/asset/IReferable";
|
|
3
|
+
import type { IColor, IPrefabFile } from "./BasicSchema";
|
|
4
|
+
export declare enum SpecularMode {
|
|
5
|
+
Sky = "Sky",
|
|
6
|
+
Custom = "Custom"
|
|
7
|
+
}
|
|
8
|
+
export interface IScene extends IPrefabFile {
|
|
9
|
+
scene: {
|
|
10
|
+
background: {
|
|
11
|
+
mode: BackgroundMode;
|
|
12
|
+
color: IColor;
|
|
13
|
+
texture?: IReferable;
|
|
14
|
+
skyMesh?: IReferable;
|
|
15
|
+
skyMaterial?: IReferable;
|
|
16
|
+
};
|
|
17
|
+
ambient: {
|
|
18
|
+
diffuseMode: DiffuseMode;
|
|
19
|
+
ambientLight: IReferable;
|
|
20
|
+
customAmbientLight: IReferable;
|
|
21
|
+
customSpecularTexture: IReferable;
|
|
22
|
+
diffuseSolidColor: IColor;
|
|
23
|
+
diffuseIntensity: number;
|
|
24
|
+
specularIntensity: number;
|
|
25
|
+
specularMode: SpecularMode;
|
|
26
|
+
bakerResolution: number;
|
|
27
|
+
};
|
|
28
|
+
shadow?: {
|
|
29
|
+
castShadows: boolean;
|
|
30
|
+
shadowResolution: ShadowResolution;
|
|
31
|
+
shadowDistance: number;
|
|
32
|
+
shadowCascades: ShadowCascadesMode;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
files: Array<{
|
|
36
|
+
id: string;
|
|
37
|
+
type: string;
|
|
38
|
+
virtualPath: string;
|
|
39
|
+
path: string;
|
|
40
|
+
}>;
|
|
41
|
+
}
|