@galacean/engine-loader 1.6.8 → 1.6.9

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 (107) hide show
  1. package/dist/main.js +7355 -0
  2. package/dist/main.js.map +1 -0
  3. package/dist/module.js +7325 -0
  4. package/dist/module.js.map +1 -0
  5. package/package.json +4 -4
  6. package/types/AnimationClipLoader.d.ts +1 -0
  7. package/types/AnimatorControllerLoader.d.ts +1 -0
  8. package/types/AudioLoader.d.ts +1 -0
  9. package/types/BufferLoader.d.ts +1 -0
  10. package/types/EnvLoader.d.ts +1 -0
  11. package/types/FontLoader.d.ts +1 -0
  12. package/types/GLTFContentRestorer.d.ts +92 -0
  13. package/types/GLTFLoader.d.ts +22 -0
  14. package/types/HDRLoader.d.ts +1 -0
  15. package/types/JSONLoader.d.ts +1 -0
  16. package/types/KTXCubeLoader.d.ts +1 -0
  17. package/types/KTXLoader.d.ts +4 -0
  18. package/types/MaterialLoader.d.ts +1 -0
  19. package/types/MeshLoader.d.ts +1 -0
  20. package/types/PhysicsMaterialLoader.d.ts +1 -0
  21. package/types/PrefabLoader.d.ts +5 -0
  22. package/types/PrimitiveMeshLoader.d.ts +1 -0
  23. package/types/ProjectLoader.d.ts +1 -0
  24. package/types/SceneLoader.d.ts +1 -0
  25. package/types/ShaderChunkLoader.d.ts +9 -0
  26. package/types/ShaderLoader.d.ts +1 -0
  27. package/types/SourceFontLoader.d.ts +1 -0
  28. package/types/SpriteAtlasLoader.d.ts +1 -0
  29. package/types/SpriteLoader.d.ts +1 -0
  30. package/types/TextLoader.d.ts +1 -0
  31. package/types/Texture2DContentRestorer.d.ts +10 -0
  32. package/types/Texture2DLoader.d.ts +20 -0
  33. package/types/TextureCubeContentRestorer.d.ts +10 -0
  34. package/types/TextureCubeLoader.d.ts +1 -0
  35. package/types/compressed-texture/KhronosTextureContainer.d.ts +20 -0
  36. package/types/compressed-texture/index.d.ts +3 -0
  37. package/types/compressed-texture/type.d.ts +87 -0
  38. package/types/gltf/GLTFResource.d.ts +67 -0
  39. package/types/gltf/GLTFSchema.d.ts +822 -0
  40. package/types/gltf/GLTFUtils.d.ts +45 -0
  41. package/types/gltf/extensions/EXT_meshopt_compression.d.ts +26 -0
  42. package/types/gltf/extensions/EXT_texture_webp.d.ts +1 -0
  43. package/types/gltf/extensions/GALACEAN_animation_event.d.ts +1 -0
  44. package/types/gltf/extensions/GALACEAN_materials_remap.d.ts +1 -0
  45. package/types/gltf/extensions/GLTFExtensionParser.d.ts +46 -0
  46. package/types/gltf/extensions/GLTFExtensionSchema.d.ts +168 -0
  47. package/types/gltf/extensions/KHR_lights_punctual.d.ts +1 -0
  48. package/types/gltf/extensions/KHR_materials_anisotropy.d.ts +1 -0
  49. package/types/gltf/extensions/KHR_materials_clearcoat.d.ts +1 -0
  50. package/types/gltf/extensions/KHR_materials_ior.d.ts +1 -0
  51. package/types/gltf/extensions/KHR_materials_iridescence.d.ts +1 -0
  52. package/types/gltf/extensions/KHR_materials_sheen.d.ts +1 -0
  53. package/types/gltf/extensions/KHR_materials_specular.d.ts +1 -0
  54. package/types/gltf/extensions/KHR_materials_transmission.d.ts +1 -0
  55. package/types/gltf/extensions/KHR_materials_unlit.d.ts +1 -0
  56. package/types/gltf/extensions/KHR_materials_variants.d.ts +6 -0
  57. package/types/gltf/extensions/KHR_materials_volume.d.ts +1 -0
  58. package/types/gltf/extensions/KHR_mesh_quantization.d.ts +1 -0
  59. package/types/gltf/extensions/KHR_texture_basisu.d.ts +1 -0
  60. package/types/gltf/extensions/KHR_texture_transform.d.ts +1 -0
  61. package/types/gltf/extensions/MeshoptDecoder.d.ts +12 -0
  62. package/types/gltf/extensions/index.d.ts +21 -0
  63. package/types/gltf/index.d.ts +6 -0
  64. package/types/gltf/parser/GLTFAnimationParser.d.ts +12 -0
  65. package/types/gltf/parser/GLTFAnimatorControllerParser.d.ts +7 -0
  66. package/types/gltf/parser/GLTFBufferParser.d.ts +7 -0
  67. package/types/gltf/parser/GLTFBufferViewParser.d.ts +6 -0
  68. package/types/gltf/parser/GLTFEntityParser.d.ts +6 -0
  69. package/types/gltf/parser/GLTFMaterialParser.d.ts +15 -0
  70. package/types/gltf/parser/GLTFMeshParser.d.ts +20 -0
  71. package/types/gltf/parser/GLTFParser.d.ts +57 -0
  72. package/types/gltf/parser/GLTFParserContext.d.ts +74 -0
  73. package/types/gltf/parser/GLTFSceneParser.d.ts +11 -0
  74. package/types/gltf/parser/GLTFSchemaParser.d.ts +6 -0
  75. package/types/gltf/parser/GLTFSkinParser.d.ts +7 -0
  76. package/types/gltf/parser/GLTFTextureParser.d.ts +15 -0
  77. package/types/gltf/parser/GLTFValidator.d.ts +6 -0
  78. package/types/gltf/parser/index.d.ts +14 -0
  79. package/types/index.d.ts +35 -0
  80. package/types/ktx2/KTX2Container.d.ts +81 -0
  81. package/types/ktx2/KTX2Loader.d.ts +55 -0
  82. package/types/ktx2/KTX2TargetFormat.d.ts +27 -0
  83. package/types/ktx2/WorkerPool.d.ts +32 -0
  84. package/types/ktx2/transcoder/AbstractTranscoder.d.ts +55 -0
  85. package/types/ktx2/transcoder/BinomialLLCTranscoder.d.ts +8 -0
  86. package/types/ktx2/transcoder/BinomialLLCWorkerCode.d.ts +6 -0
  87. package/types/prefab/PrefabParser.d.ts +11 -0
  88. package/types/prefab/PrefabResource.d.ts +25 -0
  89. package/types/resource-deserialize/index.d.ts +21 -0
  90. package/types/resource-deserialize/resources/animationClip/AnimationClipDecoder.d.ts +18 -0
  91. package/types/resource-deserialize/resources/mesh/MeshDecoder.d.ts +8 -0
  92. package/types/resource-deserialize/resources/mesh/type.d.ts +31 -0
  93. package/types/resource-deserialize/resources/parser/HierarchyParser.d.ts +43 -0
  94. package/types/resource-deserialize/resources/parser/ParserContext.d.ts +30 -0
  95. package/types/resource-deserialize/resources/parser/ReflectionParser.d.ts +21 -0
  96. package/types/resource-deserialize/resources/scene/EditorTextureLoader.d.ts +4 -0
  97. package/types/resource-deserialize/resources/scene/SceneParser.d.ts +17 -0
  98. package/types/resource-deserialize/resources/schema/BasicSchema.d.ts +97 -0
  99. package/types/resource-deserialize/resources/schema/MaterialSchema.d.ts +102 -0
  100. package/types/resource-deserialize/resources/schema/ProjectSchema.d.ts +9 -0
  101. package/types/resource-deserialize/resources/schema/SceneSchema.d.ts +80 -0
  102. package/types/resource-deserialize/resources/schema/index.d.ts +4 -0
  103. package/types/resource-deserialize/resources/texture2D/TextureDecoder.d.ts +5 -0
  104. package/types/resource-deserialize/utils/BufferReader.d.ts +28 -0
  105. package/types/resource-deserialize/utils/Decorator.d.ts +11 -0
  106. package/types/resource-deserialize/utils/FileHeader.d.ts +9 -0
  107. package/types/resource-deserialize/utils/Utils.d.ts +5 -0
@@ -0,0 +1,45 @@
1
+ import { AssetPromise, IndexFormat, Texture2D, TypedArray, VertexElementFormat } from "@galacean/engine-core";
2
+ import { Color, Vector2, Vector3, Vector4 } from "@galacean/engine-math";
3
+ import { AccessorComponentType, AccessorType, IAccessor, IBufferView, IGLTF, ISampler, ISamplerInfo } from "./GLTFSchema";
4
+ import { BufferInfo, GLTFParserContext } from "./parser/GLTFParserContext";
5
+ /**
6
+ * @internal
7
+ */
8
+ export declare class GLTFUtils {
9
+ static floatBufferToVector2Array(buffer: Float32Array): Vector2[];
10
+ static floatBufferToVector3Array(buffer: Float32Array): Vector3[];
11
+ static floatBufferToVector4Array(buffer: Float32Array): Vector4[];
12
+ static floatBufferToColorArray(buffer: Float32Array, isColor3: boolean): Color[];
13
+ /**
14
+ * Get the number of bytes occupied by accessor type.
15
+ */
16
+ static getAccessorTypeSize(accessorType: AccessorType): number;
17
+ /**
18
+ * Get the TypedArray corresponding to the component type.
19
+ */
20
+ static getComponentType(componentType: AccessorComponentType): Float32ArrayConstructor | Uint32ArrayConstructor | Uint8ArrayConstructor | Uint16ArrayConstructor | Int8ArrayConstructor | Int16ArrayConstructor;
21
+ static getNormalizedComponentScale(componentType: AccessorComponentType): number;
22
+ static getAccessorBuffer(context: GLTFParserContext, bufferViews: IBufferView[], accessor: IAccessor): AssetPromise<BufferInfo>;
23
+ static bufferToVector3Array(buffer: TypedArray, byteOffset: number, count: number, normalized: boolean, componentType: AccessorComponentType): Vector3[];
24
+ static getBufferViewData(bufferView: IBufferView, buffers: ArrayBuffer[]): ArrayBuffer;
25
+ /**
26
+ * Get accessor data.
27
+ */
28
+ static processingSparseData(context: GLTFParserContext, accessor: IAccessor, bufferInfo: BufferInfo): AssetPromise<void>;
29
+ static getIndexFormat(type: AccessorComponentType): IndexFormat;
30
+ static getElementFormat(type: AccessorComponentType, size: number, normalized?: boolean): VertexElementFormat;
31
+ /**
32
+ * Load image buffer
33
+ */
34
+ static loadImageBuffer(imageBuffer: TypedArray, type: string): Promise<HTMLImageElement>;
35
+ /**
36
+ * Parse the glb format.
37
+ */
38
+ static parseGLB(context: GLTFParserContext, originBuffer: ArrayBuffer): {
39
+ glTF?: IGLTF;
40
+ buffers?: ArrayBuffer[];
41
+ originBuffer?: ArrayBuffer;
42
+ };
43
+ static parseSampler(texture: Texture2D, samplerInfo: ISamplerInfo): void;
44
+ static getSamplerInfo(sampler: ISampler): ISamplerInfo;
45
+ }
@@ -0,0 +1,26 @@
1
+ declare module "@galacean/engine-core" {
2
+ interface EngineConfiguration {
3
+ glTFLoader?: {
4
+ /** Meshopt options. If set this option and workCount is great than 0, workers will be created. */
5
+ meshOpt?: {
6
+ /**
7
+ * Worker count for transcoder.
8
+ * @defaultValue 4
9
+ */
10
+ workerCount?: number;
11
+ };
12
+ };
13
+ /** @deprecated glTF loader options. */
14
+ glTF?: {
15
+ /** Meshopt options. If set this option and workCount is great than 0, workers will be created. */
16
+ meshOpt?: {
17
+ /**
18
+ * Worker count for transcoder.
19
+ * @defaultValue 4
20
+ */
21
+ workerCount?: number;
22
+ };
23
+ };
24
+ }
25
+ }
26
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,46 @@
1
+ import { AssetPromise, 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
+ * Create and parse the resource.
16
+ * @remarks This method overrides the default resource creation.
17
+ * @param context - The parser context
18
+ * @param extensionSchema - The extension schema
19
+ * @param extensionOwnerSchema - The extension owner schema
20
+ * @returns The resource or promise
21
+ */
22
+ createAndParse(context: GLTFParserContext, extensionSchema: GLTFExtensionSchema, extensionOwnerSchema: GLTFExtensionOwnerSchema, ...extra: any[]): EngineObject | AssetPromise<EngineObject | Uint8Array>;
23
+ /**
24
+ * Additive parse to the resource.
25
+ * @param context - The parser context
26
+ * @param parseResource - The parsed resource
27
+ * @param extensionSchema - The extension schema
28
+ * @param extensionOwnerSchema - The extension owner schema
29
+ * @returns The void or promise
30
+ */
31
+ additiveParse(context: GLTFParserContext, parseResource: EngineObject, extensionSchema: GLTFExtensionSchema, extensionOwnerSchema: GLTFExtensionOwnerSchema, ...extra: any[]): void | AssetPromise<void>;
32
+ }
33
+ /**
34
+ * glTF Extension mode.
35
+ */
36
+ export declare enum GLTFExtensionMode {
37
+ /**
38
+ * Cerate instance and parse mode.
39
+ * @remarks
40
+ * If the glTF property has multiple extensions of `CreateAndParse` mode, only execute the last one.
41
+ * If this method is registered, the default pipeline processing will be ignored.
42
+ */
43
+ CreateAndParse = 0,
44
+ /** Additive parse mode. */
45
+ AdditiveParse = 1
46
+ }
@@ -0,0 +1,168 @@
1
+ import type { 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_materials_clearcoat extension
23
+ */
24
+ export interface IKHRMaterialsClearcoat {
25
+ clearcoatFactor?: number;
26
+ clearcoatTexture?: ITextureInfo;
27
+ clearcoatRoughnessFactor?: number;
28
+ clearcoatRoughnessTexture?: ITextureInfo;
29
+ clearcoatNormalTexture?: IMaterialNormalTextureInfo;
30
+ }
31
+ /**
32
+ * Interfaces from the KHR_materials_ior extension
33
+ */
34
+ export interface IKHRMaterialsIor {
35
+ ior: number;
36
+ }
37
+ /**
38
+ * Interfaces from the KHR_materials_unlit extension
39
+ */
40
+ export interface IKHRMaterialsUnlit {
41
+ }
42
+ /**
43
+ * Interfaces from the KHR_materials_sheen extension
44
+ */
45
+ export interface IKHRMaterialsSheen {
46
+ sheenColorFactor?: number[];
47
+ sheenColorTexture?: ITextureInfo;
48
+ sheenRoughnessFactor?: number;
49
+ sheenRoughnessTexture?: ITextureInfo;
50
+ }
51
+ /**
52
+ * Interfaces from the KHR_materials_specular extension
53
+ */
54
+ export interface IKHRMaterialsSpecular {
55
+ specularFactor?: number;
56
+ specularColorFactor?: number[];
57
+ specularTexture?: ITextureInfo;
58
+ specularColorTexture?: ITextureInfo;
59
+ }
60
+ /**
61
+ * Interfaces from the KHR_materials_transmission extension
62
+ */
63
+ export interface IKHRMaterialsTransmission {
64
+ transmissionFactor?: number;
65
+ transmissionTexture?: ITextureInfo;
66
+ }
67
+ /**
68
+ * Interfaces from the KHR_materials_translucency extension
69
+ */
70
+ export interface IKHRMaterialsTranslucency {
71
+ translucencyFactor?: number;
72
+ translucencyTexture?: ITextureInfo;
73
+ }
74
+ /**
75
+ * Interfaces from the KHR_materials_variants extension
76
+ */
77
+ export interface IKHRMaterialVariants_Mapping {
78
+ mappings: Array<{
79
+ variants: number[];
80
+ material: number;
81
+ }>;
82
+ extensions?: any;
83
+ extras?: any;
84
+ }
85
+ export interface IKHRMaterialVariants_Variant {
86
+ name: string;
87
+ extensions?: any;
88
+ extras?: any;
89
+ }
90
+ /**
91
+ * Interfaces from the KHR_materials_clearcoat extension
92
+ */
93
+ export interface IKHRMaterialsAnisotropy {
94
+ anisotropyStrength: number;
95
+ anisotropyRotation: number;
96
+ anisotropyTexture: ITextureInfo;
97
+ }
98
+ export interface IKHRMaterialVariants_Variants {
99
+ variants: Array<IKHRMaterialVariants_Variant>;
100
+ }
101
+ /**
102
+ * Interfaces from the KHR_texture_basisu extension
103
+ */
104
+ export interface IKHRTextureBasisU {
105
+ source: number;
106
+ }
107
+ /**
108
+ * Interfaces from the KHR_texture_transform extension
109
+ */
110
+ export interface IKHRTextureTransform {
111
+ offset?: number[];
112
+ rotation?: number;
113
+ scale?: number[];
114
+ texCoord?: number;
115
+ }
116
+ /**
117
+ * Interfaces from the KHR_xmp extension
118
+ */
119
+ export interface IKHRXmp {
120
+ packets: Array<{
121
+ [key: string]: unknown;
122
+ }>;
123
+ }
124
+ export interface IKHRXmp_Node {
125
+ packet: number;
126
+ }
127
+ export interface IEXTMeshoptCompressionSchema {
128
+ buffer: number;
129
+ byteOffset?: number;
130
+ byteLength: number;
131
+ byteStride: number;
132
+ mode: "ATTRIBUTES" | "TRIANGLES" | "INDICES";
133
+ count: number;
134
+ filter?: "NONE" | "OCTAHEDRAL" | "QUATERNION" | "EXPONENTIAL";
135
+ }
136
+ export interface IGalaceanMaterialRemap {
137
+ refId: string;
138
+ key?: string;
139
+ isClone?: boolean;
140
+ }
141
+ export interface IGalaceanAnimation {
142
+ events: {
143
+ time: number;
144
+ functionName: string;
145
+ parameter: any;
146
+ }[];
147
+ }
148
+ /**
149
+ * Interfaces from the KHR_materials_iridescence extension
150
+ */
151
+ export interface IKHRMaterialsIridescence {
152
+ iridescenceFactor?: number;
153
+ iridescenceTexture?: ITextureInfo;
154
+ iridescenceIor?: number;
155
+ iridescenceThicknessMinimum?: number;
156
+ iridescenceThicknessMaximum?: number;
157
+ iridescenceThicknessTexture?: ITextureInfo;
158
+ }
159
+ /**
160
+ * Interfaces from the KHR_materials_volume extension
161
+ */
162
+ export interface IKHRMaterialsVolume {
163
+ thicknessFactor?: number;
164
+ thicknessTexture?: ITextureInfo;
165
+ attenuationDistance?: number;
166
+ attenuationColor?: number[];
167
+ }
168
+ export type GLTFExtensionSchema = IKHRLightsPunctual_Light | IKHRMaterialsClearcoat | IKHRMaterialsIor | IKHRMaterialsUnlit | IKHRMaterialsSheen | IKHRMaterialsSpecular | IKHRMaterialsTransmission | IKHRMaterialsTranslucency | IKHRMaterialVariants_Mapping | IKHRMaterialVariants_Variants | IKHRMaterialsAnisotropy | IKHRTextureBasisU | IKHRTextureTransform | IKHRXmp | IKHRXmp_Node | IGalaceanAnimation | IKHRMaterialsIridescence | IKHRMaterialsVolume | Object;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ import { Material, Renderer } from "@galacean/engine-core";
2
+ export type IGLTFExtensionVariants = Array<{
3
+ renderer: Renderer;
4
+ material: Material;
5
+ variants: string[];
6
+ }>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ export declare let ready: Promise<{
2
+ workerCount: number;
3
+ useWorkers: (count?: number) => void;
4
+ decodeGltfBuffer: (count: any, stride: any, source: any, mode: any, filter: any) => Promise<Uint8Array>;
5
+ release: () => void;
6
+ }>;
7
+ export declare function getMeshoptDecoder(): Promise<{
8
+ workerCount: number;
9
+ useWorkers: (count?: number) => void;
10
+ decodeGltfBuffer: (count: any, stride: any, source: any, mode: any, filter: any) => Promise<Uint8Array>;
11
+ release: () => void;
12
+ }>;
@@ -0,0 +1,21 @@
1
+ import "./KHR_lights_punctual";
2
+ import "./KHR_materials_clearcoat";
3
+ import "./KHR_materials_ior";
4
+ import "./KHR_materials_sheen";
5
+ import "./KHR_materials_transmission";
6
+ import "./KHR_materials_unlit";
7
+ import "./KHR_materials_variants";
8
+ import "./KHR_materials_volume";
9
+ import "./KHR_mesh_quantization";
10
+ import "./KHR_texture_basisu";
11
+ import "./KHR_texture_transform";
12
+ import "./KHR_materials_ior";
13
+ import "./GALACEAN_materials_remap";
14
+ import "./GALACEAN_animation_event";
15
+ import "./EXT_meshopt_compression";
16
+ import "./KHR_materials_anisotropy";
17
+ import "./KHR_materials_iridescence";
18
+ import "./KHR_materials_specular";
19
+ import "./EXT_texture_webp";
20
+ export { GLTFExtensionParser, GLTFExtensionMode } from "./GLTFExtensionParser";
21
+ export * from "./GLTFExtensionSchema";
@@ -0,0 +1,6 @@
1
+ export { GLTFResource } from "./GLTFResource";
2
+ export { GLTFUtils } from "./GLTFUtils";
3
+ export * from "./parser";
4
+ export * from "./extensions/index";
5
+ export { AccessorType } from "./GLTFSchema";
6
+ export type { IMaterial, IMeshPrimitive, ITextureInfo, INode, GLTFExtensionOwnerSchema, IGLTF, IMesh } from "./GLTFSchema";
@@ -0,0 +1,12 @@
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): AssetPromise<AnimationClip>;
10
+ private static _addCurve;
11
+ parse(context: GLTFParserContext, index: number): AssetPromise<AnimationClip>;
12
+ }
@@ -0,0 +1,7 @@
1
+ import { AnimatorController, AssetPromise } from "@galacean/engine-core";
2
+ import { GLTFParser } from "./GLTFParser";
3
+ import { GLTFParserContext } from "./GLTFParserContext";
4
+ export declare class GLTFAnimatorControllerParser extends GLTFParser {
5
+ parse(context: GLTFParserContext): AssetPromise<AnimatorController>;
6
+ private _createAnimatorController;
7
+ }
@@ -0,0 +1,7 @@
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, index: number): AssetPromise<ArrayBuffer>;
6
+ private _parseSingleBuffer;
7
+ }
@@ -0,0 +1,6 @@
1
+ import { AssetPromise } from "@galacean/engine-core";
2
+ import { GLTFParser } from "./GLTFParser";
3
+ import { GLTFParserContext } from "./GLTFParserContext";
4
+ export declare class GLTFBufferViewParser extends GLTFParser {
5
+ parse(context: GLTFParserContext, index: number): AssetPromise<Uint8Array>;
6
+ }
@@ -0,0 +1,6 @@
1
+ import { Entity } from "@galacean/engine-core";
2
+ import { GLTFParser } from "./GLTFParser";
3
+ import { GLTFParserContext } from "./GLTFParserContext";
4
+ export declare class GLTFEntityParser extends GLTFParser {
5
+ parse(context: GLTFParserContext, index: number): Entity;
6
+ }
@@ -0,0 +1,15 @@
1
+ import { AssetPromise, Material, PBRMaterial, 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, materialInfo: IMaterial): void;
14
+ parse(context: GLTFParserContext, index: number): AssetPromise<Material>;
15
+ }
@@ -0,0 +1,20 @@
1
+ import { AssetPromise, ModelMesh } from "@galacean/engine-core";
2
+ import { ModelMeshRestoreInfo } from "../../GLTFContentRestorer";
3
+ import type { IGLTF, IMesh, IMeshPrimitive } from "../GLTFSchema";
4
+ import { GLTFParser } from "./GLTFParser";
5
+ import { 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, keepMeshData: boolean): AssetPromise<ModelMesh>;
12
+ private static _getBlendShapeData;
13
+ /**
14
+ * @internal
15
+ */
16
+ static _createBlendShape(context: GLTFParserContext, mesh: ModelMesh, meshRestoreInfo: ModelMeshRestoreInfo, glTFMesh: IMesh, gltfPrimitive: IMeshPrimitive, glTFTargets: {
17
+ [name: string]: number;
18
+ }[]): AssetPromise<void>;
19
+ parse(context: GLTFParserContext, index: number): AssetPromise<ModelMesh[]>;
20
+ }
@@ -0,0 +1,57 @@
1
+ import { AssetPromise, EngineObject } from "@galacean/engine-core";
2
+ import type { GLTFExtensionOwnerSchema } from "../GLTFSchema";
3
+ import { GLTFExtensionMode, GLTFExtensionParser } from "../extensions/GLTFExtensionParser";
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 create resource.
12
+ * @param extensions - Related extensions field
13
+ * @param context - The parser context
14
+ * @param ownerSchema - The extension owner schema
15
+ * @param extra - Extra params
16
+ * @returns
17
+ */
18
+ static executeExtensionsCreateAndParse(extensions: {
19
+ [key: string]: any;
20
+ }, context: GLTFParserContext, ownerSchema: GLTFExtensionOwnerSchema, ...extra: any[]): EngineObject | void | AssetPromise<EngineObject | Uint8Array | void>;
21
+ /**
22
+ * Execute all parses of extension to parse resource.
23
+ * @param extensions - Related extensions field
24
+ * @param context - The parser context
25
+ * @param parseResource - The parsed resource
26
+ * @param ownerSchema - The extension owner schema
27
+ * @param extra - Extra params
28
+ */
29
+ static executeExtensionsAdditiveAndParse(extensions: {
30
+ [key: string]: any;
31
+ }, context: GLTFParserContext, parseResource: EngineObject, ownerSchema: GLTFExtensionOwnerSchema, ...extra: any[]): void;
32
+ /**
33
+ * Whether the plugin is registered.
34
+ * @param extensionName - Extension name
35
+ * @returns Boolean
36
+ */
37
+ static hasExtensionParser(extensionName: string): boolean;
38
+ /**
39
+ * Get the last plugin by glTF extension mode.
40
+ * @param extensionName - Extension name
41
+ * @param mode - GLTF extension mode
42
+ * @returns GLTF extension parser
43
+ */
44
+ static getExtensionParser(extensionName: string, mode: GLTFExtensionMode): GLTFExtensionParser | undefined;
45
+ /**
46
+ * @internal
47
+ */
48
+ static _addExtensionParser(extensionName: string, extensionParser: GLTFExtensionParser): void;
49
+ private static _createAndParse;
50
+ private static _additiveParse;
51
+ abstract parse(context: GLTFParserContext, index?: number): any;
52
+ }
53
+ /**
54
+ * Declare ExtensionParser's decorator.
55
+ * @param extensionName - Extension name
56
+ */
57
+ export declare function registerGLTFExtension(extensionName: string, mode: GLTFExtensionMode): (parser: new () => GLTFExtensionParser) => void;
@@ -0,0 +1,74 @@
1
+ import { AssetPromise, Buffer, Entity, ResourceManager, TypedArray } from "@galacean/engine-core";
2
+ import { BufferDataRestoreInfo, GLTFContentRestorer } from "../../GLTFContentRestorer";
3
+ import { GLTFParams } from "../../GLTFLoader";
4
+ import { GLTFResource } from "../GLTFResource";
5
+ import type { IGLTF } from "../GLTFSchema";
6
+ import { GLTFParser } from "./GLTFParser";
7
+ /**
8
+ * @internal
9
+ */
10
+ export declare class GLTFParserContext {
11
+ glTFResource: GLTFResource;
12
+ resourceManager: ResourceManager;
13
+ params: GLTFParams;
14
+ private static readonly _parsers;
15
+ static addParser(parserType: GLTFParserType, parser: GLTFParser): void;
16
+ glTF: IGLTF;
17
+ accessorBufferCache: Record<string, BufferInfo>;
18
+ contentRestorer: GLTFContentRestorer;
19
+ buffers?: ArrayBuffer[];
20
+ needAnimatorController: boolean;
21
+ /** @internal */
22
+ _getPromises: AssetPromise<unknown>[];
23
+ private _resourceCache;
24
+ private _progress;
25
+ /** @internal */
26
+ _setTaskCompleteProgress: (loaded: number, total: number) => void;
27
+ /** @internal */
28
+ _setTaskDetailProgress: (url: string, loaded: number, total: number) => void;
29
+ constructor(glTFResource: GLTFResource, resourceManager: ResourceManager, params: GLTFParams);
30
+ get<T>(type: GLTFParserType.Entity, index: number): Entity;
31
+ get<T>(type: GLTFParserType.Entity): Entity[];
32
+ get<T>(type: GLTFParserType.Schema): AssetPromise<T>;
33
+ get<T>(type: GLTFParserType.Validator): AssetPromise<T>;
34
+ get<T>(type: GLTFParserType.AnimatorController): AssetPromise<T>;
35
+ get<T>(type: GLTFParserType, index: number): AssetPromise<T>;
36
+ get<T>(type: GLTFParserType): AssetPromise<T[]>;
37
+ parse(): AssetPromise<GLTFResource>;
38
+ /**
39
+ * @internal
40
+ */
41
+ _onTaskDetail: (url: string, loaded: number, total: number) => void;
42
+ /**
43
+ * @internal
44
+ */
45
+ _addTaskCompletePromise(taskPromise: AssetPromise<any>): void;
46
+ private _handleSubAsset;
47
+ }
48
+ /**
49
+ * @internal
50
+ */
51
+ export declare class BufferInfo {
52
+ data: TypedArray;
53
+ interleaved: boolean;
54
+ stride: number;
55
+ vertexBuffer: Buffer;
56
+ vertexBindingInfos: Record<number, number>;
57
+ restoreInfo: BufferDataRestoreInfo;
58
+ constructor(data: TypedArray, interleaved: boolean, stride: number);
59
+ }
60
+ export declare enum GLTFParserType {
61
+ Schema = 0,
62
+ Validator = 1,
63
+ Scene = 2,
64
+ Buffer = 3,
65
+ BufferView = 4,
66
+ Texture = 5,
67
+ Material = 6,
68
+ Mesh = 7,
69
+ Entity = 8,
70
+ Skin = 9,
71
+ Animation = 10,
72
+ AnimatorController = 11
73
+ }
74
+ export declare function registerGLTFParser(pipeline: GLTFParserType): (Parser: new () => GLTFParser) => void;
@@ -0,0 +1,11 @@
1
+ import { AssetPromise, Entity } from "@galacean/engine-core";
2
+ import { GLTFParser } from "./GLTFParser";
3
+ import { GLTFParserContext } from "./GLTFParserContext";
4
+ export declare class GLTFSceneParser extends GLTFParser {
5
+ parse(context: GLTFParserContext, index: number): AssetPromise<Entity>;
6
+ private _parseEntityComponent;
7
+ private _createCamera;
8
+ private _createRenderer;
9
+ private _computeLocalBounds;
10
+ private _computeApproximateBindMatrix;
11
+ }
@@ -0,0 +1,6 @@
1
+ import { IGLTF } from "../GLTFSchema";
2
+ import { GLTFParser } from "./GLTFParser";
3
+ import { GLTFParserContext } from "./GLTFParserContext";
4
+ export declare class GLTFSchemaParser extends GLTFParser {
5
+ parse(context: GLTFParserContext): Promise<IGLTF>;
6
+ }
@@ -0,0 +1,7 @@
1
+ import { AssetPromise, Skin } from "@galacean/engine-core";
2
+ import { GLTFParser } from "./GLTFParser";
3
+ import { GLTFParserContext } from "./GLTFParserContext";
4
+ export declare class GLTFSkinParser extends GLTFParser {
5
+ parse(context: GLTFParserContext, index: number): AssetPromise<Skin>;
6
+ private _findSkeletonRootBone;
7
+ }
@@ -0,0 +1,15 @@
1
+ import { AssetPromise, Texture, Texture2D, TextureWrapMode } from "@galacean/engine-core";
2
+ import { GLTFParser } from "./GLTFParser";
3
+ import { GLTFParserContext } from "./GLTFParserContext";
4
+ export declare class GLTFTextureParser extends GLTFParser {
5
+ /** @internal */
6
+ static _wrapMap: {
7
+ 33071: TextureWrapMode;
8
+ 33648: TextureWrapMode;
9
+ 10497: TextureWrapMode;
10
+ };
11
+ /** @internal */
12
+ static _parseTexture(context: GLTFParserContext, imageIndex: number, textureIndex: number, sampler?: number, textureName?: string, isSRGBColorSpace?: boolean): AssetPromise<Texture2D>;
13
+ parse(context: GLTFParserContext, textureIndex: number): AssetPromise<Texture>;
14
+ private _isSRGBColorSpace;
15
+ }