@galacean/engine-loader 2.0.0-alpha.55 → 2.0.0-alpha.57
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 +174 -70
- package/dist/main.js.map +1 -1
- package/dist/module.js +174 -70
- package/dist/module.js.map +1 -1
- package/package.json +4 -4
- package/types/ImageDecoder.d.ts +13 -0
- package/types/PrimitiveMeshAsset.d.ts +238 -0
- package/types/gltf/extensions/GLTFExtensionSchema.d.ts +7 -1
- package/types/gltf/extensions/KHR_materials_emissive_strength.d.ts +1 -0
- package/types/gltf/extensions/index.d.ts +1 -0
- package/types/index.d.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@galacean/engine-loader",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.57",
|
|
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-
|
|
23
|
-
"@galacean/engine-
|
|
24
|
-
"@galacean/engine-
|
|
22
|
+
"@galacean/engine-math": "2.0.0-alpha.57",
|
|
23
|
+
"@galacean/engine-core": "2.0.0-alpha.57",
|
|
24
|
+
"@galacean/engine-rhi-webgl": "2.0.0-alpha.57"
|
|
25
25
|
},
|
|
26
26
|
"scripts": {
|
|
27
27
|
"b:types": "tsc"
|
|
@@ -0,0 +1,13 @@
|
|
|
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 MIME type detected from the bytes: browsers sniff an untyped
|
|
6
|
+
* blob, but some platforms (for example mini-game runtimes) only decode images whose type is declared.
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export declare class ImageDecoder {
|
|
10
|
+
static _decode(data: ArrayBuffer | Uint8Array, url: string): AssetPromise<HTMLImageElement>;
|
|
11
|
+
private static _getMimeType;
|
|
12
|
+
private static _releaseObjectUrl;
|
|
13
|
+
}
|
|
@@ -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 {};
|
|
@@ -29,6 +29,12 @@ export interface IKHRMaterialsClearcoat {
|
|
|
29
29
|
clearcoatRoughnessTexture?: ITextureInfo;
|
|
30
30
|
clearcoatNormalTexture?: IMaterialNormalTextureInfo;
|
|
31
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Interfaces from the KHR_materials_emissive_strength extension
|
|
34
|
+
*/
|
|
35
|
+
export interface IKHRMaterialsEmissiveStrength {
|
|
36
|
+
emissiveStrength?: number;
|
|
37
|
+
}
|
|
32
38
|
/**
|
|
33
39
|
* Interfaces from the KHR_materials_ior extension
|
|
34
40
|
*/
|
|
@@ -164,4 +170,4 @@ export interface IKHRMaterialsVolume {
|
|
|
164
170
|
attenuationDistance?: number;
|
|
165
171
|
attenuationColor?: number[];
|
|
166
172
|
}
|
|
167
|
-
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/types/index.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ export { GLTFLoader } from "./GLTFLoader";
|
|
|
26
26
|
export type { GLTFParams } from "./GLTFLoader";
|
|
27
27
|
import "./SceneLoader";
|
|
28
28
|
export type { TextureParams } from "./TextureLoader";
|
|
29
|
+
export type { PrimitiveMeshAsset } from "./PrimitiveMeshAsset";
|
|
29
30
|
export { parseSingleKTX } from "./compressed-texture";
|
|
30
31
|
export * from "./gltf";
|
|
31
32
|
export { KTX2Loader } from "./ktx2/KTX2Loader";
|