@galacean/engine-loader 0.9.0-beta.82 → 0.9.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.
@@ -1,52 +0,0 @@
1
- import { EngineObject } from "@galacean/engine-core";
2
- import { GLTFExtensionOwnerSchema } from "../GLTFSchema";
3
- import { GLTFParserContext } from "../parser/GLTFParserContext";
4
- import { GLTFExtensionSchema } from "./GLTFExtensionSchema";
5
- /**
6
- * Base class of glTF extension parser.
7
- */
8
- export declare abstract class GLTFExtensionParser {
9
- /**
10
- * @internal
11
- * The extension mode.
12
- */
13
- _mode: GLTFExtensionMode;
14
- /**
15
- * Initialize the parser.
16
- * @remarks Some plugins require initialization.
17
- * @returns The void or promise
18
- */
19
- initialize(): void | Promise<void>;
20
- /**
21
- * Create and parse the resource.
22
- * @remarks This method overrides the default resource creation.
23
- * @param context - The parser context
24
- * @param extensionSchema - The extension schema
25
- * @param extensionOwnerSchema - The extension owner schema
26
- * @returns The resource or promise
27
- */
28
- createAndParse(context: GLTFParserContext, extensionSchema: GLTFExtensionSchema, extensionOwnerSchema: GLTFExtensionOwnerSchema, ...extra: any[]): EngineObject | Promise<EngineObject>;
29
- /**
30
- * Additive parse to the resource.
31
- * @param context - The parser context
32
- * @param parseResource - The parsed resource
33
- * @param extensionSchema - The extension schema
34
- * @param extensionOwnerSchema - The extension owner schema
35
- * @returns The void or promise
36
- */
37
- additiveParse(context: GLTFParserContext, parseResource: EngineObject, extensionSchema: GLTFExtensionSchema, extensionOwnerSchema: GLTFExtensionOwnerSchema, ...extra: any[]): void | Promise<void>;
38
- }
39
- /**
40
- * glTF Extension mode.
41
- */
42
- export declare enum GLTFExtensionMode {
43
- /**
44
- * Cerate instance and parse mode.
45
- * @remarks
46
- * If the glTF property has multiple extensions of `CreateAndParse` mode, only execute the last one.
47
- * If this method is registered, the default pipeline processing will be ignored.
48
- */
49
- CreateAndParse = 0,
50
- /** Additive parse mode. */
51
- AdditiveParse = 1
52
- }
@@ -1,149 +0,0 @@
1
- import { IMaterialNormalTextureInfo, ITextureInfo } from "../GLTFSchema";
2
- /**
3
- * Interfaces from the KHR_lights_punctual extension
4
- */
5
- export interface IKHRLightsPunctual_LightNode {
6
- light: number;
7
- }
8
- export interface IKHRLightsPunctual_Light {
9
- type: "directional" | "point" | "spot";
10
- color?: number[];
11
- intensity?: number;
12
- range?: number;
13
- spot?: {
14
- innerConeAngle?: number;
15
- outerConeAngle?: number;
16
- };
17
- }
18
- export interface IKHRLightsPunctual {
19
- lights: IKHRLightsPunctual_Light[];
20
- }
21
- /**
22
- * Interfaces from the KHR_draco_mesh_compression extension
23
- */
24
- export interface IKHRDracoMeshCompression {
25
- bufferView: number;
26
- attributes: {
27
- [name: string]: number;
28
- };
29
- }
30
- /**
31
- * Interfaces from the KHR_materials_clearcoat extension
32
- */
33
- export interface IKHRMaterialsClearcoat {
34
- clearcoatFactor: number;
35
- clearcoatTexture: ITextureInfo;
36
- clearcoatRoughnessFactor: number;
37
- clearcoatRoughnessTexture: ITextureInfo;
38
- clearcoatNormalTexture: IMaterialNormalTextureInfo;
39
- }
40
- /**
41
- * Interfaces from the KHR_materials_ior extension
42
- */
43
- export interface IKHRMaterialsIor {
44
- ior: number;
45
- }
46
- /**
47
- * Interfaces from the KHR_materials_unlit extension
48
- */
49
- export interface IKHRMaterialsUnlit {
50
- }
51
- /**
52
- * Interfaces from the KHR_materials_pbrSpecularGlossiness extension
53
- */
54
- export interface IKHRMaterialsPbrSpecularGlossiness {
55
- diffuseFactor: number[];
56
- diffuseTexture: ITextureInfo;
57
- specularFactor: number[];
58
- glossinessFactor: number;
59
- specularGlossinessTexture: ITextureInfo;
60
- }
61
- /**
62
- * Interfaces from the KHR_materials_sheen extension
63
- */
64
- export interface IKHRMaterialsSheen {
65
- sheenColorFactor?: number[];
66
- sheenColorTexture?: ITextureInfo;
67
- sheenRoughnessFactor?: number;
68
- sheenRoughnessTexture?: ITextureInfo;
69
- }
70
- /**
71
- * Interfaces from the KHR_materials_specular extension
72
- */
73
- export interface IKHRMaterialsSpecular {
74
- specularFactor: number;
75
- specularColorFactor: number[];
76
- specularTexture: ITextureInfo;
77
- }
78
- /**
79
- * Interfaces from the KHR_materials_transmission extension
80
- */
81
- export interface IKHRMaterialsTransmission {
82
- transmissionFactor?: number;
83
- transmissionTexture?: ITextureInfo;
84
- }
85
- /**
86
- * Interfaces from the KHR_materials_translucency extension
87
- */
88
- export interface IKHRMaterialsTranslucency {
89
- translucencyFactor?: number;
90
- translucencyTexture?: ITextureInfo;
91
- }
92
- /**
93
- * Interfaces from the KHR_materials_variants extension
94
- */
95
- export interface IKHRMaterialVariants_Mapping {
96
- mappings: Array<{
97
- variants: number[];
98
- material: number;
99
- }>;
100
- extensions?: any;
101
- extras?: any;
102
- }
103
- export interface IKHRMaterialVariants_Variant {
104
- name: string;
105
- extensions?: any;
106
- extras?: any;
107
- }
108
- export interface IKHRMaterialVariants_Variants {
109
- variants: Array<IKHRMaterialVariants_Variant>;
110
- }
111
- /**
112
- * Interfaces from the KHR_texture_basisu extension
113
- */
114
- export interface IKHRTextureBasisU {
115
- source: number;
116
- }
117
- /**
118
- * Interfaces from the KHR_texture_transform extension
119
- */
120
- export interface IKHRTextureTransform {
121
- offset?: number[];
122
- rotation?: number;
123
- scale?: number[];
124
- texCoord?: number;
125
- }
126
- /**
127
- * Interfaces from the KHR_xmp extension
128
- */
129
- export interface IKHRXmp {
130
- packets: Array<{
131
- [key: string]: unknown;
132
- }>;
133
- }
134
- export interface IKHRXmp_Node {
135
- packet: number;
136
- }
137
- export interface IGalaceanMaterialRemap {
138
- refId: string;
139
- key?: string;
140
- isClone?: boolean;
141
- }
142
- export interface IOasisAnimation {
143
- events: {
144
- time: number;
145
- functionName: string;
146
- parameter: any;
147
- }[];
148
- }
149
- export type GLTFExtensionSchema = IKHRLightsPunctual_Light | IKHRDracoMeshCompression | IKHRMaterialsClearcoat | IKHRMaterialsIor | IKHRMaterialsUnlit | IKHRMaterialsPbrSpecularGlossiness | IKHRMaterialsSheen | IKHRMaterialsSpecular | IKHRMaterialsTransmission | IKHRMaterialsTranslucency | IKHRMaterialVariants_Mapping | IKHRMaterialVariants_Variants | IKHRTextureBasisU | IKHRTextureTransform | IKHRXmp | IKHRXmp_Node | IOasisAnimation | Object;
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,6 +0,0 @@
1
- export { GLTFPipeline } from "./GLTFPipeline";
2
- export { GLTFResource } from "./GLTFResource";
3
- export { GLTFUtil } from "./GLTFUtil";
4
- export * from "./parser";
5
- export * from "./extensions/index";
6
- export type { IMaterial, IMeshPrimitive, ITextureInfo, INode, GLTFExtensionOwnerSchema } from "./GLTFSchema";
@@ -1,12 +0,0 @@
1
- import { AnimationClip, AssetPromise } from "@galacean/engine-core";
2
- import { IAnimation } from "../GLTFSchema";
3
- import { GLTFParser } from "./GLTFParser";
4
- import { GLTFParserContext } from "./GLTFParserContext";
5
- export declare class GLTFAnimationParser extends GLTFParser {
6
- /**
7
- * @internal
8
- */
9
- static _parseStandardProperty(context: GLTFParserContext, animationClip: AnimationClip, animationInfo: IAnimation): void;
10
- private static _addCurve;
11
- parse(context: GLTFParserContext): AssetPromise<AnimationClip[]>;
12
- }
@@ -1,7 +0,0 @@
1
- import { AssetPromise } from "@galacean/engine-core";
2
- import { GLTFParser } from "./GLTFParser";
3
- import { GLTFParserContext } from "./GLTFParserContext";
4
- export declare class GLTFBufferParser extends GLTFParser {
5
- parse(context: GLTFParserContext): AssetPromise<void>;
6
- private _isGLB;
7
- }
@@ -1,9 +0,0 @@
1
- import { GLTFParser } from "./GLTFParser";
2
- import { GLTFParserContext } from "./GLTFParserContext";
3
- export declare class GLTFEntityParser extends GLTFParser {
4
- /** @internal */
5
- static _defaultName: String;
6
- parse(context: GLTFParserContext): void;
7
- private _buildEntityTree;
8
- private _createSceneRoots;
9
- }
@@ -1,15 +0,0 @@
1
- import { AssetPromise, Material, PBRMaterial, PBRSpecularMaterial, UnlitMaterial } from "@galacean/engine-core";
2
- import { IMaterial, ITextureInfo } from "../GLTFSchema";
3
- import { GLTFParser } from "./GLTFParser";
4
- import { GLTFParserContext } from "./GLTFParserContext";
5
- export declare class GLTFMaterialParser extends GLTFParser {
6
- /**
7
- * @internal
8
- */
9
- static _checkOtherTextureTransform(texture: ITextureInfo, textureName: string): void;
10
- /**
11
- * @internal
12
- */
13
- static _parseStandardProperty(context: GLTFParserContext, material: UnlitMaterial | PBRMaterial | PBRSpecularMaterial, materialInfo: IMaterial): void;
14
- parse(context: GLTFParserContext): AssetPromise<Material[]>;
15
- }
@@ -1,19 +0,0 @@
1
- import { AssetPromise, ModelMesh, TypedArray } from "@galacean/engine-core";
2
- import { ModelMeshRestoreInfo } from "../../GLTFContentRestorer";
3
- import { IGLTF, IMesh, IMeshPrimitive } from "../GLTFSchema";
4
- import { GLTFParser } from "./GLTFParser";
5
- import { BufferInfo, GLTFParserContext } from "./GLTFParserContext";
6
- export declare class GLTFMeshParser extends GLTFParser {
7
- private static _tempVector3;
8
- /**
9
- * @internal
10
- */
11
- static _parseMeshFromGLTFPrimitive(context: GLTFParserContext, mesh: ModelMesh, meshRestoreInfo: ModelMeshRestoreInfo, gltfMesh: IMesh, gltfPrimitive: IMeshPrimitive, gltf: IGLTF, getVertexBufferData: (semantic: string) => TypedArray, getBlendShapeData: (semantic: string, shapeIndex: number) => BufferInfo, getIndexBufferData: () => TypedArray, keepMeshData: boolean): Promise<ModelMesh>;
12
- /**
13
- * @internal
14
- */
15
- static _createBlendShape(mesh: ModelMesh, meshRestoreInfo: ModelMeshRestoreInfo, glTFMesh: IMesh, glTFTargets: {
16
- [name: string]: number;
17
- }[], getBlendShapeData: (semantic: string, shapeIndex: number) => BufferInfo): void;
18
- parse(context: GLTFParserContext): AssetPromise<ModelMesh[][]>;
19
- }
@@ -1,63 +0,0 @@
1
- import { AnimationClip, AssetPromise, EngineObject, Material, Mesh } from "@galacean/engine-core";
2
- import { GLTFExtensionMode, GLTFExtensionParser } from "../extensions/GLTFExtensionParser";
3
- import { GLTFExtensionOwnerSchema } from "../GLTFSchema";
4
- import { GLTFParserContext } from "./GLTFParserContext";
5
- /**
6
- * Base class of glTF parser.
7
- */
8
- export declare abstract class GLTFParser {
9
- private static readonly _extensionParsers;
10
- /**
11
- * Execute all parses of extension to initialize plugin.
12
- * @remarks Some plugins require initialization.
13
- * @returns The void or promise
14
- */
15
- static executeExtensionsInitialize(extensionName: string): void | Promise<void>;
16
- /**
17
- * Execute all parses of extension to create resource.
18
- * @param extensions - Related extensions field
19
- * @param context - The parser context
20
- * @param ownerSchema - The extension owner schema
21
- * @param extra - Extra params
22
- * @returns
23
- */
24
- static executeExtensionsCreateAndParse(extensions: {
25
- [key: string]: any;
26
- }, context: GLTFParserContext, ownerSchema: GLTFExtensionOwnerSchema, ...extra: any[]): EngineObject | void | Promise<EngineObject | void>;
27
- /**
28
- * Execute all parses of extension to parse resource.
29
- * @param extensions - Related extensions field
30
- * @param context - The parser context
31
- * @param parseResource - The parsed resource
32
- * @param ownerSchema - The extension owner schema
33
- * @param extra - Extra params
34
- */
35
- static executeExtensionsAdditiveAndParse(extensions: {
36
- [key: string]: any;
37
- }, context: GLTFParserContext, parseResource: EngineObject, ownerSchema: GLTFExtensionOwnerSchema, ...extra: any[]): void;
38
- /**
39
- * Whether the plugin is registered.
40
- * @param extensionName - Extension name
41
- * @returns Boolean
42
- */
43
- static hasExtensionParser(extensionName: string): boolean;
44
- /**
45
- * Get the last plugin by glTF extension mode.
46
- * @param extensionName - Extension name
47
- * @param mode - GLTF extension mode
48
- * @returns GLTF extension parser
49
- */
50
- static getExtensionParser(extensionName: string, mode: GLTFExtensionMode): GLTFExtensionParser | undefined;
51
- /**
52
- * @internal
53
- */
54
- static _addExtensionParser(extensionName: string, extensionParser: GLTFExtensionParser): void;
55
- private static _createAndParse;
56
- private static _additiveParse;
57
- abstract parse(context: GLTFParserContext): AssetPromise<any> | void | Material | AnimationClip | Mesh;
58
- }
59
- /**
60
- * Declare ExtensionParser's decorator.
61
- * @param extensionName - Extension name
62
- */
63
- export declare function registerGLTFExtension(extensionName: string, mode: GLTFExtensionMode): (parser: new () => GLTFExtensionParser) => void;
@@ -1,48 +0,0 @@
1
- import { AnimationClip, AssetPromise, Buffer, Entity, Material, ModelMesh, Texture2D, TypedArray } from "@galacean/engine-core";
2
- import { BufferDataRestoreInfo, GLTFContentRestorer } from "../../GLTFContentRestorer";
3
- import { GLTFResource } from "../GLTFResource";
4
- import { IGLTF } from "../GLTFSchema";
5
- /**
6
- * @internal
7
- */
8
- export declare class GLTFParserContext {
9
- glTF: IGLTF;
10
- buffers: ArrayBuffer[];
11
- glTFResource: GLTFResource;
12
- keepMeshData: boolean;
13
- hasSkinned: boolean;
14
- chainPromises: AssetPromise<any>[];
15
- accessorBufferCache: Record<string, BufferInfo>;
16
- texturesPromiseInfo: PromiseInfo<Texture2D[]>;
17
- materialsPromiseInfo: PromiseInfo<Material[]>;
18
- meshesPromiseInfo: PromiseInfo<ModelMesh[][]>;
19
- animationClipsPromiseInfo: PromiseInfo<AnimationClip[]>;
20
- defaultSceneRootPromiseInfo: PromiseInfo<Entity>;
21
- masterPromiseInfo: PromiseInfo<GLTFResource>;
22
- promiseMap: Record<string, AssetPromise<any>>;
23
- contentRestorer: GLTFContentRestorer;
24
- constructor(url: string);
25
- private _initPromiseInfo;
26
- }
27
- /**
28
- * @internal
29
- */
30
- export declare class BufferInfo {
31
- data: TypedArray;
32
- interleaved: boolean;
33
- stride: number;
34
- vertexBuffer: Buffer;
35
- vertexBindingInfos: Record<number, number>;
36
- restoreInfo: BufferDataRestoreInfo;
37
- constructor(data: TypedArray, interleaved: boolean, stride: number);
38
- }
39
- /**
40
- * @internal
41
- */
42
- export declare class PromiseInfo<T> {
43
- promise: AssetPromise<T>;
44
- resolve: (value?: T | PromiseLike<T>) => void;
45
- reject: (reason?: any) => void;
46
- setProgress: (progress: number) => void;
47
- onCancel: (callback: () => void) => void;
48
- }
@@ -1,11 +0,0 @@
1
- import { Entity } from "@galacean/engine-core";
2
- import { GLTFParser } from "./GLTFParser";
3
- import { GLTFParserContext } from "./GLTFParserContext";
4
- export declare class GLTFSceneParser extends GLTFParser {
5
- private static _defaultMaterial;
6
- private static _getDefaultMaterial;
7
- parse(context: GLTFParserContext): import("@galacean/engine-core").AssetPromise<Entity>;
8
- private _createCamera;
9
- private _createRenderer;
10
- private _createAnimator;
11
- }
@@ -1,6 +0,0 @@
1
- import { GLTFParserContext } from ".";
2
- import { GLTFParser } from "./GLTFParser";
3
- export declare class GLTFSkinParser extends GLTFParser {
4
- parse(context: GLTFParserContext): void;
5
- private _findSkeletonRootBone;
6
- }
@@ -1,8 +0,0 @@
1
- import { AssetPromise, Texture2D } from "@galacean/engine-core";
2
- import { GLTFParser } from "./GLTFParser";
3
- import { GLTFParserContext } from ".";
4
- export declare class GLTFTextureParser extends GLTFParser {
5
- private static _wrapMap;
6
- parse(context: GLTFParserContext): AssetPromise<Texture2D[]>;
7
- private _parseSampler;
8
- }
@@ -1,6 +0,0 @@
1
- import { AssetPromise } from "@galacean/engine-core";
2
- import { GLTFParser } from "./GLTFParser";
3
- import { GLTFParserContext } from "./GLTFParserContext";
4
- export declare class GLTFValidator extends GLTFParser {
5
- parse(context: GLTFParserContext): AssetPromise<void>;
6
- }
@@ -1,11 +0,0 @@
1
- export { GLTFAnimationParser } from "./GLTFAnimationParser";
2
- export { GLTFBufferParser } from "./GLTFBufferParser";
3
- export { GLTFEntityParser } from "./GLTFEntityParser";
4
- export { GLTFMaterialParser } from "./GLTFMaterialParser";
5
- export { GLTFMeshParser } from "./GLTFMeshParser";
6
- export { GLTFParser, registerGLTFExtension } from "./GLTFParser";
7
- export { GLTFSceneParser } from "./GLTFSceneParser";
8
- export { GLTFSkinParser } from "./GLTFSkinParser";
9
- export { GLTFTextureParser } from "./GLTFTextureParser";
10
- export { GLTFValidator } from "./GLTFValidator";
11
- export { GLTFParserContext } from "./GLTFParserContext";