@xeokit/xeokit-sdk 2.6.99 → 2.6.100-rc1-no-las
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/xeokit-sdk.cjs.js +37944 -52035
- package/dist/xeokit-sdk.es.js +37945 -52032
- package/dist/xeokit-sdk.es5.js +29439 -28307
- package/dist/xeokit-sdk.min.cjs.js +9 -8
- package/dist/xeokit-sdk.min.es.js +9 -8
- package/dist/xeokit-sdk.min.es5.js +19 -37
- package/package.json +13 -6
- package/src/plugins/CxConverterIFCLoaderPlugin/CxConverterIFCLoaderPlugin.js +81 -92
- package/src/plugins/CxConverterIFCLoaderPlugin/index.js +1 -1
- package/src/plugins/LASLoaderPlugin/LASLoaderPlugin.js +628 -628
- package/src/plugins/LASLoaderPlugin/index.js +1 -1
- package/src/plugins/NavCubePlugin/NavCubePlugin.js +1 -0
- package/src/plugins/XKTLoaderPlugin/parsers/ParserV1.js +5 -5
- package/src/plugins/XKTLoaderPlugin/parsers/ParserV10.js +5 -5
- package/src/plugins/XKTLoaderPlugin/parsers/ParserV12.js +9 -9
- package/src/plugins/XKTLoaderPlugin/parsers/ParserV2.js +5 -5
- package/src/plugins/XKTLoaderPlugin/parsers/ParserV3.js +5 -5
- package/src/plugins/XKTLoaderPlugin/parsers/ParserV4.js +5 -5
- package/src/plugins/XKTLoaderPlugin/parsers/ParserV5.js +5 -5
- package/src/plugins/XKTLoaderPlugin/parsers/ParserV6.js +5 -5
- package/src/plugins/XKTLoaderPlugin/parsers/ParserV7.js +5 -5
- package/src/plugins/XKTLoaderPlugin/parsers/ParserV8.js +5 -5
- package/src/plugins/XKTLoaderPlugin/parsers/ParserV9.js +5 -5
- package/src/plugins/index.js +2 -3
- package/src/viewer/scene/materials/Texture.js +2 -0
- package/src/viewer/scene/math/math.js +48 -2
- package/src/viewer/scene/webgl/Texture2D.js +7 -0
- package/types/plugins/AngleMeasurementsPlugin/AngleMeasurement.d.ts +26 -108
- package/types/plugins/CityJSONLoaderPlugin/CityJSONLoaderPlugin.d.ts +3 -14
- package/types/plugins/DotBIMLoaderPlugin/DotBIMLoaderPlugin.d.ts +5 -23
- package/types/plugins/GLTFLoaderPlugin/GLTFLoaderPlugin.d.ts +5 -25
- package/types/plugins/LASLoaderPlugin/LASLoaderPlugin.d.ts +20 -100
- package/types/plugins/STLLoaderPlugin/STLLoaderPlugin.d.ts +3 -14
- package/types/plugins/WebIFCLoaderPlugin/WebIFCLoaderPlugin.d.ts +18 -83
- package/types/plugins/XKTLoaderPlugin/XKTLoaderPlugin.d.ts +21 -106
- package/types/viewer/Configs.d.ts +6 -24
- package/types/viewer/scene/CameraControl/CameraControl.d.ts +67 -446
- package/types/viewer/scene/Component.d.ts +1 -1
- package/types/viewer/scene/Entity.d.ts +40 -186
- package/types/viewer/scene/camera/Camera.d.ts +50 -170
- package/types/viewer/scene/camera/CameraFlightAnimation.d.ts +8 -57
- package/types/viewer/scene/camera/CameraPath.d.ts +8 -13
- package/types/viewer/scene/camera/CameraPathAnimation.d.ts +4 -22
- package/types/viewer/scene/camera/CustomProjection.d.ts +6 -21
- package/types/viewer/scene/camera/Frustum.d.ts +18 -90
- package/types/viewer/scene/camera/Ortho.d.ts +14 -54
- package/types/viewer/scene/camera/Perspective.d.ts +16 -70
- package/types/viewer/scene/geometry/ReadableGeometry.d.ts +21 -25
- package/types/viewer/scene/geometry/VBOGeometry.d.ts +7 -7
- package/types/viewer/scene/lights/AmbientLight.d.ts +4 -26
- package/types/viewer/scene/lights/DirLight.d.ts +8 -52
- package/types/viewer/scene/lights/PointLight.d.ts +14 -93
- package/types/viewer/scene/materials/EdgeMaterial.d.ts +12 -37
- package/types/viewer/scene/materials/EmphasisMaterial.d.ts +22 -119
- package/types/viewer/scene/materials/Fresnel.d.ts +10 -50
- package/types/viewer/scene/materials/LambertMaterial.d.ts +16 -90
- package/types/viewer/scene/materials/LinesMaterial.d.ts +7 -25
- package/types/viewer/scene/materials/MetallicMaterial.d.ts +40 -127
- package/types/viewer/scene/materials/PhongMaterial.d.ts +52 -185
- package/types/viewer/scene/materials/PointsMaterial.d.ts +20 -101
- package/types/viewer/scene/materials/SpecularMaterial.d.ts +41 -117
- package/types/viewer/scene/materials/Texture.d.ts +24 -62
- package/types/viewer/scene/models/SceneModel.d.ts +76 -233
- package/types/viewer/scene/models/SceneModelEntity.d.ts +50 -211
- package/types/viewer/scene/models/SceneModelMesh.d.ts +4 -4
- package/types/viewer/scene/models/SceneModelTransform.d.ts +14 -59
- package/types/viewer/scene/paths/CubicBezierCurve.d.ts +12 -73
- package/types/viewer/scene/paths/Curve.d.ts +6 -19
- package/types/viewer/scene/paths/Path.d.ts +10 -57
- package/types/viewer/scene/paths/QuadraticBezierCurve.d.ts +10 -57
- package/types/viewer/scene/paths/SplineCurve.d.ts +6 -32
- package/types/viewer/scene/scene/Scene.d.ts +94 -196
- package/types/viewer/scene/sectionPlane/SectionPlane.d.ts +12 -69
- package/types/viewer/scene/viewport/Viewport.d.ts +4 -14
- package/types/viewer/scene/webgl/PickResult.d.ts +13 -28
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {utils} from "../../viewer/scene/utils.js";
|
|
2
|
-
import {SceneModel} from "../../viewer/scene/model/index.js";
|
|
3
|
-
import {Plugin} from "../../viewer/Plugin.js";
|
|
4
|
-
import {LASDefaultDataSource} from "./LASDefaultDataSource.js";
|
|
5
|
-
import {math} from "../../viewer/index.js";
|
|
6
|
-
import {parse} from
|
|
7
|
-
import {LASLoader} from
|
|
8
|
-
import {loadLASHeader} from "./loadLASHeader
|
|
1
|
+
// import {utils} from "../../viewer/scene/utils.js";
|
|
2
|
+
// import {SceneModel} from "../../viewer/scene/model/index.js";
|
|
3
|
+
// import {Plugin} from "../../viewer/Plugin.js";
|
|
4
|
+
// import {LASDefaultDataSource} from "./LASDefaultDataSource.js";
|
|
5
|
+
// import {math} from "../../viewer/index.js";
|
|
6
|
+
// import {parse} from '@loaders.gl/core';
|
|
7
|
+
// import {LASLoader} from '@loaders.gl/las';
|
|
8
|
+
// import {loadLASHeader} from "./loadLASHeader";
|
|
9
9
|
|
|
10
|
-
const MAX_VERTICES = 500000; // TODO: Rough estimate
|
|
10
|
+
// const MAX_VERTICES = 500000; // TODO: Rough estimate
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* {@link Viewer} plugin that loads lidar point cloud geometry from LAS files.
|
|
@@ -200,622 +200,622 @@ const MAX_VERTICES = 500000; // TODO: Rough estimate
|
|
|
200
200
|
* @class LASLoaderPlugin
|
|
201
201
|
* @since 2.0.17
|
|
202
202
|
*/
|
|
203
|
-
class LASLoaderPlugin extends Plugin {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
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
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
}
|
|
799
|
-
|
|
800
|
-
function chunkArray(array, chunkSize) {
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
}
|
|
810
|
-
|
|
811
|
-
function getBaseDirectory(filePath) {
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
}
|
|
820
|
-
|
|
821
|
-
export {LASLoaderPlugin};
|
|
203
|
+
// class LASLoaderPlugin extends Plugin {
|
|
204
|
+
|
|
205
|
+
// /**
|
|
206
|
+
// * @constructor
|
|
207
|
+
// *
|
|
208
|
+
// * @param {Viewer} viewer The Viewer.
|
|
209
|
+
// * @param {Object} cfg Plugin configuration.
|
|
210
|
+
// * @param {String} [cfg.id="lasLoader"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
|
|
211
|
+
// * @param {Object} [cfg.dataSource] A custom data source through which the LASLoaderPlugin can load model and metadata files. Defaults to an instance of {@link LASDefaultDataSource}, which loads over HTTP.
|
|
212
|
+
// * @param {Number} [cfg.skip=1] Configures LASLoaderPlugin to load every **n** points.
|
|
213
|
+
// * @param {Number} [cfg.fp64=false] Configures if LASLoaderPlugin assumes that LAS positions are stored in 64-bit floats instead of 32-bit.
|
|
214
|
+
// * @param {Number} [cfg.colorDepth=8] Configures whether LASLoaderPlugin assumes that LAS colors are encoded using 8 or 16 bits. Accepted values are 8, 16 an "auto".
|
|
215
|
+
// * @param {Boolean} [cfg.center=false] Whether to center the LAS points. Applied before "rotateX", "rotate" and "transform".
|
|
216
|
+
// * @param {Boolean} [cfg.rotateX=false] Whether to rotate the LAS point positions 90 degrees. Applied after "center".
|
|
217
|
+
// * @param {Number[]} [cfg.rotate=[0,0,0]] Rotations to immediately apply to the LAS points, given as Euler angles in degrees, for each of the X, Y and Z axis. Rotation is applied after "center" and "rotateX".
|
|
218
|
+
// * @param {Number[]} [cfg.transform] 4x4 transform matrix to immediately apply to the LAS points. This is applied after "center", "rotateX" and "rotate". Typically used instead of "rotateX" and "rotate".
|
|
219
|
+
// */
|
|
220
|
+
// constructor(viewer, cfg = {}) {
|
|
221
|
+
|
|
222
|
+
// super("lasLoader", viewer, cfg);
|
|
223
|
+
|
|
224
|
+
// this.dataSource = cfg.dataSource;
|
|
225
|
+
// this.skip = cfg.skip;
|
|
226
|
+
// this.fp64 = cfg.fp64;
|
|
227
|
+
// this.colorDepth = cfg.colorDepth;
|
|
228
|
+
// this.center = cfg.center;
|
|
229
|
+
// this.rotate = cfg.rotate;
|
|
230
|
+
// this.rotateX = cfg.rotateX;
|
|
231
|
+
// this.transform = cfg.transform;
|
|
232
|
+
// }
|
|
233
|
+
|
|
234
|
+
// /**
|
|
235
|
+
// * Gets the custom data source through which the LASLoaderPlugin can load LAS files.
|
|
236
|
+
// *
|
|
237
|
+
// * Default value is {@link LASDefaultDataSource}, which loads via HTTP.
|
|
238
|
+
// *
|
|
239
|
+
// * @type {Object}
|
|
240
|
+
// */
|
|
241
|
+
// get dataSource() {
|
|
242
|
+
// return this._dataSource;
|
|
243
|
+
// }
|
|
244
|
+
|
|
245
|
+
// /**
|
|
246
|
+
// * Sets a custom data source through which the LASLoaderPlugin can load LAS files.
|
|
247
|
+
// *
|
|
248
|
+
// * Default value is {@link LASDefaultDataSource}, which loads via HTTP.
|
|
249
|
+
// *
|
|
250
|
+
// * @type {Object}
|
|
251
|
+
// */
|
|
252
|
+
// set dataSource(value) {
|
|
253
|
+
// this._dataSource = value || new LASDefaultDataSource();
|
|
254
|
+
// }
|
|
255
|
+
|
|
256
|
+
// /**
|
|
257
|
+
// * When LASLoaderPlugin is configured to load every **n** points, returns the value of **n**.
|
|
258
|
+
// *
|
|
259
|
+
// * Default value is ````1````.
|
|
260
|
+
// *
|
|
261
|
+
// * @returns {Number} The **n**th point that LASLoaderPlugin will read.
|
|
262
|
+
// */
|
|
263
|
+
// get skip() {
|
|
264
|
+
// return this._skip;
|
|
265
|
+
// }
|
|
266
|
+
|
|
267
|
+
// /**
|
|
268
|
+
// * Configures LASLoaderPlugin to load every **n** points.
|
|
269
|
+
// *
|
|
270
|
+
// * Default value is ````1````.
|
|
271
|
+
// *
|
|
272
|
+
// * @param {Number} value The **n**th point that LASLoaderPlugin will read.
|
|
273
|
+
// */
|
|
274
|
+
// set skip(value) {
|
|
275
|
+
// this._skip = value || 1;
|
|
276
|
+
// }
|
|
277
|
+
|
|
278
|
+
// /**
|
|
279
|
+
// * Gets if LASLoaderPlugin assumes that LAS positions are stored in 64-bit floats instead of 32-bit.
|
|
280
|
+
// *
|
|
281
|
+
// * Default value is ````false````.
|
|
282
|
+
// *
|
|
283
|
+
// * @returns {Boolean} True if LASLoaderPlugin assumes that positions are stored in 64-bit floats instead of 32-bit.
|
|
284
|
+
// */
|
|
285
|
+
// get fp64() {
|
|
286
|
+
// return this._fp64;
|
|
287
|
+
// }
|
|
288
|
+
|
|
289
|
+
// /**
|
|
290
|
+
// * Configures if LASLoaderPlugin assumes that LAS positions are stored in 64-bit floats instead of 32-bit.
|
|
291
|
+
// *
|
|
292
|
+
// * Default value is ````false````.
|
|
293
|
+
// *
|
|
294
|
+
// * @param {Boolean} value True if LASLoaderPlugin assumes that positions are stored in 64-bit floats instead of 32-bit.
|
|
295
|
+
// */
|
|
296
|
+
// set fp64(value) {
|
|
297
|
+
// this._fp64 = !!value;
|
|
298
|
+
// }
|
|
299
|
+
|
|
300
|
+
// /**
|
|
301
|
+
// * Gets whether LASLoaderPlugin assumes that LAS colors are encoded using 8 or 16 bits.
|
|
302
|
+
// *
|
|
303
|
+
// * Default value is ````8````.
|
|
304
|
+
// *
|
|
305
|
+
// * Note: LAS specification recommends 16 bits.
|
|
306
|
+
// *
|
|
307
|
+
// * @returns {Number|String} Possible returned values are 8, 16 and "auto".
|
|
308
|
+
// */
|
|
309
|
+
// get colorDepth() {
|
|
310
|
+
// return this._colorDepth;
|
|
311
|
+
// }
|
|
312
|
+
|
|
313
|
+
// /**
|
|
314
|
+
// * Configures whether LASLoaderPlugin assumes that LAS colors are encoded using 8 or 16 bits.
|
|
315
|
+
// *
|
|
316
|
+
// * Default value is ````8````.
|
|
317
|
+
// *
|
|
318
|
+
// * Note: LAS specification recommends 16 bits.
|
|
319
|
+
// *
|
|
320
|
+
// * @param {Number|String} value Valid values are 8, 16 and "auto".
|
|
321
|
+
// */
|
|
322
|
+
// set colorDepth(value) {
|
|
323
|
+
// this._colorDepth = value || "auto";
|
|
324
|
+
// }
|
|
325
|
+
|
|
326
|
+
// /**
|
|
327
|
+
// * Gets if LASLoaderPlugin immediately centers LAS positions.
|
|
328
|
+
// *
|
|
329
|
+
// * If this is ````true```` then centering is the first thing that happens to LAS positions as they are loaded.
|
|
330
|
+
// *
|
|
331
|
+
// * Default value is ````false````.
|
|
332
|
+
// *
|
|
333
|
+
// * @returns {Boolean} True if LASLoaderPlugin immediately centers LAS positions.
|
|
334
|
+
// */
|
|
335
|
+
// get center() {
|
|
336
|
+
// return this._center;
|
|
337
|
+
// }
|
|
338
|
+
|
|
339
|
+
// /**
|
|
340
|
+
// * Configures if LASLoaderPlugin immediately centers LAS positions.
|
|
341
|
+
// *
|
|
342
|
+
// * If this is ````true```` then centering is the first thing that happens to LAS positions as they are loaded.
|
|
343
|
+
// *
|
|
344
|
+
// * Default value is ````false````.
|
|
345
|
+
// *
|
|
346
|
+
// * @param {Boolean} value True if LASLoaderPlugin immediately centers LAS positions.
|
|
347
|
+
// */
|
|
348
|
+
// set center(value) {
|
|
349
|
+
// this._center = !!value;
|
|
350
|
+
// }
|
|
351
|
+
|
|
352
|
+
// /**
|
|
353
|
+
// * Gets the current transformation to apply to LAS positions as they are loaded.
|
|
354
|
+
// *
|
|
355
|
+
// * If this is ````true````, then LAS positions will be transformed after they are centered and rotated.
|
|
356
|
+
// *
|
|
357
|
+
// * Default value is null.
|
|
358
|
+
// *
|
|
359
|
+
// * @returns {Number[]|null} A 16-element array containing a 4x4 transformation matrix.
|
|
360
|
+
// */
|
|
361
|
+
// get transform() {
|
|
362
|
+
// return this._transform;
|
|
363
|
+
// }
|
|
364
|
+
|
|
365
|
+
// /**
|
|
366
|
+
// * Sets the current transformation to apply to LAS positions as they are loaded.
|
|
367
|
+
// *
|
|
368
|
+
// * If this is ````true````, then LAS positions will be transformed after they are centered and rotated.
|
|
369
|
+
// *
|
|
370
|
+
// * Default value is null.
|
|
371
|
+
// *
|
|
372
|
+
// * @param {Number[]|null} transform A 16-element array containing a 4x4 transformation matrix.
|
|
373
|
+
// */
|
|
374
|
+
// set transform(transform) {
|
|
375
|
+
// this._transform = transform;
|
|
376
|
+
// }
|
|
377
|
+
|
|
378
|
+
// /**
|
|
379
|
+
// * Gets the current rotations to apply to LAS positions as they are loaded.
|
|
380
|
+
// *
|
|
381
|
+
// * Rotations are an array of three Euler angles in degrees, for each of the X, Y and Z axis, applied in that order.
|
|
382
|
+
// *
|
|
383
|
+
// * Default value is null.
|
|
384
|
+
// *
|
|
385
|
+
// * @returns {Number[]|null} If defined, an array of three Euler angles in degrees, for each of the X, Y and Z axis. Null if undefined.
|
|
386
|
+
// */
|
|
387
|
+
// get rotate() {
|
|
388
|
+
// return this._rotate;
|
|
389
|
+
// }
|
|
390
|
+
|
|
391
|
+
// /**
|
|
392
|
+
// * Sets the current rotations to apply to LAS positions as they are loaded.
|
|
393
|
+
// *
|
|
394
|
+
// * Rotations are an array of three Euler angles in degrees, for each of the X, Y and Z axis, applied in that order.
|
|
395
|
+
// *
|
|
396
|
+
// * Default value is null.
|
|
397
|
+
// *
|
|
398
|
+
// * @param {Number[]|null} rotate Array of three Euler angles in degrees, for each of the X, Y and Z axis.
|
|
399
|
+
// */
|
|
400
|
+
// set rotate(rotate) {
|
|
401
|
+
// this._rotate = rotate;
|
|
402
|
+
// }
|
|
403
|
+
|
|
404
|
+
// /**
|
|
405
|
+
// * Gets if LAS positions are rotated 90 degrees about X as they are loaded.
|
|
406
|
+
// *
|
|
407
|
+
// * Default value is ````false````.
|
|
408
|
+
// *
|
|
409
|
+
// * @returns {*}
|
|
410
|
+
// */
|
|
411
|
+
// get rotateX() {
|
|
412
|
+
// return this._rotateX;
|
|
413
|
+
// }
|
|
414
|
+
|
|
415
|
+
// /**
|
|
416
|
+
// * Sets if LAS positions are rotated 90 degrees about X as they are loaded.
|
|
417
|
+
// *
|
|
418
|
+
// * Default value is ````false````.
|
|
419
|
+
// *
|
|
420
|
+
// * @param rotateX
|
|
421
|
+
// */
|
|
422
|
+
// set rotateX(rotateX) {
|
|
423
|
+
// this._rotateX = rotateX;
|
|
424
|
+
// }
|
|
425
|
+
|
|
426
|
+
// /**
|
|
427
|
+
// * Loads an ````LAS```` model into this LASLoaderPlugin's {@link Viewer}.
|
|
428
|
+
// *
|
|
429
|
+
// * @param {*} params Loading parameters.
|
|
430
|
+
// * @param {String} [params.id] ID to assign to the root {@link Entity#id}, unique among all components in the Viewer's {@link Scene}, generated automatically by default.
|
|
431
|
+
// * @param {String} [params.src] Path to a LAS file, as an alternative to the ````las```` parameter.
|
|
432
|
+
// * @param {ArrayBuffer} [params.las] The LAS file data, as an alternative to the ````src```` parameter.
|
|
433
|
+
// * @param {String} [params.manifestSrc] Path or URL to a JSON manifest file that provides paths to ````.laz```` || ````.las```` files to load as parts of the model. Use this option to load models that have been split into
|
|
434
|
+
// * @param {Object} [params.manifest] A JSON manifest object (as an alternative to a path or URL) that provides paths to ````.laz```` || ````.las```` files to load as parts of the model. Use this option to load models that have been split into
|
|
435
|
+
// * @param {Boolean} [params.loadMetadata=true] Whether to load metadata for the LAS model.
|
|
436
|
+
// * @param {Number[]} [params.origin=[0,0,0]] The model's World-space double-precision 3D origin. Use this to position the model within xeokit's World coordinate system, using double-precision coordinates.
|
|
437
|
+
// * @param {Number[]} [params.position=[0,0,0]] The model single-precision 3D position, relative to the ````origin```` parameter.
|
|
438
|
+
// * @param {Number[]} [params.scale=[1,1,1]] The model's scale.
|
|
439
|
+
// * @param {Number[]} [params.rotation=[0,0,0]] The model's orientation, given as Euler angles in degrees, for each of the X, Y and Z axis.
|
|
440
|
+
// * @param {Number[]} [params.matrix=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]] The model's world transform matrix. Overrides the position, scale and rotation parameters. Relative to ````origin````.
|
|
441
|
+
// * @param {Object} [params.stats] Collects model statistics.
|
|
442
|
+
// * @returns {Entity} Entity representing the model, which will have {@link Entity#isModel} set ````true```` and will be registered by {@link Entity#id} in {@link Scene#models}.
|
|
443
|
+
// */
|
|
444
|
+
// load(params = {}) {
|
|
445
|
+
|
|
446
|
+
// if (params.id && this.viewer.scene.components[params.id]) {
|
|
447
|
+
// this.error("Component with this ID already exists in viewer: " + params.id + " - will autogenerate this ID");
|
|
448
|
+
// delete params.id;
|
|
449
|
+
// }
|
|
450
|
+
|
|
451
|
+
// const sceneModel = new SceneModel(this.viewer.scene, utils.apply(params, {
|
|
452
|
+
// maxGeometryBatchSize: MAX_VERTICES,
|
|
453
|
+
// isModel: true
|
|
454
|
+
// }));
|
|
455
|
+
|
|
456
|
+
// if (!params.src && !params.las && !params.manifest && !params.manifestSrc) {
|
|
457
|
+
// this.error("load() param expected: src or las");
|
|
458
|
+
// return sceneModel; // Return new empty model
|
|
459
|
+
// }
|
|
460
|
+
|
|
461
|
+
// const options = {
|
|
462
|
+
// las: {
|
|
463
|
+
// skip: this._skip,
|
|
464
|
+
// fp64: this._fp64,
|
|
465
|
+
// colorDepth: this._colorDepth
|
|
466
|
+
// }
|
|
467
|
+
// };
|
|
468
|
+
|
|
469
|
+
// const spinner = this.viewer.scene.canvas.spinner;
|
|
470
|
+
// const done = () => {
|
|
471
|
+
// sceneModel.scene.once("tick", () => {
|
|
472
|
+
// if (sceneModel.destroyed) {
|
|
473
|
+
// return;
|
|
474
|
+
// }
|
|
475
|
+
// sceneModel.scene.fire("modelLoaded", sceneModel.id); // FIXME: Assumes listeners know order of these two events
|
|
476
|
+
// sceneModel.fire("loaded", true, false); // Don't forget the event, for late subscribers
|
|
477
|
+
// });
|
|
478
|
+
// spinner.processes--;
|
|
479
|
+
// }
|
|
480
|
+
// const error = (errMsg) => {
|
|
481
|
+
// spinner.processes--;
|
|
482
|
+
// this.error(errMsg);
|
|
483
|
+
// sceneModel.fire("error", errMsg);
|
|
484
|
+
// }
|
|
485
|
+
|
|
486
|
+
// if (params.src) {
|
|
487
|
+
// this._loadModel(params.src, params, options, sceneModel);
|
|
488
|
+
// } else if(params.las) {
|
|
489
|
+
// spinner.processes++;
|
|
490
|
+
// this._parseModel(params.las, params, options, sceneModel).then(done, error);
|
|
491
|
+
// } else if (params.manifest || params.manifestSrc) {
|
|
492
|
+
// const baseDir = params.manifestSrc ? getBaseDirectory(params.manifestSrc) : "";
|
|
493
|
+
// const loadAllFiles = (lasFiles) => {
|
|
494
|
+
// let i = 0;
|
|
495
|
+
// const modelsLoaded = new Array(lasFiles.length);
|
|
496
|
+
// const loadNext = () => {
|
|
497
|
+
// if (sceneModel.destroyed) {
|
|
498
|
+
// done();
|
|
499
|
+
// } else if (i >= lasFiles.length) {
|
|
500
|
+
// return
|
|
501
|
+
// } else {
|
|
502
|
+
// modelsLoaded[i] = false;
|
|
503
|
+
// this._dataSource.getLAS(`${baseDir}${lasFiles[i]}`, (arrayBuffer) => {
|
|
504
|
+
// const modelParams = utils.apply(params, {isManifest: true, index: i});
|
|
505
|
+
// this._parseModel(arrayBuffer, modelParams, options, sceneModel).then(() => {
|
|
506
|
+
// modelsLoaded[modelParams.index] = true;
|
|
507
|
+
// let allLoaded = true;
|
|
508
|
+
// modelsLoaded.forEach((loaded) => {
|
|
509
|
+
// if(!loaded) allLoaded = false;
|
|
510
|
+
// })
|
|
511
|
+
// if(allLoaded) done();
|
|
512
|
+
// });
|
|
513
|
+
// i++;
|
|
514
|
+
// this.scheduleTask(loadNext, 200);
|
|
515
|
+
// }, error);
|
|
516
|
+
// }
|
|
517
|
+
// }
|
|
518
|
+
// loadNext();
|
|
519
|
+
// };
|
|
520
|
+
// const loadManifestData = (manifestData) => {
|
|
521
|
+
// if(sceneModel.destroyed) return;
|
|
522
|
+
// const files = manifestData.lasFiles || manifestData.lazFiles;
|
|
523
|
+
// if(!files || files.length <= 0) {
|
|
524
|
+
// this.error(`load(): Failed to load model manifest - manifest not valid`);
|
|
525
|
+
// return;
|
|
526
|
+
// }
|
|
527
|
+
// loadAllFiles(files);
|
|
528
|
+
// }
|
|
529
|
+
// if(params.manifestSrc) {
|
|
530
|
+
// this._dataSource.getManifest(params.manifestSrc, (manifestData) => {
|
|
531
|
+
// loadManifestData(manifestData);
|
|
532
|
+
// }, (errMsg) => {
|
|
533
|
+
// this.error(errMsg);
|
|
534
|
+
// sceneModel.fire("error", errMsg);
|
|
535
|
+
// })
|
|
536
|
+
// } else {
|
|
537
|
+
// const manifestData = params.manifest;
|
|
538
|
+
// loadManifestData(manifestData);
|
|
539
|
+
// }
|
|
540
|
+
// }
|
|
541
|
+
|
|
542
|
+
// return sceneModel;
|
|
543
|
+
// }
|
|
544
|
+
|
|
545
|
+
// _loadModel(src, params, options, sceneModel) {
|
|
546
|
+
// const spinner = this.viewer.scene.canvas.spinner;
|
|
547
|
+
// spinner.processes++;
|
|
548
|
+
// this._dataSource.getLAS(params.src, (arrayBuffer) => {
|
|
549
|
+
// this._parseModel(arrayBuffer, params, options, sceneModel).then(() => {
|
|
550
|
+
// sceneModel.scene.once("tick", () => {
|
|
551
|
+
// if (sceneModel.destroyed) {
|
|
552
|
+
// return;
|
|
553
|
+
// }
|
|
554
|
+
// sceneModel.scene.fire("modelLoaded", sceneModel.id); // FIXME: Assumes listeners know order of these two events
|
|
555
|
+
// sceneModel.fire("loaded", true, false); // Don't forget the event, for late subscribers
|
|
556
|
+
// });
|
|
557
|
+
// spinner.processes--;
|
|
558
|
+
// }, (errMsg) => {
|
|
559
|
+
// spinner.processes--;
|
|
560
|
+
// this.error(errMsg);
|
|
561
|
+
// sceneModel.fire("error", errMsg);
|
|
562
|
+
// });
|
|
563
|
+
// },
|
|
564
|
+
// (errMsg) => {
|
|
565
|
+
// spinner.processes--;
|
|
566
|
+
// this.error(errMsg);
|
|
567
|
+
// sceneModel.fire("error", errMsg);
|
|
568
|
+
// });
|
|
569
|
+
// }
|
|
570
|
+
|
|
571
|
+
// _parseModel(arrayBuffer, params, options, sceneModel) {
|
|
572
|
+
|
|
573
|
+
// const readPositions = (attributesPosition) => {
|
|
574
|
+
// const positionsValue = attributesPosition.value;
|
|
575
|
+
// if (this._center) {
|
|
576
|
+
// const centerPos = math.vec3();
|
|
577
|
+
// const numPoints = positionsValue.length;
|
|
578
|
+
// for (let i = 0, len = positionsValue.length; i < len; i += 3) {
|
|
579
|
+
// centerPos[0] += positionsValue[i + 0];
|
|
580
|
+
// centerPos[1] += positionsValue[i + 1];
|
|
581
|
+
// centerPos[2] += positionsValue[i + 2];
|
|
582
|
+
// }
|
|
583
|
+
// centerPos[0] /= numPoints;
|
|
584
|
+
// centerPos[1] /= numPoints;
|
|
585
|
+
// centerPos[2] /= numPoints;
|
|
586
|
+
// for (let i = 0, len = positionsValue.length; i < len; i += 3) {
|
|
587
|
+
// positionsValue[i + 0] -= centerPos[0];
|
|
588
|
+
// positionsValue[i + 1] -= centerPos[1];
|
|
589
|
+
// positionsValue[i + 2] -= centerPos[2];
|
|
590
|
+
// }
|
|
591
|
+
// }
|
|
592
|
+
// if (this._rotateX) {
|
|
593
|
+
// if (positionsValue) {
|
|
594
|
+
// for (let i = 0, len = positionsValue.length; i < len; i += 3) {
|
|
595
|
+
// const temp = positionsValue[i + 1];
|
|
596
|
+
// positionsValue[i + 1] = positionsValue[i + 2];
|
|
597
|
+
// positionsValue[i + 2] = temp;
|
|
598
|
+
// }
|
|
599
|
+
// }
|
|
600
|
+
// }
|
|
601
|
+
// if (this._rotate) {
|
|
602
|
+
// const quaternion = math.identityQuaternion();
|
|
603
|
+
// const mat = math.mat4();
|
|
604
|
+
// math.eulerToQuaternion(this._rotate, "XYZ", quaternion);
|
|
605
|
+
// math.quaternionToRotationMat4(quaternion, mat);
|
|
606
|
+
// const pos = math.vec3();
|
|
607
|
+
// for (let i = 0, len = positionsValue.length; i < len; i += 3) {
|
|
608
|
+
// pos[0] = positionsValue[i + 0];
|
|
609
|
+
// pos[1] = positionsValue[i + 1];
|
|
610
|
+
// pos[2] = positionsValue[i + 2];
|
|
611
|
+
// math.transformPoint3(mat, pos, pos);
|
|
612
|
+
// positionsValue[i + 0] = pos[0];
|
|
613
|
+
// positionsValue[i + 1] = pos[1];
|
|
614
|
+
// positionsValue[i + 2] = pos[2];
|
|
615
|
+
// }
|
|
616
|
+
// }
|
|
617
|
+
// if (this._transform) {
|
|
618
|
+
// const mat = math.mat4(this._transform);
|
|
619
|
+
// const pos = math.vec3();
|
|
620
|
+
// for (let i = 0, len = positionsValue.length; i < len; i += 3) {
|
|
621
|
+
// pos[0] = positionsValue[i + 0];
|
|
622
|
+
// pos[1] = positionsValue[i + 1];
|
|
623
|
+
// pos[2] = positionsValue[i + 2];
|
|
624
|
+
// math.transformPoint3(mat, pos, pos);
|
|
625
|
+
// positionsValue[i + 0] = pos[0];
|
|
626
|
+
// positionsValue[i + 1] = pos[1];
|
|
627
|
+
// positionsValue[i + 2] = pos[2];
|
|
628
|
+
// }
|
|
629
|
+
// }
|
|
630
|
+
// return positionsValue;
|
|
631
|
+
// }
|
|
632
|
+
|
|
633
|
+
// function readColorsAndIntensities(attributesColor, attributesIntensity) {
|
|
634
|
+
// const colors = attributesColor.value;
|
|
635
|
+
// const colorSize = attributesColor.size;
|
|
636
|
+
// const intensities = attributesIntensity.value;
|
|
637
|
+
// const colorsCompressedSize = intensities.length * 4;
|
|
638
|
+
// const colorsCompressed = new Uint8Array(colorsCompressedSize);
|
|
639
|
+
// for (let i = 0, j = 0, k = 0, len = intensities.length; i < len; i++, k += colorSize, j += 4) {
|
|
640
|
+
// colorsCompressed[j + 0] = colors[k + 0];
|
|
641
|
+
// colorsCompressed[j + 1] = colors[k + 1];
|
|
642
|
+
// colorsCompressed[j + 2] = colors[k + 2];
|
|
643
|
+
// colorsCompressed[j + 3] = Math.round((intensities[i] / 65536) * 255);
|
|
644
|
+
// }
|
|
645
|
+
// return colorsCompressed;
|
|
646
|
+
// }
|
|
647
|
+
|
|
648
|
+
// function readIntensities(attributesIntensity) {
|
|
649
|
+
// const intensities = attributesIntensity.value;
|
|
650
|
+
// const colorsCompressedSize = intensities.length * 4;
|
|
651
|
+
// const colorsCompressed = new Uint8Array(colorsCompressedSize);
|
|
652
|
+
// for (let i = 0, j = 0, k = 0, len = intensities.length; i < len; i++, k += 3, j += 4) {
|
|
653
|
+
// colorsCompressed[j + 0] = 0;
|
|
654
|
+
// colorsCompressed[j + 1] = 0;
|
|
655
|
+
// colorsCompressed[j + 2] = 0;
|
|
656
|
+
// colorsCompressed[j + 3] = Math.round((intensities[i] / 65536) * 255);
|
|
657
|
+
// }
|
|
658
|
+
// return colorsCompressed;
|
|
659
|
+
// }
|
|
660
|
+
|
|
661
|
+
// return new Promise((resolve, reject) => {
|
|
662
|
+
|
|
663
|
+
// if (sceneModel.destroyed) {
|
|
664
|
+
// reject();
|
|
665
|
+
// return;
|
|
666
|
+
// }
|
|
667
|
+
|
|
668
|
+
// const stats = params.stats || {};
|
|
669
|
+
// stats.sourceFormat = "LAS";
|
|
670
|
+
// stats.schemaVersion = "";
|
|
671
|
+
// stats.title = "";
|
|
672
|
+
// stats.author = "";
|
|
673
|
+
// stats.created = "";
|
|
674
|
+
// stats.numMetaObjects = 0;
|
|
675
|
+
// stats.numPropertySets = 0;
|
|
676
|
+
// stats.numObjects = 0;
|
|
677
|
+
// stats.numGeometries = 0;
|
|
678
|
+
// stats.numTriangles = 0;
|
|
679
|
+
// stats.numVertices = 0;
|
|
680
|
+
|
|
681
|
+
// try {
|
|
682
|
+
|
|
683
|
+
// const lasHeader = loadLASHeader(arrayBuffer);
|
|
684
|
+
|
|
685
|
+
// parse(arrayBuffer, LASLoader, options).then((parsedData) => {
|
|
686
|
+
|
|
687
|
+
// const attributes = parsedData.attributes;
|
|
688
|
+
// const loaderData = parsedData.loaderData;
|
|
689
|
+
// const pointsFormatId = loaderData.pointsFormatId !== undefined ? loaderData.pointsFormatId : -1;
|
|
690
|
+
|
|
691
|
+
// if (!attributes.POSITION) {
|
|
692
|
+
// sceneModel.finalize();
|
|
693
|
+
// reject("No positions found in file");
|
|
694
|
+
// return;
|
|
695
|
+
// }
|
|
696
|
+
|
|
697
|
+
// let positionsValue
|
|
698
|
+
// let colorsCompressed;
|
|
699
|
+
|
|
700
|
+
// switch (pointsFormatId) {
|
|
701
|
+
// case 0:
|
|
702
|
+
// positionsValue = readPositions(attributes.POSITION);
|
|
703
|
+
// colorsCompressed = readIntensities(attributes.intensity);
|
|
704
|
+
// break;
|
|
705
|
+
// case 1:
|
|
706
|
+
// if (!attributes.intensity) {
|
|
707
|
+
// sceneModel.finalize();
|
|
708
|
+
// reject("No positions found in file");
|
|
709
|
+
// return;
|
|
710
|
+
// }
|
|
711
|
+
// positionsValue = readPositions(attributes.POSITION);
|
|
712
|
+
// colorsCompressed = readIntensities(attributes.intensity);
|
|
713
|
+
// break;
|
|
714
|
+
// case 2:
|
|
715
|
+
// if (!attributes.intensity) {
|
|
716
|
+
// sceneModel.finalize();
|
|
717
|
+
// reject("No positions found in file");
|
|
718
|
+
// return;
|
|
719
|
+
// }
|
|
720
|
+
// positionsValue = readPositions(attributes.POSITION);
|
|
721
|
+
// colorsCompressed = readColorsAndIntensities(attributes.COLOR_0, attributes.intensity);
|
|
722
|
+
// break;
|
|
723
|
+
// case 3:
|
|
724
|
+
// if (!attributes.intensity) {
|
|
725
|
+
// sceneModel.finalize();
|
|
726
|
+
// reject("No positions found in file");
|
|
727
|
+
// return;
|
|
728
|
+
// }
|
|
729
|
+
// positionsValue = readPositions(attributes.POSITION);
|
|
730
|
+
// colorsCompressed = readColorsAndIntensities(attributes.COLOR_0, attributes.intensity);
|
|
731
|
+
// break;
|
|
732
|
+
// }
|
|
733
|
+
|
|
734
|
+
// const pointsChunks = chunkArray(positionsValue, MAX_VERTICES * 3);
|
|
735
|
+
// const colorsChunks = chunkArray(colorsCompressed, MAX_VERTICES * 4);
|
|
736
|
+
// const meshIds = [];
|
|
737
|
+
|
|
738
|
+
// for (let i = 0, len = pointsChunks.length; i < len; i++) {
|
|
739
|
+
// const meshId = `${params.isManifest ? 'model'+params.index : ''}pointsMesh${i}`;
|
|
740
|
+
// meshIds.push(meshId);
|
|
741
|
+
// sceneModel.createMesh({
|
|
742
|
+
// id: meshId,
|
|
743
|
+
// primitive: "points",
|
|
744
|
+
// positions: pointsChunks[i],
|
|
745
|
+
// colorsCompressed: (i < colorsChunks.length) ? colorsChunks[i] : null
|
|
746
|
+
// });
|
|
747
|
+
// }
|
|
748
|
+
|
|
749
|
+
// const pointsObjectId = params.entityId || math.createUUID();
|
|
750
|
+
|
|
751
|
+
// sceneModel.createEntity({
|
|
752
|
+
// id: pointsObjectId,
|
|
753
|
+
// meshIds,
|
|
754
|
+
// isObject: true
|
|
755
|
+
// });
|
|
756
|
+
|
|
757
|
+
// sceneModel.finalize();
|
|
758
|
+
|
|
759
|
+
// if (params.metaModelJSON) {
|
|
760
|
+
// const metaModelId = sceneModel.id;
|
|
761
|
+
// this.viewer.metaScene.createMetaModel(metaModelId, params.metaModelJSON, options);
|
|
762
|
+
// } else if (params.loadMetadata !== false) {
|
|
763
|
+
// const rootMetaObjectId = math.createUUID();
|
|
764
|
+
// const metadata = {
|
|
765
|
+
// projectId: "",
|
|
766
|
+
// author: "",
|
|
767
|
+
// createdAt: "",
|
|
768
|
+
// schema: "",
|
|
769
|
+
// creatingApplication: "",
|
|
770
|
+
// metaObjects: [
|
|
771
|
+
// {
|
|
772
|
+
// id: rootMetaObjectId,
|
|
773
|
+
// name: "Model",
|
|
774
|
+
// type: "Model"
|
|
775
|
+
// },
|
|
776
|
+
// {
|
|
777
|
+
// id: pointsObjectId,
|
|
778
|
+
// name: "PointCloud (LAS)",
|
|
779
|
+
// type: "PointCloud",
|
|
780
|
+
// parent: rootMetaObjectId,
|
|
781
|
+
// attributes: lasHeader || {}
|
|
782
|
+
// }
|
|
783
|
+
// ],
|
|
784
|
+
// propertySets: []
|
|
785
|
+
// };
|
|
786
|
+
// const metaModelId = sceneModel.id;
|
|
787
|
+
// this.viewer.metaScene.createMetaModel(metaModelId, metadata, options);
|
|
788
|
+
// }
|
|
789
|
+
|
|
790
|
+
// resolve();
|
|
791
|
+
// });
|
|
792
|
+
// } catch (e) {
|
|
793
|
+
// sceneModel.finalize();
|
|
794
|
+
// reject(e);
|
|
795
|
+
// }
|
|
796
|
+
// });
|
|
797
|
+
// }
|
|
798
|
+
// }
|
|
799
|
+
|
|
800
|
+
// function chunkArray(array, chunkSize) {
|
|
801
|
+
// if (chunkSize >= array.length) {
|
|
802
|
+
// return [array];
|
|
803
|
+
// }
|
|
804
|
+
// let result = [];
|
|
805
|
+
// for (let i = 0; i < array.length; i += chunkSize) {
|
|
806
|
+
// result.push(array.slice(i, i + chunkSize));
|
|
807
|
+
// }
|
|
808
|
+
// return result;
|
|
809
|
+
// }
|
|
810
|
+
|
|
811
|
+
// function getBaseDirectory(filePath) {
|
|
812
|
+
// if (filePath.indexOf('?') > -1) {
|
|
813
|
+
// filePath = filePath.split('?')[0];
|
|
814
|
+
// }
|
|
815
|
+
|
|
816
|
+
// const pathArray = filePath.split('/');
|
|
817
|
+
// pathArray.pop(); // Remove the file name or the last segment of the path
|
|
818
|
+
// return pathArray.join('/') + '/';
|
|
819
|
+
// }
|
|
820
|
+
|
|
821
|
+
// export {LASLoaderPlugin};
|