@galacean/engine-loader 2.0.0-alpha.6 → 2.0.0-alpha.61

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 (59) hide show
  1. package/README.md +3 -1
  2. package/dist/main.js +3445 -3771
  3. package/dist/main.js.map +1 -1
  4. package/dist/module.js +3445 -3772
  5. package/dist/module.js.map +1 -1
  6. package/package.json +4 -4
  7. package/types/GLTFContentRestorer.d.ts +13 -13
  8. package/types/HDRDecoder.d.ts +29 -9
  9. package/types/ImageDecoder.d.ts +14 -0
  10. package/types/PrimitiveMeshAsset.d.ts +238 -0
  11. package/types/SceneLoader.d.ts +8 -1
  12. package/types/{Texture2DLoader.d.ts → TextureLoader.d.ts} +4 -4
  13. package/types/gltf/GLTFResource.d.ts +4 -4
  14. package/types/gltf/GLTFUtils.d.ts +6 -6
  15. package/types/gltf/extensions/GLTFExtensionParser.d.ts +1 -1
  16. package/types/gltf/extensions/GLTFExtensionSchema.d.ts +9 -4
  17. package/types/gltf/extensions/MeshoptDecoder.d.ts +1 -1
  18. package/types/gltf/extensions/index.d.ts +1 -0
  19. package/types/gltf/parser/GLTFAnimatorControllerParser.d.ts +1 -1
  20. package/types/gltf/parser/GLTFParser.d.ts +2 -2
  21. package/types/gltf/parser/GLTFParserContext.d.ts +4 -3
  22. package/types/gltf/parser/GLTFSceneParser.d.ts +1 -1
  23. package/types/gltf/parser/GLTFSkinParser.d.ts +4 -0
  24. package/types/gltf/parser/GLTFValidator.d.ts +1 -1
  25. package/types/index.d.ts +7 -7
  26. package/types/ktx2/KTX2Container.d.ts +1 -0
  27. package/types/ktx2/KTX2Loader.d.ts +2 -5
  28. package/types/ktx2/KTX2TargetFormat.d.ts +8 -8
  29. package/types/ktx2/WorkerPool.d.ts +1 -1
  30. package/types/prefab/PrefabParser.d.ts +9 -6
  31. package/types/prefab/PrefabResource.d.ts +2 -2
  32. package/types/resource-deserialize/index.d.ts +3 -4
  33. package/types/resource-deserialize/resources/parser/HierarchyParser.d.ts +22 -27
  34. package/types/resource-deserialize/resources/parser/ParserContext.d.ts +12 -12
  35. package/types/resource-deserialize/resources/parser/ReflectionParser.d.ts +42 -17
  36. package/types/resource-deserialize/resources/scene/SceneParser.d.ts +6 -7
  37. package/types/resource-deserialize/resources/texture2D/Texture2DDecoder.d.ts +1 -0
  38. package/types/resource-deserialize/resources/textureCube/TextureCubeDecoder.d.ts +1 -0
  39. package/types/resource-deserialize/utils/BufferReader.d.ts +3 -1
  40. package/types/schema/BasicSchema.d.ts +21 -0
  41. package/types/schema/CommonSchema.d.ts +45 -0
  42. package/types/schema/HierarchySchema.d.ts +71 -0
  43. package/types/schema/MaterialSchema.d.ts +57 -0
  44. package/types/schema/PrefabSchema.d.ts +4 -0
  45. package/types/schema/ProjectSchema.d.ts +7 -0
  46. package/types/schema/SceneSchema.d.ts +59 -0
  47. package/types/{resource-deserialize/resources/schema → schema}/index.d.ts +4 -1
  48. package/types/schema/refs.d.ts +2 -0
  49. package/types/ShaderChunkLoader.d.ts +0 -9
  50. package/types/resource-deserialize/resources/mesh/MeshDecoder.d.ts +0 -8
  51. package/types/resource-deserialize/resources/mesh/type.d.ts +0 -31
  52. package/types/resource-deserialize/resources/schema/BasicSchema.d.ts +0 -97
  53. package/types/resource-deserialize/resources/schema/MaterialSchema.d.ts +0 -102
  54. package/types/resource-deserialize/resources/schema/ProjectSchema.d.ts +0 -10
  55. package/types/resource-deserialize/resources/schema/SceneSchema.d.ts +0 -80
  56. package/types/resource-deserialize/resources/texture2D/TextureDecoder.d.ts +0 -9
  57. /package/types/{EnvLoader.d.ts → AmbientLightLoader.d.ts} +0 -0
  58. /package/types/{MeshLoader.d.ts → RenderTargetLoader.d.ts} +0 -0
  59. /package/types/{TextureCubeLoader.d.ts → gltf/extensions/KHR_materials_emissive_strength.d.ts} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacean/engine-loader",
3
- "version": "2.0.0-alpha.6",
3
+ "version": "2.0.0-alpha.61",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -19,9 +19,9 @@
19
19
  "libs/**/*"
20
20
  ],
21
21
  "dependencies": {
22
- "@galacean/engine-core": "2.0.0-alpha.6",
23
- "@galacean/engine-rhi-webgl": "2.0.0-alpha.6",
24
- "@galacean/engine-math": "2.0.0-alpha.6"
22
+ "@galacean/engine-core": "2.0.0-alpha.61",
23
+ "@galacean/engine-rhi-webgl": "2.0.0-alpha.61",
24
+ "@galacean/engine-math": "2.0.0-alpha.61"
25
25
  },
26
26
  "scripts": {
27
27
  "b:types": "tsc"
@@ -53,21 +53,21 @@ export declare class BufferRestoreInfo {
53
53
  */
54
54
  export declare class BufferDataRestoreInfo {
55
55
  main: RestoreDataAccessor;
56
- typeSize?: number;
57
- sparseCount?: number;
58
- sparseIndices?: RestoreDataAccessor;
59
- sparseValues?: RestoreDataAccessor;
60
- constructor(main: RestoreDataAccessor, typeSize?: number, sparseCount?: number, sparseIndices?: RestoreDataAccessor, sparseValues?: RestoreDataAccessor);
56
+ typeSize?: number | undefined;
57
+ sparseCount?: number | undefined;
58
+ sparseIndices?: RestoreDataAccessor | undefined;
59
+ sparseValues?: RestoreDataAccessor | undefined;
60
+ constructor(main: RestoreDataAccessor, typeSize?: number | undefined, sparseCount?: number | undefined, sparseIndices?: RestoreDataAccessor | undefined, sparseValues?: RestoreDataAccessor | undefined);
61
61
  }
62
62
  /**
63
63
  * @internal
64
64
  */
65
65
  export declare class RestoreDataAccessor {
66
- bufferIndex: number;
66
+ bufferIndex: number | undefined;
67
67
  TypedArray: Uint8ArrayConstructor | Int8ArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Uint32ArrayConstructor | Float32ArrayConstructor;
68
- byteOffset: number;
68
+ byteOffset: number | undefined;
69
69
  length: number;
70
- constructor(bufferIndex: number, TypedArray: Uint8ArrayConstructor | Int8ArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Uint32ArrayConstructor | Float32ArrayConstructor, byteOffset: number, length: number);
70
+ constructor(bufferIndex: number | undefined, TypedArray: Uint8ArrayConstructor | Int8ArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Uint32ArrayConstructor | Float32ArrayConstructor, byteOffset: number | undefined, length: number);
71
71
  }
72
72
  /**
73
73
  * @internal
@@ -75,9 +75,9 @@ export declare class RestoreDataAccessor {
75
75
  export declare class BlendShapeRestoreInfo {
76
76
  blendShape: BlendShape;
77
77
  position: BlendShapeDataRestoreInfo;
78
- normal?: BlendShapeDataRestoreInfo;
79
- tangent?: BlendShapeDataRestoreInfo;
80
- constructor(blendShape: BlendShape, position: BlendShapeDataRestoreInfo, normal?: BlendShapeDataRestoreInfo, tangent?: BlendShapeDataRestoreInfo);
78
+ normal?: (BlendShapeDataRestoreInfo | null) | undefined;
79
+ tangent?: (BlendShapeDataRestoreInfo | null) | undefined;
80
+ constructor(blendShape: BlendShape, position: BlendShapeDataRestoreInfo, normal?: (BlendShapeDataRestoreInfo | null) | undefined, tangent?: (BlendShapeDataRestoreInfo | null) | undefined);
81
81
  }
82
82
  /**
83
83
  * @internal
@@ -86,7 +86,7 @@ export declare class BlendShapeDataRestoreInfo {
86
86
  buffer: BufferDataRestoreInfo;
87
87
  byteOffset: number;
88
88
  count: number;
89
- normalized: boolean;
89
+ normalized: boolean | undefined;
90
90
  componentType: AccessorComponentType;
91
- constructor(buffer: BufferDataRestoreInfo, byteOffset: number, count: number, normalized: boolean, componentType: AccessorComponentType);
91
+ constructor(buffer: BufferDataRestoreInfo, byteOffset: number, count: number, normalized: boolean | undefined, componentType: AccessorComponentType);
92
92
  }
@@ -1,23 +1,43 @@
1
1
  /**
2
- * @internal
3
- * HDR panorama to cubemap decoder.
2
+ * HDR (Radiance RGBE) image decoder.
3
+ *
4
+ * Decodes .hdr files into pixel data. Supports parsing the header
5
+ * and decoding RLE-compressed RGBE scanlines into R16G16B16A16_SFloat half-float pixels.
4
6
  */
5
7
  export declare class HDRDecoder {
6
8
  private static _float2HalfTables;
7
9
  private static _floatView;
8
10
  private static _uint32View;
9
- private static _one;
10
- private static _faces;
11
+ /**
12
+ * Parse the header of an HDR file.
13
+ * @returns Header info including width, height, and data start position.
14
+ */
11
15
  static parseHeader(uint8array: Uint8Array): IHDRHeader;
12
- static decodeFaces(bufferArray: Uint8Array, header: IHDRHeader, onFace: (faceIndex: number, data: Uint16Array) => void): void;
16
+ /**
17
+ * Decode an HDR file buffer into R16G16B16A16_SFloat half-float pixel data.
18
+ * @param buffer - The full HDR file as Uint8Array.
19
+ * @returns Object with width, height, and half-float pixel data.
20
+ */
21
+ static decode(buffer: Uint8Array): {
22
+ width: number;
23
+ height: number;
24
+ pixels: Uint16Array;
25
+ };
26
+ /**
27
+ * @internal
28
+ * Convert RGBE pixel data to R16G16B16A16_SFloat half-float.
29
+ */
30
+ static _rgbeToHalfFloat(rgbe: Uint8Array, width: number, height: number): Uint16Array;
31
+ /**
32
+ * @internal
33
+ * Decode RLE-compressed RGBE scanlines into raw RGBE pixel data.
34
+ */
35
+ static _readPixels(buffer: Uint8Array, width: number, height: number): Uint8Array;
13
36
  private static _generateFloat2HalfTables;
14
- private static _createCubemapData;
15
37
  private static _readStringLine;
16
- private static _readPixels;
17
38
  }
18
- interface IHDRHeader {
39
+ export interface IHDRHeader {
19
40
  width: number;
20
41
  height: number;
21
42
  dataPosition: number;
22
43
  }
23
- export {};
@@ -0,0 +1,14 @@
1
+ import { AssetPromise } from "@galacean/engine-core";
2
+ /**
3
+ * Decodes encoded image bytes (PNG, JPEG, WebP, ...) into an image element.
4
+ *
5
+ * The blob handed to the image carries the declared `mimeType` or the MIME type detected from the bytes:
6
+ * browsers sniff an untyped blob, but some platforms (for example mini-game runtimes) only decode images
7
+ * whose type is declared.
8
+ * @internal
9
+ */
10
+ export declare class ImageDecoder {
11
+ static _decode(data: ArrayBuffer | ArrayBufferView, url: string, mimeType?: string): AssetPromise<HTMLImageElement>;
12
+ private static _getMimeType;
13
+ private static _releaseObjectUrl;
14
+ }
@@ -0,0 +1,238 @@
1
+ import type { CapsuleMeshOptions, CircleMeshOptions, ConeMeshOptions, CuboidMeshOptions, CylinderMeshOptions, LinearExtrudedPolygonMeshOptions, PathExtrudedPolygonMeshOptions, PlaneMeshOptions, PolygonMeshOptions, PolygonShape, RegularPolyhedronMeshOptions, RevolvedSurfaceMeshOptions, RingMeshOptions, RoundedCuboidMeshOptions, SphereMeshOptions, TorusKnotMeshOptions, TorusMeshOptions, TruncatedConeMeshOptions, TubeMeshOptions } from "@galacean/engine-core";
2
+ import type { Vector2, Vector3 } from "@galacean/engine-math";
3
+ /**
4
+ * @internal
5
+ */
6
+ export type SerializedPrimitiveMeshData<T> = {
7
+ [Key in keyof T]: SerializedPrimitiveMeshValue<T[Key]>;
8
+ };
9
+ type SerializedPrimitiveMeshValue<T> = T extends Vector2 | Vector3 ? ReturnType<T["toJSON"]> : T extends object ? SerializedPrimitiveMeshData<T> : T;
10
+ /**
11
+ * Serialized inputs and optional settings for every primitive mesh factory.
12
+ * Required inputs use the same units as factory arguments. Vector inputs store their components as plain JSON objects.
13
+ */
14
+ export type PrimitiveMeshAsset = {
15
+ type: "sphere";
16
+ /**
17
+ * The radius in local units.
18
+ */
19
+ sphereRadius: number;
20
+ sphereOptions?: SerializedPrimitiveMeshData<SphereMeshOptions>;
21
+ } | {
22
+ type: "cuboid";
23
+ /**
24
+ * The full size along X in local units.
25
+ */
26
+ cuboidWidth: number;
27
+ /**
28
+ * The full size along Y in local units.
29
+ */
30
+ cuboidHeight: number;
31
+ /**
32
+ * The full size along Z in local units.
33
+ */
34
+ cuboidDepth: number;
35
+ cuboidOptions?: CuboidMeshOptions;
36
+ } | {
37
+ type: "plane";
38
+ /**
39
+ * The full size along X in local units.
40
+ */
41
+ planeWidth: number;
42
+ /**
43
+ * The full size along Z in local units.
44
+ */
45
+ planeDepth: number;
46
+ planeOptions?: PlaneMeshOptions;
47
+ } | {
48
+ type: "cylinder";
49
+ /**
50
+ * The radius in local units.
51
+ */
52
+ cylinderRadius: number;
53
+ /**
54
+ * The full size along Y in local units.
55
+ */
56
+ cylinderHeight: number;
57
+ cylinderOptions?: SerializedPrimitiveMeshData<CylinderMeshOptions>;
58
+ } | {
59
+ type: "truncatedCone";
60
+ /**
61
+ * The top radius in local units.
62
+ */
63
+ truncatedConeTopRadius: number;
64
+ /**
65
+ * The bottom radius in local units.
66
+ */
67
+ truncatedConeBottomRadius: number;
68
+ /**
69
+ * The full size along Y in local units.
70
+ */
71
+ truncatedConeHeight: number;
72
+ truncatedConeOptions?: SerializedPrimitiveMeshData<TruncatedConeMeshOptions>;
73
+ } | {
74
+ type: "cone";
75
+ /**
76
+ * The bottom radius in local units.
77
+ */
78
+ coneRadius: number;
79
+ /**
80
+ * The full size along Y in local units.
81
+ */
82
+ coneHeight: number;
83
+ coneOptions?: SerializedPrimitiveMeshData<ConeMeshOptions>;
84
+ } | {
85
+ type: "capsule";
86
+ /**
87
+ * The radius of the cylinder and hemispherical ends in local units.
88
+ */
89
+ capsuleRadius: number;
90
+ /**
91
+ * The straight cylindrical section height in local units; total height is `capsuleCylinderHeight + 2 * capsuleRadius`.
92
+ */
93
+ capsuleCylinderHeight: number;
94
+ capsuleOptions?: CapsuleMeshOptions;
95
+ } | {
96
+ type: "torus";
97
+ /**
98
+ * The distance from the origin to the tube centerline in local units.
99
+ */
100
+ torusRadius: number;
101
+ /**
102
+ * The radius of the tube cross-section in local units.
103
+ */
104
+ torusTubeRadius: number;
105
+ torusOptions?: SerializedPrimitiveMeshData<TorusMeshOptions>;
106
+ } | {
107
+ type: "circle";
108
+ /**
109
+ * The radius in local units.
110
+ */
111
+ circleRadius: number;
112
+ circleOptions?: SerializedPrimitiveMeshData<CircleMeshOptions>;
113
+ } | {
114
+ type: "ring";
115
+ /**
116
+ * The outer radius in local units.
117
+ */
118
+ ringOuterRadius: number;
119
+ /**
120
+ * The inner radius in local units.
121
+ */
122
+ ringInnerRadius: number;
123
+ ringOptions?: SerializedPrimitiveMeshData<RingMeshOptions>;
124
+ } | {
125
+ type: "tetrahedron";
126
+ /**
127
+ * The distance from the origin to each vertex in local units.
128
+ */
129
+ tetrahedronRadius: number;
130
+ tetrahedronOptions?: RegularPolyhedronMeshOptions;
131
+ } | {
132
+ type: "octahedron";
133
+ /**
134
+ * The distance from the origin to each vertex in local units.
135
+ */
136
+ octahedronRadius: number;
137
+ octahedronOptions?: RegularPolyhedronMeshOptions;
138
+ } | {
139
+ type: "icosahedron";
140
+ /**
141
+ * The distance from the origin to each vertex in local units.
142
+ */
143
+ icosahedronRadius: number;
144
+ icosahedronOptions?: RegularPolyhedronMeshOptions;
145
+ } | {
146
+ type: "dodecahedron";
147
+ /**
148
+ * The distance from the origin to each vertex in local units.
149
+ */
150
+ dodecahedronRadius: number;
151
+ dodecahedronOptions?: RegularPolyhedronMeshOptions;
152
+ } | {
153
+ type: "revolvedSurface";
154
+ /**
155
+ * The profile points in local units; x is the radius from the Y axis and y is the height.
156
+ */
157
+ revolvedSurfaceProfile: SerializedPrimitiveMeshData<readonly Vector2[]>;
158
+ revolvedSurfaceOptions?: SerializedPrimitiveMeshData<RevolvedSurfaceMeshOptions>;
159
+ } | {
160
+ type: "tube";
161
+ /**
162
+ * The centerline points in local coordinates.
163
+ */
164
+ tubePath: SerializedPrimitiveMeshData<readonly Vector3[]>;
165
+ /**
166
+ * The radius of the cross-section in local units.
167
+ */
168
+ tubeRadius: number;
169
+ tubeOptions?: TubeMeshOptions;
170
+ } | {
171
+ type: "polygon";
172
+ /**
173
+ * The polygons in the XY plane, including any holes.
174
+ */
175
+ polygonShapes: readonly SerializedPrimitiveMeshData<PolygonShape>[];
176
+ polygonOptions?: PolygonMeshOptions;
177
+ } | {
178
+ type: "extrudedPolygon";
179
+ /**
180
+ * The total extrusion depth in local units, including both bevels.
181
+ */
182
+ extrudedPolygonDepth: number;
183
+ /**
184
+ * The cross-section contours and optional holes in local XY coordinates.
185
+ */
186
+ extrudedPolygonShapes: readonly SerializedPrimitiveMeshData<PolygonShape>[];
187
+ extrudedPolygonOptions?: LinearExtrudedPolygonMeshOptions;
188
+ } | {
189
+ type: "extrudedPolygon";
190
+ /**
191
+ * The path points in local coordinates.
192
+ */
193
+ extrudedPolygonPath: SerializedPrimitiveMeshData<readonly Vector3[]>;
194
+ /**
195
+ * The cross-section contours and optional holes in local XY coordinates.
196
+ */
197
+ extrudedPolygonShapes: readonly SerializedPrimitiveMeshData<PolygonShape>[];
198
+ extrudedPolygonOptions?: PathExtrudedPolygonMeshOptions;
199
+ } | {
200
+ type: "torusKnot";
201
+ /**
202
+ * The base radius of the torus in local units.
203
+ */
204
+ torusKnotRadius: number;
205
+ /**
206
+ * The radius of the tube cross-section in local units.
207
+ */
208
+ torusKnotTubeRadius: number;
209
+ /**
210
+ * The signed integer revolution count around the torus axis.
211
+ */
212
+ torusKnotAxisTurns: number;
213
+ /**
214
+ * The signed integer revolution count around the torus cross-section.
215
+ */
216
+ torusKnotCrossSectionTurns: number;
217
+ torusKnotOptions?: TorusKnotMeshOptions;
218
+ } | {
219
+ type: "roundedCuboid";
220
+ /**
221
+ * The full size along X in local units.
222
+ */
223
+ roundedCuboidWidth: number;
224
+ /**
225
+ * The full size along Y in local units.
226
+ */
227
+ roundedCuboidHeight: number;
228
+ /**
229
+ * The full size along Z in local units.
230
+ */
231
+ roundedCuboidDepth: number;
232
+ /**
233
+ * The edge and corner radius in local units, clamped to half the smallest dimension.
234
+ */
235
+ roundedCuboidCornerRadius: number;
236
+ roundedCuboidOptions?: RoundedCuboidMeshOptions;
237
+ };
238
+ export {};
@@ -1 +1,8 @@
1
- export {};
1
+ import { ResourceManager, Scene } from "@galacean/engine-core";
2
+ import type { RefItem } from "./schema/CommonSchema";
3
+ import { type SceneFile } from "./schema/SceneSchema";
4
+ /**
5
+ * Apply scene-level data (ambient, background, shadow, fog, AO) to a Scene.
6
+ * @internal
7
+ */
8
+ export declare function applySceneData(scene: Scene, sceneData: SceneFile["scene"], resourceManager: ResourceManager, refs: RefItem[]): Promise<void>;
@@ -1,9 +1,9 @@
1
1
  import { TextureFilterMode, TextureFormat, TextureWrapMode } from "@galacean/engine-core";
2
2
  /**
3
- * Texture2D loader params interface.
3
+ * Texture loader params interface.
4
4
  */
5
- export interface Texture2DParams {
6
- /** Texture format. default `TextureFormat.R8G8B8A8` */
5
+ export interface TextureParams {
6
+ /** Texture format. default `TextureFormat.R8G8B8A8_UNorm` */
7
7
  format: TextureFormat;
8
8
  /** Whether to use multi-level texture, default is true. */
9
9
  mipmap: boolean;
@@ -15,6 +15,6 @@ export interface Texture2DParams {
15
15
  filterMode: TextureFilterMode;
16
16
  /** Anisotropic level for texture. */
17
17
  anisoLevel: number;
18
- /** Whether the texture data is in sRGB color space, otherwise is linear color space. @defaultValue `true` */
18
+ /** Whether the texture data is in sRGB color space. @defaultValue `true` */
19
19
  isSRGBColorSpace: boolean;
20
20
  }
@@ -32,13 +32,13 @@ export declare class GLTFResource extends ReferResource {
32
32
  */
33
33
  constructor(engine: Engine, url: string);
34
34
  /**
35
- * Instantiate scene root entity.
36
- * @param sceneIndex - Scene index
37
- * @returns Root entity
35
+ * Instantiate a glTF scene root Entity.
36
+ * @param sceneIndex - The scene index
37
+ * @returns A detached scene-root instance that must be added to a parent Entity or Scene to update and render
38
38
  */
39
39
  instantiateSceneRoot(sceneIndex?: number): Entity;
40
40
  protected _onDestroy(): void;
41
- private _disassociationSuperResource;
41
+ private _disassociateResources;
42
42
  /**
43
43
  * @deprecated
44
44
  * Entity after EntityParser.
@@ -17,17 +17,17 @@ export declare class GLTFUtils {
17
17
  /**
18
18
  * Get the TypedArray corresponding to the component type.
19
19
  */
20
- static getComponentType(componentType: AccessorComponentType): Float32ArrayConstructor | Uint32ArrayConstructor | Uint8ArrayConstructor | Uint16ArrayConstructor | Int8ArrayConstructor | Int16ArrayConstructor;
20
+ static getComponentType(componentType: AccessorComponentType): Uint8ArrayConstructor | Float32ArrayConstructor | Uint32ArrayConstructor | Uint16ArrayConstructor | Int8ArrayConstructor | Int16ArrayConstructor;
21
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[];
22
+ static getAccessorBuffer(context: GLTFParserContext, bufferViews: IBufferView[] | undefined, accessor: IAccessor): AssetPromise<BufferInfo>;
23
+ static bufferToVector3Array(buffer: TypedArray, byteOffset: number, count: number, normalized: boolean | undefined, componentType: AccessorComponentType): Vector3[];
24
24
  static getBufferViewData(bufferView: IBufferView, buffers: ArrayBuffer[]): ArrayBuffer;
25
25
  /**
26
26
  * Get accessor data.
27
27
  */
28
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;
29
+ static getIndexFormat(type: AccessorComponentType): IndexFormat | undefined;
30
+ static getElementFormat(type: AccessorComponentType, size: number, normalized?: boolean): VertexElementFormat | undefined;
31
31
  /**
32
32
  * Load image buffer
33
33
  */
@@ -39,7 +39,7 @@ export declare class GLTFUtils {
39
39
  glTF?: IGLTF;
40
40
  buffers?: ArrayBuffer[];
41
41
  originBuffer?: ArrayBuffer;
42
- };
42
+ } | null;
43
43
  static parseSampler(texture: Texture2D, samplerInfo: ISamplerInfo): void;
44
44
  static getSamplerInfo(sampler: ISampler): ISamplerInfo;
45
45
  }
@@ -19,7 +19,7 @@ export declare abstract class GLTFExtensionParser {
19
19
  * @param extensionOwnerSchema - The extension owner schema
20
20
  * @returns The resource or promise
21
21
  */
22
- createAndParse(context: GLTFParserContext, extensionSchema: GLTFExtensionSchema, extensionOwnerSchema: GLTFExtensionOwnerSchema, ...extra: any[]): EngineObject | AssetPromise<EngineObject | Uint8Array>;
22
+ createAndParse(context: GLTFParserContext, extensionSchema: GLTFExtensionSchema, extensionOwnerSchema: GLTFExtensionOwnerSchema, ...extra: any[]): EngineObject | AssetPromise<EngineObject | Uint8Array | null>;
23
23
  /**
24
24
  * Additive parse to the resource.
25
25
  * @param context - The parser context
@@ -1,4 +1,5 @@
1
1
  import type { IMaterialNormalTextureInfo, ITextureInfo } from "../GLTFSchema";
2
+ import type { RefItem } from "../../schema/CommonSchema";
2
3
  /**
3
4
  * Interfaces from the KHR_lights_punctual extension
4
5
  */
@@ -28,6 +29,12 @@ export interface IKHRMaterialsClearcoat {
28
29
  clearcoatRoughnessTexture?: ITextureInfo;
29
30
  clearcoatNormalTexture?: IMaterialNormalTextureInfo;
30
31
  }
32
+ /**
33
+ * Interfaces from the KHR_materials_emissive_strength extension
34
+ */
35
+ export interface IKHRMaterialsEmissiveStrength {
36
+ emissiveStrength?: number;
37
+ }
31
38
  /**
32
39
  * Interfaces from the KHR_materials_ior extension
33
40
  */
@@ -133,9 +140,7 @@ export interface IEXTMeshoptCompressionSchema {
133
140
  count: number;
134
141
  filter?: "NONE" | "OCTAHEDRAL" | "QUATERNION" | "EXPONENTIAL";
135
142
  }
136
- export interface IGalaceanMaterialRemap {
137
- url: string;
138
- key?: string;
143
+ export interface IGalaceanMaterialRemap extends RefItem {
139
144
  isClone?: boolean;
140
145
  }
141
146
  export interface IGalaceanAnimation {
@@ -165,4 +170,4 @@ export interface IKHRMaterialsVolume {
165
170
  attenuationDistance?: number;
166
171
  attenuationColor?: number[];
167
172
  }
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;
173
+ export type GLTFExtensionSchema = IKHRLightsPunctual_Light | IKHRMaterialsClearcoat | IKHRMaterialsEmissiveStrength | IKHRMaterialsIor | IKHRMaterialsUnlit | IKHRMaterialsSheen | IKHRMaterialsSpecular | IKHRMaterialsTransmission | IKHRMaterialsTranslucency | IKHRMaterialVariants_Mapping | IKHRMaterialVariants_Variants | IKHRMaterialsAnisotropy | IKHRTextureBasisU | IKHRTextureTransform | IKHRXmp | IKHRXmp_Node | IGalaceanAnimation | IKHRMaterialsIridescence | IKHRMaterialsVolume | Object;
@@ -3,7 +3,7 @@ export declare let ready: Promise<{
3
3
  useWorkers: (count?: number) => void;
4
4
  decodeGltfBuffer: (count: any, stride: any, source: any, mode: any, filter: any) => Promise<Uint8Array>;
5
5
  release: () => void;
6
- }>;
6
+ }> | undefined;
7
7
  export declare function getMeshoptDecoder(): Promise<{
8
8
  workerCount: number;
9
9
  useWorkers: (count?: number) => void;
@@ -1,5 +1,6 @@
1
1
  import "./KHR_lights_punctual";
2
2
  import "./KHR_materials_clearcoat";
3
+ import "./KHR_materials_emissive_strength";
3
4
  import "./KHR_materials_ior";
4
5
  import "./KHR_materials_sheen";
5
6
  import "./KHR_materials_transmission";
@@ -2,6 +2,6 @@ import { AnimatorController, AssetPromise } from "@galacean/engine-core";
2
2
  import { GLTFParser } from "./GLTFParser";
3
3
  import { GLTFParserContext } from "./GLTFParserContext";
4
4
  export declare class GLTFAnimatorControllerParser extends GLTFParser {
5
- parse(context: GLTFParserContext): AssetPromise<AnimatorController>;
5
+ parse(context: GLTFParserContext): AssetPromise<AnimatorController | null>;
6
6
  private _createAnimatorController;
7
7
  }
@@ -17,7 +17,7 @@ export declare abstract class GLTFParser {
17
17
  */
18
18
  static executeExtensionsCreateAndParse(extensions: {
19
19
  [key: string]: any;
20
- }, context: GLTFParserContext, ownerSchema: GLTFExtensionOwnerSchema, ...extra: any[]): EngineObject | void | AssetPromise<EngineObject | Uint8Array | void>;
20
+ } | undefined, context: GLTFParserContext, ownerSchema: GLTFExtensionOwnerSchema, ...extra: any[]): EngineObject | void | AssetPromise<EngineObject | Uint8Array | void>;
21
21
  /**
22
22
  * Execute all parses of extension to parse resource.
23
23
  * @param extensions - Related extensions field
@@ -28,7 +28,7 @@ export declare abstract class GLTFParser {
28
28
  */
29
29
  static executeExtensionsAdditiveAndParse(extensions: {
30
30
  [key: string]: any;
31
- }, context: GLTFParserContext, parseResource: EngineObject, ownerSchema: GLTFExtensionOwnerSchema, ...extra: any[]): void;
31
+ } | undefined, context: GLTFParserContext, parseResource: EngineObject, ownerSchema: GLTFExtensionOwnerSchema, ...extra: any[]): void;
32
32
  /**
33
33
  * Whether the plugin is registered.
34
34
  * @param extensionName - Extension name
@@ -21,6 +21,7 @@ export declare class GLTFParserContext {
21
21
  /** @internal */
22
22
  _getPromises: AssetPromise<unknown>[];
23
23
  private _resourceCache;
24
+ private readonly _remoteAssetBaseURL;
24
25
  private _progress;
25
26
  /** @internal */
26
27
  _setTaskCompleteProgress: (loaded: number, total: number) => void;
@@ -30,10 +31,10 @@ export declare class GLTFParserContext {
30
31
  get<T>(type: GLTFParserType.Entity, index: number): Entity;
31
32
  get<T>(type: GLTFParserType.Entity): Entity[];
32
33
  get<T>(type: GLTFParserType.Schema): AssetPromise<T>;
33
- get<T>(type: GLTFParserType.Validator): AssetPromise<T>;
34
- get<T>(type: GLTFParserType.AnimatorController): AssetPromise<T>;
34
+ get<T>(type: GLTFParserType.Validator): AssetPromise<T | null>;
35
+ get<T>(type: GLTFParserType.AnimatorController): AssetPromise<T | null>;
35
36
  get<T>(type: GLTFParserType, index: number): AssetPromise<T>;
36
- get<T>(type: GLTFParserType): AssetPromise<T[]>;
37
+ get<T>(type: GLTFParserType): AssetPromise<T[] | null>;
37
38
  parse(): AssetPromise<GLTFResource>;
38
39
  /**
39
40
  * @internal
@@ -2,10 +2,10 @@ import { AssetPromise, Entity } from "@galacean/engine-core";
2
2
  import { GLTFParser } from "./GLTFParser";
3
3
  import { GLTFParserContext } from "./GLTFParserContext";
4
4
  export declare class GLTFSceneParser extends GLTFParser {
5
+ private static _tempMatrix;
5
6
  parse(context: GLTFParserContext, index: number): AssetPromise<Entity>;
6
7
  private _parseEntityComponent;
7
8
  private _createCamera;
8
9
  private _createRenderer;
9
10
  private _computeLocalBounds;
10
- private _computeApproximateBindMatrix;
11
11
  }
@@ -3,5 +3,9 @@ import { GLTFParser } from "./GLTFParser";
3
3
  import { GLTFParserContext } from "./GLTFParserContext";
4
4
  export declare class GLTFSkinParser extends GLTFParser {
5
5
  parse(context: GLTFParserContext, index: number): AssetPromise<Skin>;
6
+ /**
7
+ * Resolve the skeleton rootBone as the lowest common ancestor of the joints' parent chains.
8
+ * Returns null when joints share no common ancestor.
9
+ */
6
10
  private _findSkeletonRootBone;
7
11
  }
@@ -2,5 +2,5 @@ import { AssetPromise } from "@galacean/engine-core";
2
2
  import { GLTFParser } from "./GLTFParser";
3
3
  import { GLTFParserContext } from "./GLTFParserContext";
4
4
  export declare class GLTFValidator extends GLTFParser {
5
- parse(context: GLTFParserContext): AssetPromise<void>;
5
+ parse(context: GLTFParserContext): AssetPromise<null>;
6
6
  }
package/types/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import "./AnimationClipLoader";
2
2
  import "./AnimatorControllerLoader";
3
3
  import "./BufferLoader";
4
- import "./EnvLoader";
4
+ import "./AmbientLightLoader";
5
5
  import "./FontLoader";
6
6
  import "./GLTFLoader";
7
7
  import "./PrefabLoader";
@@ -9,27 +9,27 @@ import "./JSONLoader";
9
9
  import "./KTXCubeLoader";
10
10
  import "./KTXLoader";
11
11
  import "./MaterialLoader";
12
- import "./MeshLoader";
13
12
  import "./PrimitiveMeshLoader";
14
13
  import "./ProjectLoader";
15
14
  import "./SourceFontLoader";
16
15
  import "./SpriteAtlasLoader";
17
16
  import "./SpriteLoader";
18
17
  import "./TextLoader";
19
- import "./Texture2DLoader";
20
- import "./TextureCubeLoader";
18
+ import "./TextureLoader";
21
19
  import "./AudioLoader";
22
20
  import "./ktx2/KTX2Loader";
23
21
  import "./ShaderLoader";
24
- import "./ShaderChunkLoader";
25
22
  import "./PhysicsMaterialLoader";
23
+ import "./RenderTargetLoader";
26
24
  export { GLTFLoader } from "./GLTFLoader";
27
25
  export type { GLTFParams } from "./GLTFLoader";
28
- export * from "./SceneLoader";
29
- export type { Texture2DParams } from "./Texture2DLoader";
26
+ import "./SceneLoader";
27
+ export type { TextureParams } from "./TextureLoader";
28
+ export type { PrimitiveMeshAsset } from "./PrimitiveMeshAsset";
30
29
  export { parseSingleKTX } from "./compressed-texture";
31
30
  export * from "./gltf";
32
31
  export { KTX2Loader } from "./ktx2/KTX2Loader";
33
32
  export { KTX2TargetFormat } from "./ktx2/KTX2TargetFormat";
34
33
  export * from "./resource-deserialize";
35
34
  export * from "./prefab/PrefabResource";
35
+ export { HDRDecoder } from "./HDRDecoder";
@@ -15,6 +15,7 @@ export declare enum SupercompressionScheme {
15
15
  }
16
16
  /** @internal */
17
17
  export declare class KTX2Container {
18
+ static checkMagic(buffer: ArrayBuffer, offset?: number): boolean;
18
19
  vkFormat: number;
19
20
  typeSize: number;
20
21
  pixelWidth: number;