@babylonjs/serializers 5.0.0-rc.7 → 5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/OBJ/index.d.ts +1 -1
- package/OBJ/index.js +1 -1
- package/OBJ/objSerializer.d.ts +21 -21
- package/OBJ/objSerializer.js +174 -174
- package/OBJ/objSerializer.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_lights_punctual.d.ts +41 -41
- package/glTF/2.0/Extensions/KHR_lights_punctual.js +189 -189
- package/glTF/2.0/Extensions/KHR_lights_punctual.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.d.ts +24 -24
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js +90 -90
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_sheen.d.ts +24 -24
- package/glTF/2.0/Extensions/KHR_materials_sheen.js +73 -73
- package/glTF/2.0/Extensions/KHR_materials_sheen.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_unlit.d.ts +20 -20
- package/glTF/2.0/Extensions/KHR_materials_unlit.js +51 -51
- package/glTF/2.0/Extensions/KHR_materials_unlit.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_texture_transform.d.ts +30 -30
- package/glTF/2.0/Extensions/KHR_texture_transform.js +137 -137
- package/glTF/2.0/Extensions/KHR_texture_transform.js.map +1 -1
- package/glTF/2.0/Extensions/index.d.ts +5 -5
- package/glTF/2.0/Extensions/index.js +5 -5
- package/glTF/2.0/glTFAnimation.d.ts +206 -205
- package/glTF/2.0/glTFAnimation.js +852 -852
- package/glTF/2.0/glTFAnimation.js.map +1 -1
- package/glTF/2.0/glTFData.d.ts +19 -19
- package/glTF/2.0/glTFData.js +52 -52
- package/glTF/2.0/glTFExporter.d.ts +456 -455
- package/glTF/2.0/glTFExporter.js +1975 -1972
- package/glTF/2.0/glTFExporter.js.map +1 -1
- package/glTF/2.0/glTFExporterExtension.d.ts +74 -74
- package/glTF/2.0/glTFExporterExtension.js +3 -3
- package/glTF/2.0/glTFExporterExtension.js.map +1 -1
- package/glTF/2.0/glTFMaterialExporter.d.ts +208 -207
- package/glTF/2.0/glTFMaterialExporter.js +1114 -1114
- package/glTF/2.0/glTFMaterialExporter.js.map +1 -1
- package/glTF/2.0/glTFSerializer.d.ts +60 -60
- package/glTF/2.0/glTFSerializer.js +62 -62
- package/glTF/2.0/glTFSerializer.js.map +1 -1
- package/glTF/2.0/glTFUtilities.d.ts +99 -97
- package/glTF/2.0/glTFUtilities.js +196 -196
- package/glTF/2.0/glTFUtilities.js.map +1 -1
- package/glTF/2.0/index.d.ts +8 -8
- package/glTF/2.0/index.js +9 -8
- package/glTF/2.0/index.js.map +1 -1
- package/glTF/2.0/shaders/textureTransform.fragment.d.ts +5 -5
- package/glTF/2.0/shaders/textureTransform.fragment.js +8 -8
- package/glTF/glTFFileExporter.d.ts +20 -20
- package/glTF/glTFFileExporter.js +3 -3
- package/glTF/index.d.ts +2 -2
- package/glTF/index.js +3 -2
- package/glTF/index.js.map +1 -1
- package/index.d.ts +3 -3
- package/index.js +4 -3
- package/index.js.map +1 -1
- package/legacy/legacy-glTF2Serializer.d.ts +2 -2
- package/legacy/legacy-glTF2Serializer.js +44 -43
- package/legacy/legacy-glTF2Serializer.js.map +1 -1
- package/legacy/legacy-objSerializer.d.ts +1 -1
- package/legacy/legacy-objSerializer.js +13 -12
- package/legacy/legacy-objSerializer.js.map +1 -1
- package/legacy/legacy-stlSerializer.d.ts +1 -1
- package/legacy/legacy-stlSerializer.js +13 -12
- package/legacy/legacy-stlSerializer.js.map +1 -1
- package/legacy/legacy.d.ts +4 -4
- package/legacy/legacy.js +6 -5
- package/legacy/legacy.js.map +1 -1
- package/license.md +71 -0
- package/package.json +25 -6
- package/stl/index.d.ts +1 -1
- package/stl/index.js +1 -1
- package/stl/stlSerializer.d.ts +17 -17
- package/stl/stlSerializer.js +107 -107
- package/stl/stlSerializer.js.map +1 -1
|
@@ -1,455 +1,456 @@
|
|
|
1
|
-
import { IBufferView, IAccessor, INode, IMaterial, ITexture, IImage, ISampler,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
*
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
*
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
private
|
|
123
|
-
private
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
private
|
|
127
|
-
private static
|
|
128
|
-
private
|
|
129
|
-
private
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
private
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
*
|
|
147
|
-
* @param
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
*
|
|
154
|
-
* @param
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
*
|
|
160
|
-
* @
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
* @param
|
|
169
|
-
* @param
|
|
170
|
-
* @param
|
|
171
|
-
* @param
|
|
172
|
-
* @param
|
|
173
|
-
* @param
|
|
174
|
-
* @param
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
* @param
|
|
182
|
-
* @param
|
|
183
|
-
* @param
|
|
184
|
-
* @param
|
|
185
|
-
* @param
|
|
186
|
-
* @param
|
|
187
|
-
* @param
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
* @param
|
|
195
|
-
* @param
|
|
196
|
-
* @param
|
|
197
|
-
* @param
|
|
198
|
-
* @param
|
|
199
|
-
* @param
|
|
200
|
-
* @param
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
* @param
|
|
208
|
-
* @param
|
|
209
|
-
* @param
|
|
210
|
-
* @param
|
|
211
|
-
* @param
|
|
212
|
-
* @param
|
|
213
|
-
* @param
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
*
|
|
219
|
-
* @param
|
|
220
|
-
* @param
|
|
221
|
-
* @param
|
|
222
|
-
* @param
|
|
223
|
-
* @param
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
*
|
|
229
|
-
*
|
|
230
|
-
* @param
|
|
231
|
-
* @param
|
|
232
|
-
* @param
|
|
233
|
-
* @param
|
|
234
|
-
* @param
|
|
235
|
-
* @param
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
*
|
|
241
|
-
*
|
|
242
|
-
* @param
|
|
243
|
-
* @param
|
|
244
|
-
* @param
|
|
245
|
-
* @param
|
|
246
|
-
* @param
|
|
247
|
-
* @param
|
|
248
|
-
* @param
|
|
249
|
-
* @param
|
|
250
|
-
* @param
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
*
|
|
256
|
-
* @param
|
|
257
|
-
* @param
|
|
258
|
-
* @
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
*
|
|
264
|
-
* @param
|
|
265
|
-
* @
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
*
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
*
|
|
276
|
-
* @
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
* @param
|
|
282
|
-
* @
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
*
|
|
288
|
-
* @param
|
|
289
|
-
* @param
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
private
|
|
293
|
-
private
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
*
|
|
297
|
-
* @param
|
|
298
|
-
* @param
|
|
299
|
-
* @param
|
|
300
|
-
* @param
|
|
301
|
-
* @param
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
*
|
|
307
|
-
* @param
|
|
308
|
-
* @param
|
|
309
|
-
* @param
|
|
310
|
-
* @param
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
*
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
*
|
|
321
|
-
* @param
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
*
|
|
327
|
-
* @param
|
|
328
|
-
* @
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
*
|
|
334
|
-
* @param
|
|
335
|
-
* @param
|
|
336
|
-
* @param
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
*
|
|
342
|
-
* @
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
*
|
|
348
|
-
*
|
|
349
|
-
* @param
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
*
|
|
355
|
-
* @
|
|
356
|
-
* @returns
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
*
|
|
362
|
-
* @param
|
|
363
|
-
* @param
|
|
364
|
-
* @
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
*
|
|
370
|
-
* @param
|
|
371
|
-
* @param
|
|
372
|
-
* @
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
*
|
|
378
|
-
* @param
|
|
379
|
-
* @param
|
|
380
|
-
* @
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
*
|
|
387
|
-
*
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
*
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
*
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
*
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
*
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
*
|
|
425
|
-
* @param
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
*
|
|
431
|
-
* @param
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
*
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
*
|
|
446
|
-
* @param
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
*
|
|
452
|
-
* @param
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
1
|
+
import type { IBufferView, IAccessor, INode, IMaterial, ITexture, IImage, ISampler, IMeshPrimitive, IGLTF, ITextureInfo, ISkin } from "babylonjs-gltf2interface/.js";
|
|
2
|
+
import { ImageMimeType, AccessorComponentType } from "babylonjs-gltf2interface/.js";
|
|
3
|
+
import type { FloatArray, Nullable } from "@babylonjs/core/types.js";
|
|
4
|
+
import { Vector3, Vector4 } from "@babylonjs/core/Maths/math.vector.js";
|
|
5
|
+
import type { Node } from "@babylonjs/core/node.js";
|
|
6
|
+
import { TransformNode } from "@babylonjs/core/Meshes/transformNode.js";
|
|
7
|
+
import type { SubMesh } from "@babylonjs/core/Meshes/subMesh.js";
|
|
8
|
+
import type { MorphTarget } from "@babylonjs/core/Morph/morphTarget.js";
|
|
9
|
+
import type { BaseTexture } from "@babylonjs/core/Materials/Textures/baseTexture.js";
|
|
10
|
+
import type { Texture } from "@babylonjs/core/Materials/Textures/texture.js";
|
|
11
|
+
import { Material } from "@babylonjs/core/Materials/material.js";
|
|
12
|
+
import type { Scene } from "@babylonjs/core/scene.js";
|
|
13
|
+
import type { IGLTFExporterExtensionV2 } from "./glTFExporterExtension";
|
|
14
|
+
import { _GLTFMaterialExporter } from "./glTFMaterialExporter";
|
|
15
|
+
import type { IExportOptions } from "./glTFSerializer";
|
|
16
|
+
import { GLTFData } from "./glTFData";
|
|
17
|
+
/**
|
|
18
|
+
* Converts Babylon Scene into glTF 2.0.
|
|
19
|
+
* @hidden
|
|
20
|
+
*/
|
|
21
|
+
export declare class _Exporter {
|
|
22
|
+
/**
|
|
23
|
+
* Stores the glTF to export
|
|
24
|
+
*/
|
|
25
|
+
_glTF: IGLTF;
|
|
26
|
+
/**
|
|
27
|
+
* Stores all generated buffer views, which represents views into the main glTF buffer data
|
|
28
|
+
*/
|
|
29
|
+
_bufferViews: IBufferView[];
|
|
30
|
+
/**
|
|
31
|
+
* Stores all the generated accessors, which is used for accessing the data within the buffer views in glTF
|
|
32
|
+
*/
|
|
33
|
+
_accessors: IAccessor[];
|
|
34
|
+
/**
|
|
35
|
+
* Stores all the generated nodes, which contains transform and/or mesh information per node
|
|
36
|
+
*/
|
|
37
|
+
_nodes: INode[];
|
|
38
|
+
/**
|
|
39
|
+
* Stores all the generated glTF scenes, which stores multiple node hierarchies
|
|
40
|
+
*/
|
|
41
|
+
private _scenes;
|
|
42
|
+
/**
|
|
43
|
+
* Stores all the generated glTF cameras
|
|
44
|
+
*/
|
|
45
|
+
private _cameras;
|
|
46
|
+
/**
|
|
47
|
+
* Stores all the generated mesh information, each containing a set of primitives to render in glTF
|
|
48
|
+
*/
|
|
49
|
+
private _meshes;
|
|
50
|
+
/**
|
|
51
|
+
* Stores all the generated material information, which represents the appearance of each primitive
|
|
52
|
+
*/
|
|
53
|
+
_materials: IMaterial[];
|
|
54
|
+
_materialMap: {
|
|
55
|
+
[materialID: number]: number;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Stores all the generated texture information, which is referenced by glTF materials
|
|
59
|
+
*/
|
|
60
|
+
_textures: ITexture[];
|
|
61
|
+
/**
|
|
62
|
+
* Stores all the generated image information, which is referenced by glTF textures
|
|
63
|
+
*/
|
|
64
|
+
_images: IImage[];
|
|
65
|
+
/**
|
|
66
|
+
* Stores all the texture samplers
|
|
67
|
+
*/
|
|
68
|
+
_samplers: ISampler[];
|
|
69
|
+
/**
|
|
70
|
+
* Stores all the generated glTF skins
|
|
71
|
+
*/
|
|
72
|
+
_skins: ISkin[];
|
|
73
|
+
/**
|
|
74
|
+
* Stores all the generated animation samplers, which is referenced by glTF animations
|
|
75
|
+
*/
|
|
76
|
+
/**
|
|
77
|
+
* Stores the animations for glTF models
|
|
78
|
+
*/
|
|
79
|
+
private _animations;
|
|
80
|
+
/**
|
|
81
|
+
* Stores the total amount of bytes stored in the glTF buffer
|
|
82
|
+
*/
|
|
83
|
+
private _totalByteLength;
|
|
84
|
+
/**
|
|
85
|
+
* Stores a reference to the Babylon scene containing the source geometry and material information
|
|
86
|
+
*/
|
|
87
|
+
_babylonScene: Scene;
|
|
88
|
+
/**
|
|
89
|
+
* Stores a map of the image data, where the key is the file name and the value
|
|
90
|
+
* is the image data
|
|
91
|
+
*/
|
|
92
|
+
_imageData: {
|
|
93
|
+
[fileName: string]: {
|
|
94
|
+
data: Uint8Array;
|
|
95
|
+
mimeType: ImageMimeType;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
protected _orderedImageData: Array<{
|
|
99
|
+
data: Uint8Array;
|
|
100
|
+
mimeType: ImageMimeType;
|
|
101
|
+
}>;
|
|
102
|
+
/**
|
|
103
|
+
* Stores a map of the unique id of a node to its index in the node array
|
|
104
|
+
*/
|
|
105
|
+
_nodeMap: {
|
|
106
|
+
[key: number]: number;
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Specifies if the source Babylon scene was left handed, and needed conversion.
|
|
110
|
+
*/
|
|
111
|
+
_convertToRightHandedSystem: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Specifies if a Babylon node should be converted to right-handed on export
|
|
114
|
+
*/
|
|
115
|
+
_convertToRightHandedSystemMap: {
|
|
116
|
+
[nodeId: number]: boolean;
|
|
117
|
+
};
|
|
118
|
+
_includeCoordinateSystemConversionNodes: boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Baked animation sample rate
|
|
121
|
+
*/
|
|
122
|
+
private _animationSampleRate;
|
|
123
|
+
private _options;
|
|
124
|
+
private _localEngine;
|
|
125
|
+
_glTFMaterialExporter: _GLTFMaterialExporter;
|
|
126
|
+
private _extensions;
|
|
127
|
+
private static _ExtensionNames;
|
|
128
|
+
private static _ExtensionFactories;
|
|
129
|
+
private _applyExtension;
|
|
130
|
+
private _applyExtensions;
|
|
131
|
+
_extensionsPreExportTextureAsync(context: string, babylonTexture: Nullable<Texture>, mimeType: ImageMimeType): Promise<Nullable<BaseTexture>>;
|
|
132
|
+
_extensionsPostExportMeshPrimitiveAsync(context: string, meshPrimitive: IMeshPrimitive, babylonSubMesh: SubMesh, binaryWriter: _BinaryWriter): Promise<Nullable<IMeshPrimitive>>;
|
|
133
|
+
_extensionsPostExportNodeAsync(context: string, node: Nullable<INode>, babylonNode: Node, nodeMap?: {
|
|
134
|
+
[key: number]: number;
|
|
135
|
+
}): Promise<Nullable<INode>>;
|
|
136
|
+
_extensionsPostExportMaterialAsync(context: string, material: Nullable<IMaterial>, babylonMaterial: Material): Promise<Nullable<IMaterial>>;
|
|
137
|
+
_extensionsPostExportMaterialAdditionalTextures(context: string, material: IMaterial, babylonMaterial: Material): BaseTexture[];
|
|
138
|
+
_extensionsPostExportTextures(context: string, textureInfo: ITextureInfo, babylonTexture: BaseTexture): void;
|
|
139
|
+
private _forEachExtensions;
|
|
140
|
+
private _extensionsOnExporting;
|
|
141
|
+
/**
|
|
142
|
+
* Load glTF serializer extensions
|
|
143
|
+
*/
|
|
144
|
+
private _loadExtensions;
|
|
145
|
+
/**
|
|
146
|
+
* Creates a glTF Exporter instance, which can accept optional exporter options
|
|
147
|
+
* @param babylonScene Babylon scene object
|
|
148
|
+
* @param options Options to modify the behavior of the exporter
|
|
149
|
+
*/
|
|
150
|
+
constructor(babylonScene?: Nullable<Scene>, options?: IExportOptions);
|
|
151
|
+
dispose(): void;
|
|
152
|
+
/**
|
|
153
|
+
* Registers a glTF exporter extension
|
|
154
|
+
* @param name Name of the extension to export
|
|
155
|
+
* @param factory The factory function that creates the exporter extension
|
|
156
|
+
*/
|
|
157
|
+
static RegisterExtension(name: string, factory: (exporter: _Exporter) => IGLTFExporterExtensionV2): void;
|
|
158
|
+
/**
|
|
159
|
+
* Un-registers an exporter extension
|
|
160
|
+
* @param name The name fo the exporter extension
|
|
161
|
+
* @returns A boolean indicating whether the extension has been un-registered
|
|
162
|
+
*/
|
|
163
|
+
static UnregisterExtension(name: string): boolean;
|
|
164
|
+
private _reorderIndicesBasedOnPrimitiveMode;
|
|
165
|
+
/**
|
|
166
|
+
* Reorders the vertex attribute data based on the primitive mode. This is necessary when indices are not available and the winding order is
|
|
167
|
+
* clock-wise during export to glTF
|
|
168
|
+
* @param submesh BabylonJS submesh
|
|
169
|
+
* @param primitiveMode Primitive mode of the mesh
|
|
170
|
+
* @param sideOrientation the winding order of the submesh
|
|
171
|
+
* @param vertexBufferKind The type of vertex attribute
|
|
172
|
+
* @param meshAttributeArray The vertex attribute data
|
|
173
|
+
* @param byteOffset The offset to the binary data
|
|
174
|
+
* @param binaryWriter The binary data for the glTF file
|
|
175
|
+
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
176
|
+
*/
|
|
177
|
+
private _reorderVertexAttributeDataBasedOnPrimitiveMode;
|
|
178
|
+
/**
|
|
179
|
+
* Reorders the vertex attributes in the correct triangle mode order . This is necessary when indices are not available and the winding order is
|
|
180
|
+
* clock-wise during export to glTF
|
|
181
|
+
* @param submesh BabylonJS submesh
|
|
182
|
+
* @param primitiveMode Primitive mode of the mesh
|
|
183
|
+
* @param sideOrientation the winding order of the submesh
|
|
184
|
+
* @param vertexBufferKind The type of vertex attribute
|
|
185
|
+
* @param meshAttributeArray The vertex attribute data
|
|
186
|
+
* @param byteOffset The offset to the binary data
|
|
187
|
+
* @param binaryWriter The binary data for the glTF file
|
|
188
|
+
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
189
|
+
*/
|
|
190
|
+
private _reorderTriangleFillMode;
|
|
191
|
+
/**
|
|
192
|
+
* Reorders the vertex attributes in the correct triangle strip order. This is necessary when indices are not available and the winding order is
|
|
193
|
+
* clock-wise during export to glTF
|
|
194
|
+
* @param submesh BabylonJS submesh
|
|
195
|
+
* @param primitiveMode Primitive mode of the mesh
|
|
196
|
+
* @param sideOrientation the winding order of the submesh
|
|
197
|
+
* @param vertexBufferKind The type of vertex attribute
|
|
198
|
+
* @param meshAttributeArray The vertex attribute data
|
|
199
|
+
* @param byteOffset The offset to the binary data
|
|
200
|
+
* @param binaryWriter The binary data for the glTF file
|
|
201
|
+
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
202
|
+
*/
|
|
203
|
+
private _reorderTriangleStripDrawMode;
|
|
204
|
+
/**
|
|
205
|
+
* Reorders the vertex attributes in the correct triangle fan order. This is necessary when indices are not available and the winding order is
|
|
206
|
+
* clock-wise during export to glTF
|
|
207
|
+
* @param submesh BabylonJS submesh
|
|
208
|
+
* @param primitiveMode Primitive mode of the mesh
|
|
209
|
+
* @param sideOrientation the winding order of the submesh
|
|
210
|
+
* @param vertexBufferKind The type of vertex attribute
|
|
211
|
+
* @param meshAttributeArray The vertex attribute data
|
|
212
|
+
* @param byteOffset The offset to the binary data
|
|
213
|
+
* @param binaryWriter The binary data for the glTF file
|
|
214
|
+
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
215
|
+
*/
|
|
216
|
+
private _reorderTriangleFanMode;
|
|
217
|
+
/**
|
|
218
|
+
* Writes the vertex attribute data to binary
|
|
219
|
+
* @param vertices The vertices to write to the binary writer
|
|
220
|
+
* @param byteOffset The offset into the binary writer to overwrite binary data
|
|
221
|
+
* @param vertexAttributeKind The vertex attribute type
|
|
222
|
+
* @param meshAttributeArray The vertex attribute data
|
|
223
|
+
* @param binaryWriter The writer containing the binary data
|
|
224
|
+
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
225
|
+
*/
|
|
226
|
+
private _writeVertexAttributeData;
|
|
227
|
+
/**
|
|
228
|
+
* Writes mesh attribute data to a data buffer
|
|
229
|
+
* Returns the bytelength of the data
|
|
230
|
+
* @param vertexBufferKind Indicates what kind of vertex data is being passed in
|
|
231
|
+
* @param attributeComponentKind
|
|
232
|
+
* @param meshAttributeArray Array containing the attribute data
|
|
233
|
+
* @param stride Specifies the space between data
|
|
234
|
+
* @param binaryWriter The buffer to write the binary data to
|
|
235
|
+
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
236
|
+
* @param babylonTransformNode
|
|
237
|
+
*/
|
|
238
|
+
_writeAttributeData(vertexBufferKind: string, attributeComponentKind: AccessorComponentType, meshAttributeArray: FloatArray, stride: number, binaryWriter: _BinaryWriter, convertToRightHandedSystem: boolean, babylonTransformNode: TransformNode): void;
|
|
239
|
+
/**
|
|
240
|
+
* Writes mesh attribute data to a data buffer
|
|
241
|
+
* Returns the bytelength of the data
|
|
242
|
+
* @param vertexBufferKind Indicates what kind of vertex data is being passed in
|
|
243
|
+
* @param attributeComponentKind
|
|
244
|
+
* @param meshPrimitive
|
|
245
|
+
* @param morphTarget
|
|
246
|
+
* @param meshAttributeArray Array containing the attribute data
|
|
247
|
+
* @param morphTargetAttributeArray
|
|
248
|
+
* @param stride Specifies the space between data
|
|
249
|
+
* @param binaryWriter The buffer to write the binary data to
|
|
250
|
+
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
251
|
+
* @param minMax
|
|
252
|
+
*/
|
|
253
|
+
writeMorphTargetAttributeData(vertexBufferKind: string, attributeComponentKind: AccessorComponentType, meshPrimitive: SubMesh, morphTarget: MorphTarget, meshAttributeArray: FloatArray, morphTargetAttributeArray: FloatArray, stride: number, binaryWriter: _BinaryWriter, convertToRightHandedSystem: boolean, minMax?: any): void;
|
|
254
|
+
/**
|
|
255
|
+
* Generates glTF json data
|
|
256
|
+
* @param shouldUseGlb Indicates whether the json should be written for a glb file
|
|
257
|
+
* @param glTFPrefix Text to use when prefixing a glTF file
|
|
258
|
+
* @param prettyPrint Indicates whether the json file should be pretty printed (true) or not (false)
|
|
259
|
+
* @returns json data as string
|
|
260
|
+
*/
|
|
261
|
+
private _generateJSON;
|
|
262
|
+
/**
|
|
263
|
+
* Generates data for .gltf and .bin files based on the glTF prefix string
|
|
264
|
+
* @param glTFPrefix Text to use when prefixing a glTF file
|
|
265
|
+
* @param dispose Dispose the exporter
|
|
266
|
+
* @returns GLTFData with glTF file data
|
|
267
|
+
*/
|
|
268
|
+
_generateGLTFAsync(glTFPrefix: string, dispose?: boolean): Promise<GLTFData>;
|
|
269
|
+
/**
|
|
270
|
+
* Creates a binary buffer for glTF
|
|
271
|
+
* @returns array buffer for binary data
|
|
272
|
+
*/
|
|
273
|
+
private _generateBinaryAsync;
|
|
274
|
+
/**
|
|
275
|
+
* Pads the number to a multiple of 4
|
|
276
|
+
* @param num number to pad
|
|
277
|
+
* @returns padded number
|
|
278
|
+
*/
|
|
279
|
+
private _getPadding;
|
|
280
|
+
/**
|
|
281
|
+
* @param glTFPrefix
|
|
282
|
+
* @param dispose
|
|
283
|
+
* @hidden
|
|
284
|
+
*/
|
|
285
|
+
_generateGLBAsync(glTFPrefix: string, dispose?: boolean): Promise<GLTFData>;
|
|
286
|
+
/**
|
|
287
|
+
* Sets the TRS for each node
|
|
288
|
+
* @param node glTF Node for storing the transformation data
|
|
289
|
+
* @param babylonTransformNode Babylon mesh used as the source for the transformation data
|
|
290
|
+
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
291
|
+
*/
|
|
292
|
+
private _setNodeTransformation;
|
|
293
|
+
private _setCameraTransformation;
|
|
294
|
+
private _getVertexBufferFromMesh;
|
|
295
|
+
/**
|
|
296
|
+
* Creates a bufferview based on the vertices type for the Babylon mesh
|
|
297
|
+
* @param kind Indicates the type of vertices data
|
|
298
|
+
* @param attributeComponentKind Indicates the numerical type used to store the data
|
|
299
|
+
* @param babylonTransformNode The Babylon mesh to get the vertices data from
|
|
300
|
+
* @param binaryWriter The buffer to write the bufferview data to
|
|
301
|
+
* @param byteStride
|
|
302
|
+
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
303
|
+
*/
|
|
304
|
+
private _createBufferViewKind;
|
|
305
|
+
/**
|
|
306
|
+
* Creates a bufferview based on the vertices type for the Babylon mesh
|
|
307
|
+
* @param babylonSubMesh The Babylon submesh that the morph target is applied to
|
|
308
|
+
* @param meshPrimitive
|
|
309
|
+
* @param babylonMorphTarget the morph target to be exported
|
|
310
|
+
* @param binaryWriter The buffer to write the bufferview data to
|
|
311
|
+
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
312
|
+
*/
|
|
313
|
+
private _setMorphTargetAttributes;
|
|
314
|
+
/**
|
|
315
|
+
* The primitive mode of the Babylon mesh
|
|
316
|
+
* @param babylonMesh The BabylonJS mesh
|
|
317
|
+
*/
|
|
318
|
+
private _getMeshPrimitiveMode;
|
|
319
|
+
/**
|
|
320
|
+
* Sets the primitive mode of the glTF mesh primitive
|
|
321
|
+
* @param meshPrimitive glTF mesh primitive
|
|
322
|
+
* @param primitiveMode The primitive mode
|
|
323
|
+
*/
|
|
324
|
+
private _setPrimitiveMode;
|
|
325
|
+
/**
|
|
326
|
+
* Sets the vertex attribute accessor based of the glTF mesh primitive
|
|
327
|
+
* @param meshPrimitive glTF mesh primitive
|
|
328
|
+
* @param attributeKind vertex attribute
|
|
329
|
+
* @returns boolean specifying if uv coordinates are present
|
|
330
|
+
*/
|
|
331
|
+
private _setAttributeKind;
|
|
332
|
+
/**
|
|
333
|
+
* Sets data for the primitive attributes of each submesh
|
|
334
|
+
* @param mesh glTF Mesh object to store the primitive attribute information
|
|
335
|
+
* @param babylonTransformNode Babylon mesh to get the primitive attribute data from
|
|
336
|
+
* @param binaryWriter Buffer to write the attribute data to
|
|
337
|
+
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
338
|
+
*/
|
|
339
|
+
private _setPrimitiveAttributesAsync;
|
|
340
|
+
/**
|
|
341
|
+
* Check if the node is used to convert its descendants from a right handed coordinate system to the Babylon scene's coordinate system.
|
|
342
|
+
* @param node The node to check
|
|
343
|
+
* @returns True if the node is used to convert its descendants from right-handed to left-handed. False otherwise
|
|
344
|
+
*/
|
|
345
|
+
private _isBabylonCoordinateSystemConvertingNode;
|
|
346
|
+
/**
|
|
347
|
+
* Creates a glTF scene based on the array of meshes
|
|
348
|
+
* Returns the the total byte offset
|
|
349
|
+
* @param babylonScene Babylon scene to get the mesh data from
|
|
350
|
+
* @param binaryWriter Buffer to write binary data to
|
|
351
|
+
*/
|
|
352
|
+
private _createSceneAsync;
|
|
353
|
+
/**
|
|
354
|
+
* Getting the nodes and materials that would be exported.
|
|
355
|
+
* @param nodes Babylon transform nodes
|
|
356
|
+
* @returns Array of nodes which would be exported.
|
|
357
|
+
* @returns Set of materials which would be exported.
|
|
358
|
+
*/
|
|
359
|
+
private _getExportNodes;
|
|
360
|
+
/**
|
|
361
|
+
* Creates a mapping of Node unique id to node index and handles animations
|
|
362
|
+
* @param babylonScene Babylon Scene
|
|
363
|
+
* @param nodes Babylon transform nodes
|
|
364
|
+
* @param binaryWriter Buffer to write binary data to
|
|
365
|
+
* @returns Node mapping of unique id to index
|
|
366
|
+
*/
|
|
367
|
+
private _createNodeMapAndAnimationsAsync;
|
|
368
|
+
/**
|
|
369
|
+
* Creates a glTF node from a Babylon mesh
|
|
370
|
+
* @param babylonNode Source Babylon mesh
|
|
371
|
+
* @param binaryWriter Buffer for storing geometry data
|
|
372
|
+
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
373
|
+
* @returns glTF node
|
|
374
|
+
*/
|
|
375
|
+
private _createNodeAsync;
|
|
376
|
+
/**
|
|
377
|
+
* Creates a glTF skin from a Babylon skeleton
|
|
378
|
+
* @param babylonScene Babylon Scene
|
|
379
|
+
* @param nodeMap Babylon transform nodes
|
|
380
|
+
* @param binaryWriter Buffer to write binary data to
|
|
381
|
+
* @returns Node mapping of unique id to index
|
|
382
|
+
*/
|
|
383
|
+
private _createSkinsAsync;
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* @hidden
|
|
387
|
+
*
|
|
388
|
+
* Stores glTF binary data. If the array buffer byte length is exceeded, it doubles in size dynamically
|
|
389
|
+
*/
|
|
390
|
+
export declare class _BinaryWriter {
|
|
391
|
+
/**
|
|
392
|
+
* Array buffer which stores all binary data
|
|
393
|
+
*/
|
|
394
|
+
private _arrayBuffer;
|
|
395
|
+
/**
|
|
396
|
+
* View of the array buffer
|
|
397
|
+
*/
|
|
398
|
+
private _dataView;
|
|
399
|
+
/**
|
|
400
|
+
* byte offset of data in array buffer
|
|
401
|
+
*/
|
|
402
|
+
private _byteOffset;
|
|
403
|
+
/**
|
|
404
|
+
* Initialize binary writer with an initial byte length
|
|
405
|
+
* @param byteLength Initial byte length of the array buffer
|
|
406
|
+
*/
|
|
407
|
+
constructor(byteLength: number);
|
|
408
|
+
/**
|
|
409
|
+
* Resize the array buffer to the specified byte length
|
|
410
|
+
* @param byteLength
|
|
411
|
+
*/
|
|
412
|
+
private _resizeBuffer;
|
|
413
|
+
/**
|
|
414
|
+
* Get an array buffer with the length of the byte offset
|
|
415
|
+
* @returns ArrayBuffer resized to the byte offset
|
|
416
|
+
*/
|
|
417
|
+
getArrayBuffer(): ArrayBuffer;
|
|
418
|
+
/**
|
|
419
|
+
* Get the byte offset of the array buffer
|
|
420
|
+
* @returns byte offset
|
|
421
|
+
*/
|
|
422
|
+
getByteOffset(): number;
|
|
423
|
+
/**
|
|
424
|
+
* Stores an UInt8 in the array buffer
|
|
425
|
+
* @param entry
|
|
426
|
+
* @param byteOffset If defined, specifies where to set the value as an offset.
|
|
427
|
+
*/
|
|
428
|
+
setUInt8(entry: number, byteOffset?: number): void;
|
|
429
|
+
/**
|
|
430
|
+
* Stores an UInt16 in the array buffer
|
|
431
|
+
* @param entry
|
|
432
|
+
* @param byteOffset If defined, specifies where to set the value as an offset.
|
|
433
|
+
*/
|
|
434
|
+
setUInt16(entry: number, byteOffset?: number): void;
|
|
435
|
+
/**
|
|
436
|
+
* Gets an UInt32 in the array buffer
|
|
437
|
+
* @param byteOffset If defined, specifies where to set the value as an offset.
|
|
438
|
+
*/
|
|
439
|
+
getUInt32(byteOffset: number): number;
|
|
440
|
+
getVector3Float32FromRef(vector3: Vector3, byteOffset: number): void;
|
|
441
|
+
setVector3Float32FromRef(vector3: Vector3, byteOffset: number): void;
|
|
442
|
+
getVector4Float32FromRef(vector4: Vector4, byteOffset: number): void;
|
|
443
|
+
setVector4Float32FromRef(vector4: Vector4, byteOffset: number): void;
|
|
444
|
+
/**
|
|
445
|
+
* Stores a Float32 in the array buffer
|
|
446
|
+
* @param entry
|
|
447
|
+
* @param byteOffset
|
|
448
|
+
*/
|
|
449
|
+
setFloat32(entry: number, byteOffset?: number): void;
|
|
450
|
+
/**
|
|
451
|
+
* Stores an UInt32 in the array buffer
|
|
452
|
+
* @param entry
|
|
453
|
+
* @param byteOffset If defined, specifies where to set the value as an offset.
|
|
454
|
+
*/
|
|
455
|
+
setUInt32(entry: number, byteOffset?: number): void;
|
|
456
|
+
}
|