@inweb/viewer-three 26.8.0 → 26.8.2
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/plugins/components/RoomEnvironmentComponent.js +75 -40
- package/dist/plugins/components/RoomEnvironmentComponent.js.map +1 -1
- package/dist/plugins/components/RoomEnvironmentComponent.min.js +1 -1
- package/dist/plugins/components/StatsPanelComponent.js +1 -1
- package/dist/plugins/components/StatsPanelComponent.js.map +1 -1
- package/dist/plugins/components/StatsPanelComponent.min.js +1 -1
- package/dist/plugins/components/StatsPanelComponent.module.js +1 -1
- package/dist/plugins/components/StatsPanelComponent.module.js.map +1 -1
- package/dist/plugins/loaders/GLTFCloudLoader.js +225 -94
- package/dist/plugins/loaders/GLTFCloudLoader.js.map +1 -1
- package/dist/plugins/loaders/GLTFCloudLoader.min.js +1 -1
- package/dist/plugins/loaders/IFCXLoader.js +1977 -881
- package/dist/plugins/loaders/IFCXLoader.js.map +1 -1
- package/dist/plugins/loaders/IFCXLoader.min.js +1 -1
- package/dist/plugins/loaders/IFCXLoader.module.js +477 -154
- package/dist/plugins/loaders/IFCXLoader.module.js.map +1 -1
- package/dist/viewer-three.js +31149 -5503
- package/dist/viewer-three.js.map +1 -1
- package/dist/viewer-three.min.js +3 -3
- package/dist/viewer-three.module.js +406 -298
- package/dist/viewer-three.module.js.map +1 -1
- package/lib/Viewer/Viewer.d.ts +17 -3
- package/lib/Viewer/commands/SetDefaultViewPosition.d.ts +6 -6
- package/lib/Viewer/components/HighlighterComponent.d.ts +5 -4
- package/lib/Viewer/components/SelectionComponent.d.ts +1 -1
- package/lib/Viewer/loaders/DynamicGltfLoader/DynamicModelImpl.d.ts +3 -1
- package/lib/Viewer/models/IModelImpl.d.ts +27 -0
- package/lib/Viewer/models/ModelImpl.d.ts +27 -0
- package/lib/Viewer/scenes/Helpers.d.ts +7 -0
- package/lib/index.d.ts +2 -1
- package/package.json +9 -9
- package/plugins/components/StatsPanelComponent.ts +1 -1
- package/plugins/loaders/IFCX/IFCXLoader.ts +4 -7
- package/plugins/loaders/IFCX/render.js +686 -181
- package/plugins/loaders/IFCXCloudLoader.ts +1 -1
- package/src/Viewer/Viewer.ts +124 -48
- package/src/Viewer/commands/SetDefaultViewPosition.ts +8 -8
- package/src/Viewer/components/CameraComponent.ts +20 -16
- package/src/Viewer/components/ExtentsComponent.ts +1 -0
- package/src/Viewer/components/HighlighterComponent.ts +78 -80
- package/src/Viewer/components/LightComponent.ts +10 -4
- package/src/Viewer/components/ResizeCanvasComponent.ts +1 -0
- package/src/Viewer/components/SelectionComponent.ts +1 -1
- package/src/Viewer/helpers/WCSHelper.ts +8 -5
- package/src/Viewer/loaders/DynamicGltfLoader/DynamicGltfLoader.js +33 -16
- package/src/Viewer/loaders/DynamicGltfLoader/DynamicModelImpl.ts +12 -5
- package/src/Viewer/loaders/DynamicGltfLoader/GltfStructure.js +100 -20
- package/src/Viewer/loaders/GLTFCloudDynamicLoader.ts +4 -2
- package/src/Viewer/loaders/GLTFFileLoader.ts +1 -1
- package/src/Viewer/models/IModelImpl.ts +67 -0
- package/src/Viewer/models/ModelImpl.ts +214 -0
- package/src/Viewer/postprocessing/SSAARenderPass.js +245 -0
- package/src/Viewer/scenes/Helpers.ts +42 -0
- package/src/index.ts +2 -1
|
@@ -5,9 +5,12 @@
|
|
|
5
5
|
})(this, (function (three, viewerThree) { 'use strict';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* Returns a new indexed geometry based on `TrianglesDrawMode` draw mode.
|
|
9
|
+
* This mode corresponds to the `gl.TRIANGLES` primitive in WebGL.
|
|
10
|
+
*
|
|
11
|
+
* @param {BufferGeometry} geometry - The geometry to convert.
|
|
12
|
+
* @param {number} drawMode - The current draw mode.
|
|
13
|
+
* @return {BufferGeometry} The new geometry using `TrianglesDrawMode`.
|
|
11
14
|
*/
|
|
12
15
|
function toTrianglesDrawMode( geometry, drawMode ) {
|
|
13
16
|
|
|
@@ -114,8 +117,63 @@
|
|
|
114
117
|
|
|
115
118
|
}
|
|
116
119
|
|
|
120
|
+
/**
|
|
121
|
+
* A loader for the glTF 2.0 format.
|
|
122
|
+
*
|
|
123
|
+
* [glTF]{@link https://www.khronos.org/gltf/} (GL Transmission Format) is an [open format specification]{@link https://github.com/KhronosGroup/glTF/tree/main/specification/2.0}
|
|
124
|
+
* for efficient delivery and loading of 3D content. Assets may be provided either in JSON (.gltf) or binary (.glb)
|
|
125
|
+
* format. External files store textures (.jpg, .png) and additional binary data (.bin). A glTF asset may deliver
|
|
126
|
+
* one or more scenes, including meshes, materials, textures, skins, skeletons, morph targets, animations, lights,
|
|
127
|
+
* and/or cameras.
|
|
128
|
+
*
|
|
129
|
+
* `GLTFLoader` uses {@link ImageBitmapLoader} whenever possible. Be advised that image bitmaps are not
|
|
130
|
+
* automatically GC-collected when they are no longer referenced, and they require special handling during
|
|
131
|
+
* the disposal process.
|
|
132
|
+
*
|
|
133
|
+
* `GLTFLoader` supports the following glTF 2.0 extensions:
|
|
134
|
+
* - KHR_draco_mesh_compression
|
|
135
|
+
* - KHR_materials_clearcoat
|
|
136
|
+
* - KHR_materials_dispersion
|
|
137
|
+
* - KHR_materials_ior
|
|
138
|
+
* - KHR_materials_specular
|
|
139
|
+
* - KHR_materials_transmission
|
|
140
|
+
* - KHR_materials_iridescence
|
|
141
|
+
* - KHR_materials_unlit
|
|
142
|
+
* - KHR_materials_volume
|
|
143
|
+
* - KHR_mesh_quantization
|
|
144
|
+
* - KHR_lights_punctual
|
|
145
|
+
* - KHR_texture_basisu
|
|
146
|
+
* - KHR_texture_transform
|
|
147
|
+
* - EXT_texture_webp
|
|
148
|
+
* - EXT_meshopt_compression
|
|
149
|
+
* - EXT_mesh_gpu_instancing
|
|
150
|
+
*
|
|
151
|
+
* The following glTF 2.0 extension is supported by an external user plugin:
|
|
152
|
+
* - [KHR_materials_variants]{@link https://github.com/takahirox/three-gltf-extensions}
|
|
153
|
+
* - [MSFT_texture_dds]{@link https://github.com/takahirox/three-gltf-extensions}
|
|
154
|
+
*
|
|
155
|
+
* ```js
|
|
156
|
+
* const loader = new GLTFLoader();
|
|
157
|
+
*
|
|
158
|
+
* // Optional: Provide a DRACOLoader instance to decode compressed mesh data
|
|
159
|
+
* const dracoLoader = new DRACOLoader();
|
|
160
|
+
* dracoLoader.setDecoderPath( '/examples/jsm/libs/draco/' );
|
|
161
|
+
* loader.setDRACOLoader( dracoLoader );
|
|
162
|
+
*
|
|
163
|
+
* const gltf = await loader.loadAsync( 'models/gltf/duck/duck.gltf' );
|
|
164
|
+
* scene.add( gltf.scene );
|
|
165
|
+
* ```
|
|
166
|
+
*
|
|
167
|
+
* @augments Loader
|
|
168
|
+
* @three_import import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
|
|
169
|
+
*/
|
|
117
170
|
class GLTFLoader extends three.Loader {
|
|
118
171
|
|
|
172
|
+
/**
|
|
173
|
+
* Constructs a new glTF loader.
|
|
174
|
+
*
|
|
175
|
+
* @param {LoadingManager} [manager] - The loading manager.
|
|
176
|
+
*/
|
|
119
177
|
constructor( manager ) {
|
|
120
178
|
|
|
121
179
|
super( manager );
|
|
@@ -230,6 +288,15 @@
|
|
|
230
288
|
|
|
231
289
|
}
|
|
232
290
|
|
|
291
|
+
/**
|
|
292
|
+
* Starts loading from the given URL and passes the loaded glTF asset
|
|
293
|
+
* to the `onLoad()` callback.
|
|
294
|
+
*
|
|
295
|
+
* @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
|
|
296
|
+
* @param {function(GLTFLoader~LoadObject)} onLoad - Executed when the loading process has been finished.
|
|
297
|
+
* @param {onProgressCallback} onProgress - Executed while the loading is in progress.
|
|
298
|
+
* @param {onErrorCallback} onError - Executed when errors occur.
|
|
299
|
+
*/
|
|
233
300
|
load( url, onLoad, onProgress, onError ) {
|
|
234
301
|
|
|
235
302
|
const scope = this;
|
|
@@ -307,6 +374,13 @@
|
|
|
307
374
|
|
|
308
375
|
}
|
|
309
376
|
|
|
377
|
+
/**
|
|
378
|
+
* Sets the given Draco loader to this loader. Required for decoding assets
|
|
379
|
+
* compressed with the `KHR_draco_mesh_compression` extension.
|
|
380
|
+
*
|
|
381
|
+
* @param {DRACOLoader} dracoLoader - The Draco loader to set.
|
|
382
|
+
* @return {GLTFLoader} A reference to this loader.
|
|
383
|
+
*/
|
|
310
384
|
setDRACOLoader( dracoLoader ) {
|
|
311
385
|
|
|
312
386
|
this.dracoLoader = dracoLoader;
|
|
@@ -314,6 +388,13 @@
|
|
|
314
388
|
|
|
315
389
|
}
|
|
316
390
|
|
|
391
|
+
/**
|
|
392
|
+
* Sets the given KTX2 loader to this loader. Required for loading KTX2
|
|
393
|
+
* compressed textures.
|
|
394
|
+
*
|
|
395
|
+
* @param {KTX2Loader} ktx2Loader - The KTX2 loader to set.
|
|
396
|
+
* @return {GLTFLoader} A reference to this loader.
|
|
397
|
+
*/
|
|
317
398
|
setKTX2Loader( ktx2Loader ) {
|
|
318
399
|
|
|
319
400
|
this.ktx2Loader = ktx2Loader;
|
|
@@ -321,6 +402,13 @@
|
|
|
321
402
|
|
|
322
403
|
}
|
|
323
404
|
|
|
405
|
+
/**
|
|
406
|
+
* Sets the given meshopt decoder. Required for decoding assets
|
|
407
|
+
* compressed with the `EXT_meshopt_compression` extension.
|
|
408
|
+
*
|
|
409
|
+
* @param {Object} meshoptDecoder - The meshopt decoder to set.
|
|
410
|
+
* @return {GLTFLoader} A reference to this loader.
|
|
411
|
+
*/
|
|
324
412
|
setMeshoptDecoder( meshoptDecoder ) {
|
|
325
413
|
|
|
326
414
|
this.meshoptDecoder = meshoptDecoder;
|
|
@@ -328,6 +416,14 @@
|
|
|
328
416
|
|
|
329
417
|
}
|
|
330
418
|
|
|
419
|
+
/**
|
|
420
|
+
* Registers a plugin callback. This API is internally used to implement the various
|
|
421
|
+
* glTF extensions but can also used by third-party code to add additional logic
|
|
422
|
+
* to the loader.
|
|
423
|
+
*
|
|
424
|
+
* @param {function(parser:GLTFParser)} callback - The callback function to register.
|
|
425
|
+
* @return {GLTFLoader} A reference to this loader.
|
|
426
|
+
*/
|
|
331
427
|
register( callback ) {
|
|
332
428
|
|
|
333
429
|
if ( this.pluginCallbacks.indexOf( callback ) === -1 ) {
|
|
@@ -340,6 +436,12 @@
|
|
|
340
436
|
|
|
341
437
|
}
|
|
342
438
|
|
|
439
|
+
/**
|
|
440
|
+
* Unregisters a plugin callback.
|
|
441
|
+
*
|
|
442
|
+
* @param {Function} callback - The callback function to unregister.
|
|
443
|
+
* @return {GLTFLoader} A reference to this loader.
|
|
444
|
+
*/
|
|
343
445
|
unregister( callback ) {
|
|
344
446
|
|
|
345
447
|
if ( this.pluginCallbacks.indexOf( callback ) !== -1 ) {
|
|
@@ -352,6 +454,14 @@
|
|
|
352
454
|
|
|
353
455
|
}
|
|
354
456
|
|
|
457
|
+
/**
|
|
458
|
+
* Parses the given FBX data and returns the resulting group.
|
|
459
|
+
*
|
|
460
|
+
* @param {string|ArrayBuffer} data - The raw glTF data.
|
|
461
|
+
* @param {string} path - The URL base path.
|
|
462
|
+
* @param {function(GLTFLoader~LoadObject)} onLoad - Executed when the loading process has been finished.
|
|
463
|
+
* @param {onErrorCallback} onError - Executed when errors occur.
|
|
464
|
+
*/
|
|
355
465
|
parse( data, path, onLoad, onError ) {
|
|
356
466
|
|
|
357
467
|
let json;
|
|
@@ -475,6 +585,14 @@
|
|
|
475
585
|
|
|
476
586
|
}
|
|
477
587
|
|
|
588
|
+
/**
|
|
589
|
+
* Async version of {@link GLTFLoader#parse}.
|
|
590
|
+
*
|
|
591
|
+
* @async
|
|
592
|
+
* @param {string|ArrayBuffer} data - The raw glTF data.
|
|
593
|
+
* @param {string} path - The URL base path.
|
|
594
|
+
* @return {Promise<GLTFLoader~LoadObject>} A Promise that resolves with the loaded glTF when the parsing has been finished.
|
|
595
|
+
*/
|
|
478
596
|
parseAsync( data, path ) {
|
|
479
597
|
|
|
480
598
|
const scope = this;
|
|
@@ -558,6 +676,8 @@
|
|
|
558
676
|
* Punctual Lights Extension
|
|
559
677
|
*
|
|
560
678
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_lights_punctual
|
|
679
|
+
*
|
|
680
|
+
* @private
|
|
561
681
|
*/
|
|
562
682
|
class GLTFLightsExtension {
|
|
563
683
|
|
|
@@ -694,6 +814,8 @@
|
|
|
694
814
|
* Unlit Materials Extension
|
|
695
815
|
*
|
|
696
816
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_unlit
|
|
817
|
+
*
|
|
818
|
+
* @private
|
|
697
819
|
*/
|
|
698
820
|
class GLTFMaterialsUnlitExtension {
|
|
699
821
|
|
|
@@ -747,6 +869,8 @@
|
|
|
747
869
|
* Materials Emissive Strength Extension
|
|
748
870
|
*
|
|
749
871
|
* Specification: https://github.com/KhronosGroup/glTF/blob/5768b3ce0ef32bc39cdf1bef10b948586635ead3/extensions/2.0/Khronos/KHR_materials_emissive_strength/README.md
|
|
872
|
+
*
|
|
873
|
+
* @private
|
|
750
874
|
*/
|
|
751
875
|
class GLTFMaterialsEmissiveStrengthExtension {
|
|
752
876
|
|
|
@@ -786,6 +910,8 @@
|
|
|
786
910
|
* Clearcoat Materials Extension
|
|
787
911
|
*
|
|
788
912
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_clearcoat
|
|
913
|
+
*
|
|
914
|
+
* @private
|
|
789
915
|
*/
|
|
790
916
|
class GLTFMaterialsClearcoatExtension {
|
|
791
917
|
|
|
@@ -870,6 +996,8 @@
|
|
|
870
996
|
* Materials dispersion Extension
|
|
871
997
|
*
|
|
872
998
|
* Specification: https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_dispersion
|
|
999
|
+
*
|
|
1000
|
+
* @private
|
|
873
1001
|
*/
|
|
874
1002
|
class GLTFMaterialsDispersionExtension {
|
|
875
1003
|
|
|
@@ -916,6 +1044,8 @@
|
|
|
916
1044
|
* Iridescence Materials Extension
|
|
917
1045
|
*
|
|
918
1046
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_iridescence
|
|
1047
|
+
*
|
|
1048
|
+
* @private
|
|
919
1049
|
*/
|
|
920
1050
|
class GLTFMaterialsIridescenceExtension {
|
|
921
1051
|
|
|
@@ -1004,6 +1134,8 @@
|
|
|
1004
1134
|
* Sheen Materials Extension
|
|
1005
1135
|
*
|
|
1006
1136
|
* Specification: https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_sheen
|
|
1137
|
+
*
|
|
1138
|
+
* @private
|
|
1007
1139
|
*/
|
|
1008
1140
|
class GLTFMaterialsSheenExtension {
|
|
1009
1141
|
|
|
@@ -1080,6 +1212,8 @@
|
|
|
1080
1212
|
*
|
|
1081
1213
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_transmission
|
|
1082
1214
|
* Draft: https://github.com/KhronosGroup/glTF/pull/1698
|
|
1215
|
+
*
|
|
1216
|
+
* @private
|
|
1083
1217
|
*/
|
|
1084
1218
|
class GLTFMaterialsTransmissionExtension {
|
|
1085
1219
|
|
|
@@ -1138,6 +1272,8 @@
|
|
|
1138
1272
|
* Materials Volume Extension
|
|
1139
1273
|
*
|
|
1140
1274
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_volume
|
|
1275
|
+
*
|
|
1276
|
+
* @private
|
|
1141
1277
|
*/
|
|
1142
1278
|
class GLTFMaterialsVolumeExtension {
|
|
1143
1279
|
|
|
@@ -1197,6 +1333,8 @@
|
|
|
1197
1333
|
* Materials ior Extension
|
|
1198
1334
|
*
|
|
1199
1335
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_ior
|
|
1336
|
+
*
|
|
1337
|
+
* @private
|
|
1200
1338
|
*/
|
|
1201
1339
|
class GLTFMaterialsIorExtension {
|
|
1202
1340
|
|
|
@@ -1243,6 +1381,8 @@
|
|
|
1243
1381
|
* Materials specular Extension
|
|
1244
1382
|
*
|
|
1245
1383
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_specular
|
|
1384
|
+
*
|
|
1385
|
+
* @private
|
|
1246
1386
|
*/
|
|
1247
1387
|
class GLTFMaterialsSpecularExtension {
|
|
1248
1388
|
|
|
@@ -1307,6 +1447,8 @@
|
|
|
1307
1447
|
* Materials bump Extension
|
|
1308
1448
|
*
|
|
1309
1449
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/EXT_materials_bump
|
|
1450
|
+
*
|
|
1451
|
+
* @private
|
|
1310
1452
|
*/
|
|
1311
1453
|
class GLTFMaterialsBumpExtension {
|
|
1312
1454
|
|
|
@@ -1361,6 +1503,8 @@
|
|
|
1361
1503
|
* Materials anisotropy Extension
|
|
1362
1504
|
*
|
|
1363
1505
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_anisotropy
|
|
1506
|
+
*
|
|
1507
|
+
* @private
|
|
1364
1508
|
*/
|
|
1365
1509
|
class GLTFMaterialsAnisotropyExtension {
|
|
1366
1510
|
|
|
@@ -1425,6 +1569,8 @@
|
|
|
1425
1569
|
* BasisU Texture Extension
|
|
1426
1570
|
*
|
|
1427
1571
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_texture_basisu
|
|
1572
|
+
*
|
|
1573
|
+
* @private
|
|
1428
1574
|
*/
|
|
1429
1575
|
class GLTFTextureBasisUExtension {
|
|
1430
1576
|
|
|
@@ -1476,6 +1622,8 @@
|
|
|
1476
1622
|
* WebP Texture Extension
|
|
1477
1623
|
*
|
|
1478
1624
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_texture_webp
|
|
1625
|
+
*
|
|
1626
|
+
* @private
|
|
1479
1627
|
*/
|
|
1480
1628
|
class GLTFTextureWebPExtension {
|
|
1481
1629
|
|
|
@@ -1483,7 +1631,6 @@
|
|
|
1483
1631
|
|
|
1484
1632
|
this.parser = parser;
|
|
1485
1633
|
this.name = EXTENSIONS.EXT_TEXTURE_WEBP;
|
|
1486
|
-
this.isSupported = null;
|
|
1487
1634
|
|
|
1488
1635
|
}
|
|
1489
1636
|
|
|
@@ -1512,46 +1659,7 @@
|
|
|
1512
1659
|
|
|
1513
1660
|
}
|
|
1514
1661
|
|
|
1515
|
-
return
|
|
1516
|
-
|
|
1517
|
-
if ( isSupported ) return parser.loadTextureImage( textureIndex, extension.source, loader );
|
|
1518
|
-
|
|
1519
|
-
if ( json.extensionsRequired && json.extensionsRequired.indexOf( name ) >= 0 ) {
|
|
1520
|
-
|
|
1521
|
-
throw new Error( 'THREE.GLTFLoader: WebP required by asset but unsupported.' );
|
|
1522
|
-
|
|
1523
|
-
}
|
|
1524
|
-
|
|
1525
|
-
// Fall back to PNG or JPEG.
|
|
1526
|
-
return parser.loadTexture( textureIndex );
|
|
1527
|
-
|
|
1528
|
-
} );
|
|
1529
|
-
|
|
1530
|
-
}
|
|
1531
|
-
|
|
1532
|
-
detectSupport() {
|
|
1533
|
-
|
|
1534
|
-
if ( ! this.isSupported ) {
|
|
1535
|
-
|
|
1536
|
-
this.isSupported = new Promise( function ( resolve ) {
|
|
1537
|
-
|
|
1538
|
-
const image = new Image();
|
|
1539
|
-
|
|
1540
|
-
// Lossy test image. Support for lossy images doesn't guarantee support for all
|
|
1541
|
-
// WebP images, unfortunately.
|
|
1542
|
-
image.src = 'data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA';
|
|
1543
|
-
|
|
1544
|
-
image.onload = image.onerror = function () {
|
|
1545
|
-
|
|
1546
|
-
resolve( image.height === 1 );
|
|
1547
|
-
|
|
1548
|
-
};
|
|
1549
|
-
|
|
1550
|
-
} );
|
|
1551
|
-
|
|
1552
|
-
}
|
|
1553
|
-
|
|
1554
|
-
return this.isSupported;
|
|
1662
|
+
return parser.loadTextureImage( textureIndex, extension.source, loader );
|
|
1555
1663
|
|
|
1556
1664
|
}
|
|
1557
1665
|
|
|
@@ -1561,6 +1669,8 @@
|
|
|
1561
1669
|
* AVIF Texture Extension
|
|
1562
1670
|
*
|
|
1563
1671
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_texture_avif
|
|
1672
|
+
*
|
|
1673
|
+
* @private
|
|
1564
1674
|
*/
|
|
1565
1675
|
class GLTFTextureAVIFExtension {
|
|
1566
1676
|
|
|
@@ -1568,7 +1678,6 @@
|
|
|
1568
1678
|
|
|
1569
1679
|
this.parser = parser;
|
|
1570
1680
|
this.name = EXTENSIONS.EXT_TEXTURE_AVIF;
|
|
1571
|
-
this.isSupported = null;
|
|
1572
1681
|
|
|
1573
1682
|
}
|
|
1574
1683
|
|
|
@@ -1597,44 +1706,7 @@
|
|
|
1597
1706
|
|
|
1598
1707
|
}
|
|
1599
1708
|
|
|
1600
|
-
return
|
|
1601
|
-
|
|
1602
|
-
if ( isSupported ) return parser.loadTextureImage( textureIndex, extension.source, loader );
|
|
1603
|
-
|
|
1604
|
-
if ( json.extensionsRequired && json.extensionsRequired.indexOf( name ) >= 0 ) {
|
|
1605
|
-
|
|
1606
|
-
throw new Error( 'THREE.GLTFLoader: AVIF required by asset but unsupported.' );
|
|
1607
|
-
|
|
1608
|
-
}
|
|
1609
|
-
|
|
1610
|
-
// Fall back to PNG or JPEG.
|
|
1611
|
-
return parser.loadTexture( textureIndex );
|
|
1612
|
-
|
|
1613
|
-
} );
|
|
1614
|
-
|
|
1615
|
-
}
|
|
1616
|
-
|
|
1617
|
-
detectSupport() {
|
|
1618
|
-
|
|
1619
|
-
if ( ! this.isSupported ) {
|
|
1620
|
-
|
|
1621
|
-
this.isSupported = new Promise( function ( resolve ) {
|
|
1622
|
-
|
|
1623
|
-
const image = new Image();
|
|
1624
|
-
|
|
1625
|
-
// Lossy test image.
|
|
1626
|
-
image.src = 'data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=';
|
|
1627
|
-
image.onload = image.onerror = function () {
|
|
1628
|
-
|
|
1629
|
-
resolve( image.height === 1 );
|
|
1630
|
-
|
|
1631
|
-
};
|
|
1632
|
-
|
|
1633
|
-
} );
|
|
1634
|
-
|
|
1635
|
-
}
|
|
1636
|
-
|
|
1637
|
-
return this.isSupported;
|
|
1709
|
+
return parser.loadTextureImage( textureIndex, extension.source, loader );
|
|
1638
1710
|
|
|
1639
1711
|
}
|
|
1640
1712
|
|
|
@@ -1644,6 +1716,8 @@
|
|
|
1644
1716
|
* meshopt BufferView Compression Extension
|
|
1645
1717
|
*
|
|
1646
1718
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_meshopt_compression
|
|
1719
|
+
*
|
|
1720
|
+
* @private
|
|
1647
1721
|
*/
|
|
1648
1722
|
class GLTFMeshoptCompression {
|
|
1649
1723
|
|
|
@@ -1729,6 +1803,7 @@
|
|
|
1729
1803
|
*
|
|
1730
1804
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_mesh_gpu_instancing
|
|
1731
1805
|
*
|
|
1806
|
+
* @private
|
|
1732
1807
|
*/
|
|
1733
1808
|
class GLTFMeshGpuInstancing {
|
|
1734
1809
|
|
|
@@ -1957,6 +2032,8 @@
|
|
|
1957
2032
|
* DRACO Mesh Compression Extension
|
|
1958
2033
|
*
|
|
1959
2034
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression
|
|
2035
|
+
*
|
|
2036
|
+
* @private
|
|
1960
2037
|
*/
|
|
1961
2038
|
class GLTFDracoMeshCompressionExtension {
|
|
1962
2039
|
|
|
@@ -2040,6 +2117,8 @@
|
|
|
2040
2117
|
* Texture Transform Extension
|
|
2041
2118
|
*
|
|
2042
2119
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_texture_transform
|
|
2120
|
+
*
|
|
2121
|
+
* @private
|
|
2043
2122
|
*/
|
|
2044
2123
|
class GLTFTextureTransformExtension {
|
|
2045
2124
|
|
|
@@ -2099,6 +2178,8 @@
|
|
|
2099
2178
|
* Mesh Quantization Extension
|
|
2100
2179
|
*
|
|
2101
2180
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_mesh_quantization
|
|
2181
|
+
*
|
|
2182
|
+
* @private
|
|
2102
2183
|
*/
|
|
2103
2184
|
class GLTFMeshQuantizationExtension {
|
|
2104
2185
|
|
|
@@ -2186,7 +2267,7 @@
|
|
|
2186
2267
|
|
|
2187
2268
|
}
|
|
2188
2269
|
|
|
2189
|
-
const
|
|
2270
|
+
const _quaternion = new three.Quaternion();
|
|
2190
2271
|
|
|
2191
2272
|
class GLTFCubicSplineQuaternionInterpolant extends GLTFCubicSplineInterpolant {
|
|
2192
2273
|
|
|
@@ -2194,7 +2275,7 @@
|
|
|
2194
2275
|
|
|
2195
2276
|
const result = super.interpolate_( i1, t0, t, t1 );
|
|
2196
2277
|
|
|
2197
|
-
|
|
2278
|
+
_quaternion.fromArray( result ).normalize().toArray( result );
|
|
2198
2279
|
|
|
2199
2280
|
return result;
|
|
2200
2281
|
|
|
@@ -2288,7 +2369,8 @@
|
|
|
2288
2369
|
/**
|
|
2289
2370
|
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#default-material
|
|
2290
2371
|
*
|
|
2291
|
-
* @
|
|
2372
|
+
* @private
|
|
2373
|
+
* @param {Object<string, Material>} cache
|
|
2292
2374
|
* @return {Material}
|
|
2293
2375
|
*/
|
|
2294
2376
|
function createDefaultMaterial( cache ) {
|
|
@@ -2329,7 +2411,9 @@
|
|
|
2329
2411
|
}
|
|
2330
2412
|
|
|
2331
2413
|
/**
|
|
2332
|
-
*
|
|
2414
|
+
*
|
|
2415
|
+
* @private
|
|
2416
|
+
* @param {Object3D|Material|BufferGeometry|Object} object
|
|
2333
2417
|
* @param {GLTF.definition} gltfDef
|
|
2334
2418
|
*/
|
|
2335
2419
|
function assignExtrasToUserData( object, gltfDef ) {
|
|
@@ -2353,6 +2437,7 @@
|
|
|
2353
2437
|
/**
|
|
2354
2438
|
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#morph-targets
|
|
2355
2439
|
*
|
|
2440
|
+
* @private
|
|
2356
2441
|
* @param {BufferGeometry} geometry
|
|
2357
2442
|
* @param {Array<GLTF.Target>} targets
|
|
2358
2443
|
* @param {GLTFParser} parser
|
|
@@ -2440,6 +2525,8 @@
|
|
|
2440
2525
|
}
|
|
2441
2526
|
|
|
2442
2527
|
/**
|
|
2528
|
+
*
|
|
2529
|
+
* @private
|
|
2443
2530
|
* @param {Mesh} mesh
|
|
2444
2531
|
* @param {GLTF.Mesh} meshDef
|
|
2445
2532
|
*/
|
|
@@ -2728,6 +2815,8 @@
|
|
|
2728
2815
|
|
|
2729
2816
|
/**
|
|
2730
2817
|
* Marks the special nodes/meshes in json for efficient parse.
|
|
2818
|
+
*
|
|
2819
|
+
* @private
|
|
2731
2820
|
*/
|
|
2732
2821
|
_markDefs() {
|
|
2733
2822
|
|
|
@@ -2789,6 +2878,7 @@
|
|
|
2789
2878
|
*
|
|
2790
2879
|
* Example: CesiumMilkTruck sample model reuses "Wheel" meshes.
|
|
2791
2880
|
*
|
|
2881
|
+
* @private
|
|
2792
2882
|
* @param {Object} cache
|
|
2793
2883
|
* @param {Object3D} index
|
|
2794
2884
|
*/
|
|
@@ -2809,8 +2899,9 @@
|
|
|
2809
2899
|
/**
|
|
2810
2900
|
* Returns a reference to a shared resource, cloning it if necessary.
|
|
2811
2901
|
*
|
|
2902
|
+
* @private
|
|
2812
2903
|
* @param {Object} cache
|
|
2813
|
-
* @param {
|
|
2904
|
+
* @param {number} index
|
|
2814
2905
|
* @param {Object} object
|
|
2815
2906
|
* @return {Object}
|
|
2816
2907
|
*/
|
|
@@ -2885,6 +2976,8 @@
|
|
|
2885
2976
|
|
|
2886
2977
|
/**
|
|
2887
2978
|
* Requests the specified dependency asynchronously, with caching.
|
|
2979
|
+
*
|
|
2980
|
+
* @private
|
|
2888
2981
|
* @param {string} type
|
|
2889
2982
|
* @param {number} index
|
|
2890
2983
|
* @return {Promise<Object3D|Material|THREE.Texture|AnimationClip|ArrayBuffer|Object>}
|
|
@@ -2993,6 +3086,8 @@
|
|
|
2993
3086
|
|
|
2994
3087
|
/**
|
|
2995
3088
|
* Requests all dependencies of the specified type asynchronously, with caching.
|
|
3089
|
+
*
|
|
3090
|
+
* @private
|
|
2996
3091
|
* @param {string} type
|
|
2997
3092
|
* @return {Promise<Array<Object>>}
|
|
2998
3093
|
*/
|
|
@@ -3021,6 +3116,8 @@
|
|
|
3021
3116
|
|
|
3022
3117
|
/**
|
|
3023
3118
|
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
|
|
3119
|
+
*
|
|
3120
|
+
* @private
|
|
3024
3121
|
* @param {number} bufferIndex
|
|
3025
3122
|
* @return {Promise<ArrayBuffer>}
|
|
3026
3123
|
*/
|
|
@@ -3058,6 +3155,8 @@
|
|
|
3058
3155
|
|
|
3059
3156
|
/**
|
|
3060
3157
|
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
|
|
3158
|
+
*
|
|
3159
|
+
* @private
|
|
3061
3160
|
* @param {number} bufferViewIndex
|
|
3062
3161
|
* @return {Promise<ArrayBuffer>}
|
|
3063
3162
|
*/
|
|
@@ -3077,6 +3176,8 @@
|
|
|
3077
3176
|
|
|
3078
3177
|
/**
|
|
3079
3178
|
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#accessors
|
|
3179
|
+
*
|
|
3180
|
+
* @private
|
|
3080
3181
|
* @param {number} accessorIndex
|
|
3081
3182
|
* @return {Promise<BufferAttribute|InterleavedBufferAttribute>}
|
|
3082
3183
|
*/
|
|
@@ -3216,6 +3317,8 @@
|
|
|
3216
3317
|
|
|
3217
3318
|
/**
|
|
3218
3319
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#textures
|
|
3320
|
+
*
|
|
3321
|
+
* @private
|
|
3219
3322
|
* @param {number} textureIndex
|
|
3220
3323
|
* @return {Promise<THREE.Texture|null>}
|
|
3221
3324
|
*/
|
|
@@ -3386,10 +3489,11 @@
|
|
|
3386
3489
|
/**
|
|
3387
3490
|
* Asynchronously assigns a texture to the given material parameters.
|
|
3388
3491
|
*
|
|
3492
|
+
* @private
|
|
3389
3493
|
* @param {Object} materialParams
|
|
3390
3494
|
* @param {string} mapName
|
|
3391
3495
|
* @param {Object} mapDef
|
|
3392
|
-
* @param {string} colorSpace
|
|
3496
|
+
* @param {string} [colorSpace]
|
|
3393
3497
|
* @return {Promise<Texture>}
|
|
3394
3498
|
*/
|
|
3395
3499
|
assignTexture( materialParams, mapName, mapDef, colorSpace ) {
|
|
@@ -3441,7 +3545,9 @@
|
|
|
3441
3545
|
* but reuse of the same glTF material may require multiple threejs materials
|
|
3442
3546
|
* to accommodate different primitive types, defines, etc. New materials will
|
|
3443
3547
|
* be created if necessary, and reused from a cache.
|
|
3444
|
-
*
|
|
3548
|
+
*
|
|
3549
|
+
* @private
|
|
3550
|
+
* @param {Object3D} mesh Mesh, Line, or Points instance.
|
|
3445
3551
|
*/
|
|
3446
3552
|
assignFinalMaterial( mesh ) {
|
|
3447
3553
|
|
|
@@ -3541,6 +3647,8 @@
|
|
|
3541
3647
|
|
|
3542
3648
|
/**
|
|
3543
3649
|
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
|
|
3650
|
+
*
|
|
3651
|
+
* @private
|
|
3544
3652
|
* @param {number} materialIndex
|
|
3545
3653
|
* @return {Promise<Material>}
|
|
3546
3654
|
*/
|
|
@@ -3701,8 +3809,9 @@
|
|
|
3701
3809
|
/**
|
|
3702
3810
|
* When Object3D instances are targeted by animation, they need unique names.
|
|
3703
3811
|
*
|
|
3704
|
-
* @
|
|
3705
|
-
* @
|
|
3812
|
+
* @private
|
|
3813
|
+
* @param {string} originalName
|
|
3814
|
+
* @return {string}
|
|
3706
3815
|
*/
|
|
3707
3816
|
createUniqueName( originalName ) {
|
|
3708
3817
|
|
|
@@ -3727,6 +3836,7 @@
|
|
|
3727
3836
|
*
|
|
3728
3837
|
* Creates BufferGeometries from primitives.
|
|
3729
3838
|
*
|
|
3839
|
+
* @private
|
|
3730
3840
|
* @param {Array<GLTF.Primitive>} primitives
|
|
3731
3841
|
* @return {Promise<Array<BufferGeometry>>}
|
|
3732
3842
|
*/
|
|
@@ -3794,8 +3904,10 @@
|
|
|
3794
3904
|
|
|
3795
3905
|
/**
|
|
3796
3906
|
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#meshes
|
|
3907
|
+
*
|
|
3908
|
+
* @private
|
|
3797
3909
|
* @param {number} meshIndex
|
|
3798
|
-
* @return {Promise<Group|Mesh|SkinnedMesh>}
|
|
3910
|
+
* @return {Promise<Group|Mesh|SkinnedMesh|Line|Points>}
|
|
3799
3911
|
*/
|
|
3800
3912
|
loadMesh( meshIndex ) {
|
|
3801
3913
|
|
|
@@ -3942,6 +4054,8 @@
|
|
|
3942
4054
|
|
|
3943
4055
|
/**
|
|
3944
4056
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#cameras
|
|
4057
|
+
*
|
|
4058
|
+
* @private
|
|
3945
4059
|
* @param {number} cameraIndex
|
|
3946
4060
|
* @return {Promise<THREE.Camera>}
|
|
3947
4061
|
*/
|
|
@@ -3978,6 +4092,8 @@
|
|
|
3978
4092
|
|
|
3979
4093
|
/**
|
|
3980
4094
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
|
|
4095
|
+
*
|
|
4096
|
+
* @private
|
|
3981
4097
|
* @param {number} skinIndex
|
|
3982
4098
|
* @return {Promise<Skeleton>}
|
|
3983
4099
|
*/
|
|
@@ -4048,6 +4164,8 @@
|
|
|
4048
4164
|
|
|
4049
4165
|
/**
|
|
4050
4166
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#animations
|
|
4167
|
+
*
|
|
4168
|
+
* @private
|
|
4051
4169
|
* @param {number} animationIndex
|
|
4052
4170
|
* @return {Promise<AnimationClip>}
|
|
4053
4171
|
*/
|
|
@@ -4175,6 +4293,8 @@
|
|
|
4175
4293
|
|
|
4176
4294
|
/**
|
|
4177
4295
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#nodes-and-hierarchy
|
|
4296
|
+
*
|
|
4297
|
+
* @private
|
|
4178
4298
|
* @param {number} nodeIndex
|
|
4179
4299
|
* @return {Promise<Object3D>}
|
|
4180
4300
|
*/
|
|
@@ -4368,6 +4488,11 @@
|
|
|
4368
4488
|
|
|
4369
4489
|
parser.associations.set( node, {} );
|
|
4370
4490
|
|
|
4491
|
+
} else if ( nodeDef.mesh !== undefined && parser.meshCache.refs[ nodeDef.mesh ] > 1 ) {
|
|
4492
|
+
|
|
4493
|
+
const mapping = parser.associations.get( node );
|
|
4494
|
+
parser.associations.set( node, { ...mapping } );
|
|
4495
|
+
|
|
4371
4496
|
}
|
|
4372
4497
|
|
|
4373
4498
|
parser.associations.get( node ).nodes = nodeIndex;
|
|
@@ -4382,6 +4507,8 @@
|
|
|
4382
4507
|
|
|
4383
4508
|
/**
|
|
4384
4509
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#scenes
|
|
4510
|
+
*
|
|
4511
|
+
* @private
|
|
4385
4512
|
* @param {number} sceneIndex
|
|
4386
4513
|
* @return {Promise<Group>}
|
|
4387
4514
|
*/
|
|
@@ -4497,7 +4624,7 @@
|
|
|
4497
4624
|
TypedKeyframeTrack = three.QuaternionKeyframeTrack;
|
|
4498
4625
|
break;
|
|
4499
4626
|
|
|
4500
|
-
case PATH_PROPERTIES.
|
|
4627
|
+
case PATH_PROPERTIES.translation:
|
|
4501
4628
|
case PATH_PROPERTIES.scale:
|
|
4502
4629
|
|
|
4503
4630
|
TypedKeyframeTrack = three.VectorKeyframeTrack;
|
|
@@ -4596,6 +4723,8 @@
|
|
|
4596
4723
|
}
|
|
4597
4724
|
|
|
4598
4725
|
/**
|
|
4726
|
+
*
|
|
4727
|
+
* @private
|
|
4599
4728
|
* @param {BufferGeometry} geometry
|
|
4600
4729
|
* @param {GLTF.Primitive} primitiveDef
|
|
4601
4730
|
* @param {GLTFParser} parser
|
|
@@ -4711,6 +4840,8 @@
|
|
|
4711
4840
|
}
|
|
4712
4841
|
|
|
4713
4842
|
/**
|
|
4843
|
+
*
|
|
4844
|
+
* @private
|
|
4714
4845
|
* @param {BufferGeometry} geometry
|
|
4715
4846
|
* @param {GLTF.Primitive} primitiveDef
|
|
4716
4847
|
* @param {GLTFParser} parser
|