x_ite 11.2.1 → 11.2.3
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/README.md +4 -4
- package/dist/assets/components/AnnotationComponent.js +2 -2
- package/dist/assets/components/AnnotationComponent.min.js +2 -2
- package/dist/assets/components/CADGeometryComponent.js +72 -58
- package/dist/assets/components/CADGeometryComponent.min.js +2 -2
- package/dist/assets/components/CubeMapTexturingComponent.js +2 -2
- package/dist/assets/components/CubeMapTexturingComponent.min.js +2 -2
- package/dist/assets/components/DISComponent.js +2 -2
- package/dist/assets/components/DISComponent.min.js +2 -2
- package/dist/assets/components/EventUtilitiesComponent.js +2 -2
- package/dist/assets/components/EventUtilitiesComponent.min.js +2 -2
- package/dist/assets/components/Geometry2DComponent.js +2 -2
- package/dist/assets/components/Geometry2DComponent.min.js +2 -2
- package/dist/assets/components/GeospatialComponent.js +4 -4
- package/dist/assets/components/GeospatialComponent.min.js +2 -2
- package/dist/assets/components/HAnimComponent.js +2 -2
- package/dist/assets/components/HAnimComponent.min.js +2 -2
- package/dist/assets/components/KeyDeviceSensorComponent.js +2 -2
- package/dist/assets/components/KeyDeviceSensorComponent.min.js +2 -2
- package/dist/assets/components/LayoutComponent.js +22 -7
- package/dist/assets/components/LayoutComponent.min.js +2 -2
- package/dist/assets/components/NURBSComponent.js +2 -2
- package/dist/assets/components/NURBSComponent.min.js +2 -2
- package/dist/assets/components/ParticleSystemsComponent.js +3 -3
- package/dist/assets/components/ParticleSystemsComponent.min.js +2 -2
- package/dist/assets/components/PickingComponent.js +2 -2
- package/dist/assets/components/PickingComponent.min.js +2 -2
- package/dist/assets/components/RigidBodyPhysicsComponent.js +5 -5
- package/dist/assets/components/RigidBodyPhysicsComponent.min.js +2 -2
- package/dist/assets/components/ScriptingComponent.js +2 -2
- package/dist/assets/components/ScriptingComponent.min.js +2 -2
- package/dist/assets/components/TextComponent.js +16336 -14672
- package/dist/assets/components/TextComponent.min.js +2 -2
- package/dist/assets/components/TextureProjectionComponent.js +2 -2
- package/dist/assets/components/TextureProjectionComponent.min.js +2 -2
- package/dist/assets/components/Texturing3DComponent.js +104 -104
- package/dist/assets/components/Texturing3DComponent.min.js +2 -2
- package/dist/assets/components/VolumeRenderingComponent.js +3 -3
- package/dist/assets/components/VolumeRenderingComponent.min.js +2 -2
- package/dist/assets/components/WebXRComponent.js +170 -94
- package/dist/assets/components/WebXRComponent.min.js +2 -2
- package/dist/assets/components/X_ITEComponent.js +3 -3
- package/dist/assets/components/X_ITEComponent.min.js +2 -2
- package/dist/assets/fonts/Droid/DroidSerif-Bold.woff2 +0 -0
- package/dist/assets/fonts/Droid/DroidSerif-BoldItalic.woff2 +0 -0
- package/dist/assets/fonts/Droid/DroidSerif-Italic.woff2 +0 -0
- package/dist/assets/fonts/Droid/DroidSerif-Regular.woff2 +0 -0
- package/dist/assets/fonts/PT_Sans/PTSans-Bold.woff2 +0 -0
- package/dist/assets/fonts/PT_Sans/PTSans-BoldItalic.woff2 +0 -0
- package/dist/assets/fonts/PT_Sans/PTSans-Italic.woff2 +0 -0
- package/dist/assets/fonts/PT_Sans/PTSans-Regular.woff2 +0 -0
- package/dist/assets/fonts/Ubuntu/Ubuntu-B.woff2 +0 -0
- package/dist/assets/fonts/Ubuntu/Ubuntu-BI.woff2 +0 -0
- package/dist/assets/fonts/Ubuntu/Ubuntu-R.woff2 +0 -0
- package/dist/assets/fonts/Ubuntu/Ubuntu-RI.woff2 +0 -0
- package/dist/assets/fonts/Ubuntu/UbuntuMono-B.woff2 +0 -0
- package/dist/assets/fonts/Ubuntu/UbuntuMono-BI.woff2 +0 -0
- package/dist/assets/fonts/Ubuntu/UbuntuMono-R.woff2 +0 -0
- package/dist/assets/fonts/Ubuntu/UbuntuMono-RI.woff2 +0 -0
- package/dist/assets/images/XR.svg +4 -34
- package/dist/assets/lib/decompress_binding.js +1 -0
- package/dist/example.html +1 -1
- package/dist/x_ite.css +1 -1
- package/dist/x_ite.d.ts +1 -1
- package/dist/x_ite.js +54126 -54272
- package/dist/x_ite.min.js +2 -2
- package/dist/x_ite.min.mjs +2 -2
- package/dist/x_ite.mjs +48936 -49082
- package/dist/x_ite.zip +0 -0
- package/package.json +3 -2
- package/dist/assets/fonts/Droid/DroidSerif-Bold.ttf +0 -0
- package/dist/assets/fonts/Droid/DroidSerif-BoldItalic.ttf +0 -0
- package/dist/assets/fonts/Droid/DroidSerif-Italic.ttf +0 -0
- package/dist/assets/fonts/Droid/DroidSerif-Regular.ttf +0 -0
- package/dist/assets/fonts/PT_Sans/PTSans-Bold.ttf +0 -0
- package/dist/assets/fonts/PT_Sans/PTSans-BoldItalic.ttf +0 -0
- package/dist/assets/fonts/PT_Sans/PTSans-Italic.ttf +0 -0
- package/dist/assets/fonts/PT_Sans/PTSans-Regular.ttf +0 -0
- package/dist/assets/fonts/Ubuntu/Ubuntu-B.ttf +0 -0
- package/dist/assets/fonts/Ubuntu/Ubuntu-BI.ttf +0 -0
- package/dist/assets/fonts/Ubuntu/Ubuntu-R.ttf +0 -0
- package/dist/assets/fonts/Ubuntu/Ubuntu-RI.ttf +0 -0
- package/dist/assets/fonts/Ubuntu/UbuntuMono-B.ttf +0 -0
- package/dist/assets/fonts/Ubuntu/UbuntuMono-BI.ttf +0 -0
- package/dist/assets/fonts/Ubuntu/UbuntuMono-R.ttf +0 -0
- package/dist/assets/fonts/Ubuntu/UbuntuMono-RI.ttf +0 -0
|
@@ -1,9 +1,41 @@
|
|
|
1
|
-
/* X_ITE v11.2.
|
|
2
|
-
const __X_ITE_X3D__ = window [Symbol .for ("X_ITE.X3D-11.2.
|
|
1
|
+
/* X_ITE v11.2.3 */
|
|
2
|
+
const __X_ITE_X3D__ = window [Symbol .for ("X_ITE.X3D-11.2.3")];
|
|
3
3
|
/******/ (() => { // webpackBootstrap
|
|
4
4
|
/******/ "use strict";
|
|
5
|
-
/******/
|
|
6
|
-
|
|
5
|
+
/******/ var __webpack_modules__ = ({
|
|
6
|
+
|
|
7
|
+
/***/ 254:
|
|
8
|
+
/***/ ((module) => {
|
|
9
|
+
|
|
10
|
+
module.exports = __X_ITE_X3D__ .jquery;
|
|
11
|
+
|
|
12
|
+
/***/ })
|
|
13
|
+
|
|
14
|
+
/******/ });
|
|
15
|
+
/************************************************************************/
|
|
16
|
+
/******/ // The module cache
|
|
17
|
+
/******/ var __webpack_module_cache__ = {};
|
|
18
|
+
/******/
|
|
19
|
+
/******/ // The require function
|
|
20
|
+
/******/ function __webpack_require__(moduleId) {
|
|
21
|
+
/******/ // Check if module is in cache
|
|
22
|
+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
23
|
+
/******/ if (cachedModule !== undefined) {
|
|
24
|
+
/******/ return cachedModule.exports;
|
|
25
|
+
/******/ }
|
|
26
|
+
/******/ // Create a new module (and put it into the cache)
|
|
27
|
+
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
28
|
+
/******/ // no module.id needed
|
|
29
|
+
/******/ // no module.loaded needed
|
|
30
|
+
/******/ exports: {}
|
|
31
|
+
/******/ };
|
|
32
|
+
/******/
|
|
33
|
+
/******/ // Execute the module function
|
|
34
|
+
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
35
|
+
/******/
|
|
36
|
+
/******/ // Return the exports of the module
|
|
37
|
+
/******/ return module.exports;
|
|
38
|
+
/******/ }
|
|
7
39
|
/******/
|
|
8
40
|
/************************************************************************/
|
|
9
41
|
/******/ /* webpack/runtime/compat get default export */
|
|
@@ -297,8 +329,7 @@ var external_X_ITE_X3D_Lock_default = /*#__PURE__*/__webpack_require__.n(externa
|
|
|
297
329
|
;// external "__X_ITE_X3D__ .ExamineViewer"
|
|
298
330
|
const external_X_ITE_X3D_ExamineViewer_namespaceObject = __X_ITE_X3D__ .ExamineViewer;
|
|
299
331
|
var external_X_ITE_X3D_ExamineViewer_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_ExamineViewer_namespaceObject);
|
|
300
|
-
;// ./src/x_ite/Browser/WebXR/
|
|
301
|
-
|
|
332
|
+
;// ./src/x_ite/Browser/WebXR/xrExamineViewer.js
|
|
302
333
|
|
|
303
334
|
|
|
304
335
|
const
|
|
@@ -354,7 +385,7 @@ Object .assign ((external_X_ITE_X3D_ExamineViewer_default()).prototype,
|
|
|
354
385
|
{
|
|
355
386
|
// Rotate
|
|
356
387
|
|
|
357
|
-
this .startRotate (0, 0);
|
|
388
|
+
this .startRotate (0, 0, 1);
|
|
358
389
|
this .rotate (-gamepad .axes [2] * GAMEPAD_SPIN_FACTOR * f, gamepad .axes [3] * GAMEPAD_SPIN_FACTOR * f);
|
|
359
390
|
}
|
|
360
391
|
},
|
|
@@ -363,7 +394,7 @@ Object .assign ((external_X_ITE_X3D_ExamineViewer_default()).prototype,
|
|
|
363
394
|
;// external "__X_ITE_X3D__ .X3DFlyViewer"
|
|
364
395
|
const external_X_ITE_X3D_X3DFlyViewer_namespaceObject = __X_ITE_X3D__ .X3DFlyViewer;
|
|
365
396
|
var external_X_ITE_X3D_X3DFlyViewer_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_X3DFlyViewer_namespaceObject);
|
|
366
|
-
;// ./src/x_ite/Browser/WebXR/
|
|
397
|
+
;// ./src/x_ite/Browser/WebXR/xrX3DFlyViewer.js
|
|
367
398
|
|
|
368
399
|
|
|
369
400
|
|
|
@@ -419,7 +450,7 @@ Object .assign ((external_X_ITE_X3D_X3DFlyViewer_default()).prototype,
|
|
|
419
450
|
;// external "__X_ITE_X3D__ .X3DViewer"
|
|
420
451
|
const external_X_ITE_X3D_X3DViewer_namespaceObject = __X_ITE_X3D__ .X3DViewer;
|
|
421
452
|
var external_X_ITE_X3D_X3DViewer_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_X3DViewer_namespaceObject);
|
|
422
|
-
;// ./src/x_ite/Browser/WebXR/
|
|
453
|
+
;// ./src/x_ite/Browser/WebXR/xrX3DViewer.js
|
|
423
454
|
|
|
424
455
|
|
|
425
456
|
Object .assign ((external_X_ITE_X3D_X3DViewer_default()).prototype,
|
|
@@ -429,6 +460,7 @@ Object .assign ((external_X_ITE_X3D_X3DViewer_default()).prototype,
|
|
|
429
460
|
});
|
|
430
461
|
|
|
431
462
|
;// ./src/x_ite/Browser/WebXR/X3DWebXRContext.js
|
|
463
|
+
/* provided dependency */ var $ = __webpack_require__(254);
|
|
432
464
|
/*******************************************************************************
|
|
433
465
|
*
|
|
434
466
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
@@ -490,9 +522,11 @@ Object .assign ((external_X_ITE_X3D_X3DViewer_default()).prototype,
|
|
|
490
522
|
|
|
491
523
|
|
|
492
524
|
const
|
|
525
|
+
_sessionLock = Symbol (),
|
|
493
526
|
_referenceSpace = Symbol (),
|
|
494
527
|
_baseLayer = Symbol (),
|
|
495
528
|
_pose = Symbol (),
|
|
529
|
+
_visible = Symbol (),
|
|
496
530
|
_inputSources = Symbol (),
|
|
497
531
|
_inputRay = Symbol (),
|
|
498
532
|
_inputPoint = Symbol (),
|
|
@@ -506,9 +540,38 @@ function X3DWebXRContext ()
|
|
|
506
540
|
|
|
507
541
|
Object .assign (X3DWebXRContext .prototype,
|
|
508
542
|
{
|
|
509
|
-
|
|
543
|
+
getPose ()
|
|
544
|
+
{
|
|
545
|
+
return this [_pose];
|
|
546
|
+
},
|
|
547
|
+
xrAddButton ()
|
|
548
|
+
{
|
|
549
|
+
if (!this .getBrowserOption ("XRButton"))
|
|
550
|
+
return;
|
|
551
|
+
|
|
552
|
+
$("<div></div>")
|
|
553
|
+
.attr ("part", "xr-button")
|
|
554
|
+
.attr ("title", "Start WebXR session.")
|
|
555
|
+
.addClass ("x_ite-private-xr-button")
|
|
556
|
+
.on ("mousedown touchstart", false)
|
|
557
|
+
.on ("mouseup touchend", event =>
|
|
558
|
+
{
|
|
559
|
+
event .preventDefault ();
|
|
560
|
+
event .stopImmediatePropagation ();
|
|
561
|
+
event .stopPropagation ();
|
|
562
|
+
|
|
563
|
+
this .startAudioElements ();
|
|
564
|
+
|
|
565
|
+
if (this .getSession () === window)
|
|
566
|
+
this .xrStartSession ();
|
|
567
|
+
else
|
|
568
|
+
this .xrStopSession ();
|
|
569
|
+
})
|
|
570
|
+
.appendTo (this .getSurface ());
|
|
571
|
+
},
|
|
572
|
+
async xrStartSession ()
|
|
510
573
|
{
|
|
511
|
-
return external_X_ITE_X3D_Lock_default().acquire (
|
|
574
|
+
return external_X_ITE_X3D_Lock_default().acquire (_sessionLock, async () =>
|
|
512
575
|
{
|
|
513
576
|
if (this .getSession () !== window)
|
|
514
577
|
return;
|
|
@@ -516,25 +579,21 @@ Object .assign (X3DWebXRContext .prototype,
|
|
|
516
579
|
const
|
|
517
580
|
gl = this .getContext (),
|
|
518
581
|
mode = this .getBrowserOption ("XRSessionMode") .toLowerCase () .replaceAll ("_", "-"),
|
|
519
|
-
compatible = await gl .makeXRCompatible (),
|
|
520
582
|
session = await navigator .xr .requestSession (mode),
|
|
521
|
-
referenceSpace = await session .requestReferenceSpace ("local")
|
|
522
|
-
|
|
523
|
-
// WebXR Emulator: must bind default framebuffer, to get xr emulator working.
|
|
524
|
-
gl .bindFramebuffer (gl .FRAMEBUFFER, null);
|
|
583
|
+
referenceSpace = await session .requestReferenceSpace ("local"),
|
|
584
|
+
compatible = await gl .makeXRCompatible ();
|
|
525
585
|
|
|
526
|
-
this .
|
|
527
|
-
this .finishedEvents () .addInterest ("updatePointers", this);
|
|
528
|
-
this .endEvents () .addInterest ("endFrame", this);
|
|
586
|
+
this .finishedEvents () .addInterest ("xrUpdatePointers", this);
|
|
529
587
|
|
|
530
|
-
session .addEventListener ("
|
|
531
|
-
session .addEventListener ("
|
|
588
|
+
session .addEventListener ("visibilitychange", () => this .xrUpdateVisibility ());
|
|
589
|
+
session .addEventListener ("inputsourceschange", event => this .xrUpdateInputSources (event));
|
|
590
|
+
session .addEventListener ("end", () => this .xrStopSession ());
|
|
532
591
|
|
|
533
592
|
this [_referenceSpace] = referenceSpace;
|
|
534
|
-
|
|
535
|
-
this [_inputSources]
|
|
536
|
-
this [_inputRay]
|
|
537
|
-
this [_inputPoint]
|
|
593
|
+
this [_visible] = true;
|
|
594
|
+
this [_inputSources] = new Set ();
|
|
595
|
+
this [_inputRay] = new (external_X_ITE_X3D_ScreenLine_default()) (this, 4, 2, 0.9);
|
|
596
|
+
this [_inputPoint] = new Rendering_ScreenPoint (this);
|
|
538
597
|
|
|
539
598
|
Object .assign (this [_gamepads], { action: true });
|
|
540
599
|
|
|
@@ -544,10 +603,14 @@ Object .assign (X3DWebXRContext .prototype,
|
|
|
544
603
|
views: [ ],
|
|
545
604
|
};
|
|
546
605
|
|
|
547
|
-
this .
|
|
606
|
+
this .xrUpdateBaseLayer ({ }, session);
|
|
548
607
|
this .setSession (session);
|
|
549
608
|
this .removeHit (this .getHit ());
|
|
550
609
|
|
|
610
|
+
// Rendering Properties
|
|
611
|
+
|
|
612
|
+
this .getRenderingProperties () ._ContentScale .addInterest ("xrContentScale", this);
|
|
613
|
+
|
|
551
614
|
this .getRenderingProperties () ._XRSession = true;
|
|
552
615
|
|
|
553
616
|
// session .addEventListener ("select", event =>
|
|
@@ -560,18 +623,16 @@ Object .assign (X3DWebXRContext .prototype,
|
|
|
560
623
|
// });
|
|
561
624
|
});
|
|
562
625
|
},
|
|
563
|
-
|
|
626
|
+
xrStopSession ()
|
|
564
627
|
{
|
|
565
|
-
return external_X_ITE_X3D_Lock_default().acquire (
|
|
628
|
+
return external_X_ITE_X3D_Lock_default().acquire (_sessionLock, async () =>
|
|
566
629
|
{
|
|
567
630
|
if (this .getSession () === window)
|
|
568
631
|
return;
|
|
569
632
|
|
|
570
633
|
await this .getSession () .end () .catch (Function .prototype);
|
|
571
634
|
|
|
572
|
-
this .
|
|
573
|
-
this .finishedEvents () .removeInterest ("updatePointers", this);
|
|
574
|
-
this .endEvents () .removeInterest ("endFrame", this);
|
|
635
|
+
this .finishedEvents () .removeInterest ("xrUpdatePointers", this);
|
|
575
636
|
|
|
576
637
|
this .setSession (window);
|
|
577
638
|
this .setDefaultFramebuffer (null);
|
|
@@ -582,19 +643,24 @@ Object .assign (X3DWebXRContext .prototype,
|
|
|
582
643
|
this [_referenceSpace] = null;
|
|
583
644
|
this [_baseLayer] = null;
|
|
584
645
|
this [_pose] = null;
|
|
646
|
+
this [_visible] = false;
|
|
585
647
|
this [_inputSources] = null;
|
|
586
648
|
this [_inputRay] = null;
|
|
587
649
|
this [_inputPoint] = null;
|
|
588
650
|
this [_frame] = null;
|
|
589
651
|
|
|
652
|
+
// Rendering Properties
|
|
653
|
+
|
|
654
|
+
this .getRenderingProperties () ._ContentScale .removeInterest ("xrContentScale", this);
|
|
655
|
+
|
|
590
656
|
this .getRenderingProperties () ._XRSession = false;
|
|
591
657
|
});
|
|
592
658
|
},
|
|
593
|
-
|
|
659
|
+
xrContentScale ()
|
|
594
660
|
{
|
|
595
|
-
this .
|
|
661
|
+
this .xrUpdateBaseLayer ();
|
|
596
662
|
},
|
|
597
|
-
|
|
663
|
+
xrUpdateBaseLayer (options = { }, session = this .getSession ())
|
|
598
664
|
{
|
|
599
665
|
if (session === window)
|
|
600
666
|
return;
|
|
@@ -614,7 +680,45 @@ Object .assign (X3DWebXRContext .prototype,
|
|
|
614
680
|
|
|
615
681
|
this .setDefaultFramebuffer (baseLayer .framebuffer);
|
|
616
682
|
},
|
|
617
|
-
|
|
683
|
+
xrUpdateNearFarPlanes: (function ()
|
|
684
|
+
{
|
|
685
|
+
const nearFarPlanes = { };
|
|
686
|
+
|
|
687
|
+
return function ()
|
|
688
|
+
{
|
|
689
|
+
const
|
|
690
|
+
navigationInfoNode = this .getActiveNavigationInfo (),
|
|
691
|
+
viewpointNode = this .getActiveViewpoint ();
|
|
692
|
+
|
|
693
|
+
if (viewpointNode)
|
|
694
|
+
{
|
|
695
|
+
nearFarPlanes .depthNear = viewpointNode .getNearDistance (navigationInfoNode);
|
|
696
|
+
nearFarPlanes .depthFar = viewpointNode .getFarDistance (navigationInfoNode);
|
|
697
|
+
}
|
|
698
|
+
else
|
|
699
|
+
{
|
|
700
|
+
nearFarPlanes .depthNear = 0.1;
|
|
701
|
+
nearFarPlanes .depthFar = 10_000;
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
this .getSession () .updateRenderState (nearFarPlanes);
|
|
705
|
+
};
|
|
706
|
+
})(),
|
|
707
|
+
xrUpdateVisibility (event)
|
|
708
|
+
{
|
|
709
|
+
switch (this .getSession () .visibilityState)
|
|
710
|
+
{
|
|
711
|
+
case "visible-blurred":
|
|
712
|
+
case "hidden":
|
|
713
|
+
this [_visible] = false;
|
|
714
|
+
break;
|
|
715
|
+
|
|
716
|
+
default:
|
|
717
|
+
this [_visible] = true;
|
|
718
|
+
break;
|
|
719
|
+
}
|
|
720
|
+
},
|
|
721
|
+
xrUpdateInputSources (event)
|
|
618
722
|
{
|
|
619
723
|
for (const inputSource of event .added)
|
|
620
724
|
{
|
|
@@ -643,40 +747,16 @@ Object .assign (X3DWebXRContext .prototype,
|
|
|
643
747
|
this .removeHit (inputSource .hit);
|
|
644
748
|
this [_inputSources] .delete (inputSource);
|
|
645
749
|
}
|
|
750
|
+
|
|
751
|
+
this .xrUpdateGamepads ();
|
|
646
752
|
},
|
|
647
|
-
|
|
753
|
+
xrUpdateGamepads ()
|
|
648
754
|
{
|
|
649
|
-
if (!frame)
|
|
650
|
-
return;
|
|
651
|
-
|
|
652
|
-
this [_frame] = frame;
|
|
653
|
-
|
|
654
|
-
// Emulator
|
|
655
|
-
|
|
656
|
-
const emulator = !this .getCanvas () .parent () .is (this .getSurface ());
|
|
657
|
-
|
|
658
|
-
// WebXR Emulator or polyfill.
|
|
659
|
-
if (emulator)
|
|
660
|
-
this .getCanvas () .css (this .getXREmulatorCSS ());
|
|
661
|
-
|
|
662
|
-
// TODO: Clip planes
|
|
663
|
-
|
|
664
|
-
// const
|
|
665
|
-
// navigationInfoNode = this .getActiveNavigationInfo (),
|
|
666
|
-
// viewpointNode = this .getActiveViewpoint ();
|
|
667
|
-
|
|
668
|
-
// this .getSession () .updateRenderState ({
|
|
669
|
-
// depthNear: viewpointNode .getNearDistance (navigationInfoNode), // 0.1
|
|
670
|
-
// depthFar: viewpointNode .getFarDistance (navigationInfoNode), // 10_000
|
|
671
|
-
// });
|
|
672
|
-
|
|
673
|
-
// Navigation
|
|
674
|
-
|
|
675
755
|
this [_gamepads] .length = 0;
|
|
676
756
|
|
|
677
|
-
for (const {
|
|
757
|
+
for (const { gamepad } of this [_inputSources])
|
|
678
758
|
{
|
|
679
|
-
if (!
|
|
759
|
+
if (!gamepad)
|
|
680
760
|
continue;
|
|
681
761
|
|
|
682
762
|
if (gamepad .axes .length < 4)
|
|
@@ -684,18 +764,28 @@ Object .assign (X3DWebXRContext .prototype,
|
|
|
684
764
|
|
|
685
765
|
this [_gamepads] .push (gamepad);
|
|
686
766
|
}
|
|
767
|
+
},
|
|
768
|
+
xrFrame (frame)
|
|
769
|
+
{
|
|
770
|
+
if (!frame)
|
|
771
|
+
return;
|
|
772
|
+
|
|
773
|
+
this [_frame] = frame;
|
|
774
|
+
|
|
775
|
+
// Projection matrix
|
|
776
|
+
|
|
777
|
+
this .xrUpdateNearFarPlanes ();
|
|
778
|
+
|
|
779
|
+
// Navigation
|
|
687
780
|
|
|
688
781
|
this .getViewer () .gamepads (this [_gamepads]);
|
|
782
|
+
this .xrUpdatePose ();
|
|
689
783
|
|
|
690
784
|
// Trigger new frame.
|
|
691
785
|
|
|
692
786
|
this .addBrowserEvent ();
|
|
693
787
|
},
|
|
694
|
-
|
|
695
|
-
{
|
|
696
|
-
return this [_pose];
|
|
697
|
-
},
|
|
698
|
-
updatePose ()
|
|
788
|
+
xrUpdatePose ()
|
|
699
789
|
{
|
|
700
790
|
// Get matrices from views.
|
|
701
791
|
|
|
@@ -706,7 +796,7 @@ Object .assign (X3DWebXRContext .prototype,
|
|
|
706
796
|
pose .cameraSpaceMatrix .assign (originalPose .transform .matrix);
|
|
707
797
|
pose .viewMatrix .assign (originalPose .transform .inverse .matrix);
|
|
708
798
|
|
|
709
|
-
let
|
|
799
|
+
let i = 0;
|
|
710
800
|
|
|
711
801
|
for (const originalView of originalPose .views)
|
|
712
802
|
{
|
|
@@ -716,9 +806,9 @@ Object .assign (X3DWebXRContext .prototype,
|
|
|
716
806
|
if (!width)
|
|
717
807
|
continue;
|
|
718
808
|
|
|
719
|
-
this .reshapeFramebuffer (
|
|
809
|
+
this .reshapeFramebuffer (i, x, y, width, height);
|
|
720
810
|
|
|
721
|
-
const view = pose .views [
|
|
811
|
+
const view = pose .views [i] ??= {
|
|
722
812
|
projectionMatrix: new (external_X_ITE_X3D_Matrix4_default()) (),
|
|
723
813
|
cameraSpaceMatrix: new (external_X_ITE_X3D_Matrix4_default()) (),
|
|
724
814
|
viewMatrix: new (external_X_ITE_X3D_Matrix4_default()) (),
|
|
@@ -733,13 +823,13 @@ Object .assign (X3DWebXRContext .prototype,
|
|
|
733
823
|
view .matrix .assign (pose .cameraSpaceMatrix) .multRight (view .viewMatrix);
|
|
734
824
|
view .inverse .assign (view .cameraSpaceMatrix) .multRight (pose .viewMatrix);
|
|
735
825
|
|
|
736
|
-
++
|
|
826
|
+
++ i;
|
|
737
827
|
}
|
|
738
828
|
|
|
739
|
-
|
|
740
|
-
|
|
829
|
+
this .getFramebuffers () .length = i;
|
|
830
|
+
pose .views .length = i;
|
|
741
831
|
},
|
|
742
|
-
|
|
832
|
+
xrUpdatePointers: (function ()
|
|
743
833
|
{
|
|
744
834
|
const
|
|
745
835
|
blue = new (external_X_ITE_X3D_Color3_default()) (0.5, 0.75, 1),
|
|
@@ -788,7 +878,7 @@ Object .assign (X3DWebXRContext .prototype,
|
|
|
788
878
|
|
|
789
879
|
// Make a vibration puls if there is a sensor hit.
|
|
790
880
|
|
|
791
|
-
this .
|
|
881
|
+
this .xrSensorHitPulse (hit, gamepad);
|
|
792
882
|
|
|
793
883
|
// Update matrices and determine pointer position.
|
|
794
884
|
|
|
@@ -856,15 +946,8 @@ Object .assign (X3DWebXRContext .prototype,
|
|
|
856
946
|
|
|
857
947
|
// Draw input source rays.
|
|
858
948
|
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
// case "visible-blurred":
|
|
862
|
-
// case "hidden":
|
|
863
|
-
// return;
|
|
864
|
-
|
|
865
|
-
// default:
|
|
866
|
-
// break;
|
|
867
|
-
// }
|
|
949
|
+
if (!this [_visible])
|
|
950
|
+
return;
|
|
868
951
|
|
|
869
952
|
for (const [i, { viewMatrix, projectionMatrix }] of pose .views .entries ())
|
|
870
953
|
{
|
|
@@ -924,14 +1007,7 @@ Object .assign (X3DWebXRContext .prototype,
|
|
|
924
1007
|
}
|
|
925
1008
|
};
|
|
926
1009
|
})(),
|
|
927
|
-
|
|
928
|
-
{
|
|
929
|
-
const gl = this .getContext ();
|
|
930
|
-
|
|
931
|
-
// WebXR Emulator and polyfill: bind to null, to prevent changes.
|
|
932
|
-
gl .bindVertexArray (null);
|
|
933
|
-
},
|
|
934
|
-
sensorHitPulse (hit, gamepad)
|
|
1010
|
+
xrSensorHitPulse (hit, gamepad)
|
|
935
1011
|
{
|
|
936
1012
|
if (hit .sensors .size)
|
|
937
1013
|
{
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* X_ITE v11.2.
|
|
2
|
-
const e=window[Symbol.for("X_ITE.X3D-11.2.1")];(()=>{var t={n:e=>{var i=e&&e.__esModule?()=>e.default:()=>e;return t.d(i,{a:i}),i},d:(e,i)=>{for(var s in i)t.o(i,s)&&!t.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:i[s]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const i=e.Components;var s=t.n(i);const r=e.ScreenLine;var n=t.n(r);const a=e.GeometryContext;var o=t.n(a);const c=e.AlphaMode;var h=t.n(c);const d=e.VertexArray;var u=t.n(d);const l=e.Layer;var m=t.n(l);const f=e.Matrix4;var p=t.n(f);const g=e.Namespace;var x=t.n(g);function b(e){const t=e.getContext();this.browser=e,this.vertexArrayObject=new(u())(t),this.circleVertexBuffer=t.createBuffer(),this.circleGeometryContext=new(o())({renderObject:new(m())(e.getPrivateScene()),alphaMode:h().BLEND,geometryType:1}),this.circleGeometryContext.renderObject.setup();const i=e.getCircle2DOptions().getGeometry().getVertices();this.circleNumVertices=i.length/4,t.bindBuffer(t.ARRAY_BUFFER,this.circleVertexBuffer),t.bufferData(t.ARRAY_BUFFER,i.getValue(),t.STATIC_DRAW),this.diskVertexBuffer=t.createBuffer(),this.diskGeometryContext=new(o())({renderObject:this.circleGeometryContext.renderObject,alphaMode:h().BLEND,geometryType:3});const s=e.getDisk2DOptions().getDiskVertices();this.diskNumVertices=s.length/4,t.bindBuffer(t.ARRAY_BUFFER,this.diskVertexBuffer),t.bufferData(t.ARRAY_BUFFER,s.getValue(),t.STATIC_DRAW)}Object.assign(b.prototype,{display:(()=>{const e=new Float32Array(p().Identity),t=new Float32Array(p().Identity),i=new Float32Array(p().Identity),s=new(p()),r=[];return function(n,a,o,c,h,d,u){const l=this.browser,m=l.getContext(),f=l.getViewport();u.bind(),m.viewport(...f),m.scissor(...f);const p=n*Math.abs(h.origin.z),g=h.xAxis.normalize().multiply(p),x=h.yAxis.normalize().multiply(p),b=h.zAxis.normalize().multiply(p);s.set(...g,0,...x,0,...b,0,...h.origin,1),e.set(d),t.set(s),m.depthMask(!1),m.disable(m.DEPTH_TEST),m.enable(m.BLEND),m.disable(m.CULL_FACE);{const s=l.getDefaultMaterial().getShader(this.circleGeometryContext);s.enable(m),s.setClipPlanes(m,r),m.uniformMatrix4fv(s.x3d_ProjectionMatrix,!1,e),m.uniformMatrix4fv(s.x3d_ModelViewMatrix,!1,t),m.uniformMatrix4fv(s.x3d_EyeMatrix,!1,i),m.uniform3f(s.x3d_EmissiveColor,0,0,0),m.uniform1f(s.x3d_Transparency,c),this.vertexArrayObject.enable(s.getProgram())&&s.enableVertexAttribute(m,this.circleVertexBuffer,0,0),m.drawArrays(m.LINES,0,this.circleNumVertices)}{const s=l.getDefaultMaterial().getShader(this.diskGeometryContext);s.enable(m),s.setClipPlanes(m,r),m.uniformMatrix4fv(s.x3d_ProjectionMatrix,!1,e),m.uniformMatrix4fv(s.x3d_ModelViewMatrix,!1,t),m.uniformMatrix4fv(s.x3d_EyeMatrix,!1,i),m.uniform3f(s.x3d_EmissiveColor,...a),m.uniform1f(s.x3d_Transparency,o),this.vertexArrayObject.enable(s.getProgram())&&s.enableVertexAttribute(m,this.diskVertexBuffer,0,0),m.drawArrays(m.TRIANGLES,0,this.diskNumVertices)}m.depthMask(!0),m.enable(m.DEPTH_TEST),m.disable(m.BLEND)}})(),dispose(){const e=this.browser.getContext();e.deleteBuffer(this.diskVertexBuffer),this.diskVertexArrayObject.dispose(e)}});const w=b,v=x().add("ScreenPoint",w),y=e.ViewVolume;var M=t.n(y);const S=e.Color3;var R=t.n(S);const V=e.Vector3;var C=t.n(V);const E=e.Rotation4;var A=t.n(E);const P=e.Lock;var F=t.n(P);const j=e.ExamineViewer;var B=t.n(j);Object.assign(B().prototype,{gamepads(e){const t=e.find((({axes:e})=>e[2]||e[3]));if(!t)return void(e.action&&(e.action=!1,this.disconnect()));const i=t.buttons[0].pressed,s=t.buttons[1].pressed;e.button0===i&&e.button1===s||(e.button0=i,e.button1=s,this.disconnect());const r=60/this.getBrowser().currentFrameRate;e.action=!0,i?this.zoom(.005*t.axes[3]*r,Math.sign(-t.axes[3])):s?(this.startPan(0,0),this.pan(5*-t.axes[2]*r,5*t.axes[3]*r)):(this.startRotate(0,0),this.rotate(10*-t.axes[2]*r,10*t.axes[3]*r))}});const D=e.X3DFlyViewer;var _=t.n(D);const O=new(C())(300,300,400);Object.assign(_().prototype,{gamepads:function(){const e=new(C());return function(t){const i=t.find((({axes:e})=>e[2]||e[3]));if(!i)return void(this.startTime=Date.now());const s=i.buttons[0].pressed;i.buttons[1].pressed?(e.set(i.axes[2],-i.axes[3],0).multVec(O),this.direction.add(e).divide(2),this.pan()):(e.set(i.axes[2],0,i.axes[3]).multVec(O).multiply(s?2:1),this.direction.add(e).divide(2),this.fly())}}()});const L=e.X3DViewer;var X=t.n(L);Object.assign(X().prototype,{gamepads(){}});const I=Symbol(),T=Symbol(),N=Symbol(),k=Symbol(),z=Symbol(),G=Symbol(),H=Symbol(),W=Symbol();function U(){this[H]=[]}Object.assign(U.prototype,{async initXRSession(){return F().acquire(`X3DWebXRContext.session-${this.getId()}`,(async()=>{if(this.getSession()!==window)return;const e=this.getContext(),t=this.getBrowserOption("XRSessionMode").toLowerCase().replaceAll("_","-"),i=(await e.makeXRCompatible(),await navigator.xr.requestSession(t)),s=await i.requestReferenceSpace("local");e.bindFramebuffer(e.FRAMEBUFFER,null),this.cameraEvents().addInterest("updatePose",this),this.finishedEvents().addInterest("updatePointers",this),this.endEvents().addInterest("endFrame",this),i.addEventListener("inputsourceschange",(e=>this.updateInputSources(e))),i.addEventListener("end",(()=>this.stopXRSession())),this[I]=s,this[k]=new Set,this[z]=new(n())(this,4,2,.9),this[G]=new v(this),Object.assign(this[H],{action:!0}),this[N]={cameraSpaceMatrix:new(p()),viewMatrix:new(p()),views:[]},this.updateBaseLayer({},i),this.setSession(i),this.removeHit(this.getHit()),this.getRenderingProperties()._XRSession=!0}))},stopXRSession(){return F().acquire(`X3DWebXRContext.session-${this.getId()}`,(async()=>{if(this.getSession()!==window){await this.getSession().end().catch(Function.prototype),this.cameraEvents().removeInterest("updatePose",this),this.finishedEvents().removeInterest("updatePointers",this),this.endEvents().removeInterest("endFrame",this),this.setSession(window),this.setDefaultFramebuffer(null);for(const{hit:e}of this[k])this.removeHit(e);this[I]=null,this[T]=null,this[N]=null,this[k]=null,this[z]=null,this[G]=null,this[W]=null,this.getRenderingProperties()._XRSession=!1}}))},setFramebufferScaleFactor(e){this.updateBaseLayer({framebufferScaleFactor:e})},updateBaseLayer(e={},t=this.getSession()){if(t===window)return;const i=new XRWebGLLayer(t,this.getContext(),Object.assign({antialias:!1,alpha:!0,depth:!1,ignoreDepthValues:!0,framebufferScaleFactor:this.getRenderingProperty("ContentScale")},e));this[T]=i,t.updateRenderState({baseLayer:i}),this.setDefaultFramebuffer(i.framebuffer)},updateInputSources(e){for(const t of e.added)this[k].add(Object.assign(t,{active:!1,matrix:new(p()),inverse:new(p()),hit:Object.assign(this.getHit().copy(),{button:!1,pressed:!1,pulse:!0,poseViewMatrix:new(p()),originalPoint:new(C()),originalNormal:new(C())})})),t.gamepad&&(t.gamepad.hit=t.hit);for(const t of e.removed)this.removeHit(t.hit),this[k].delete(t)},setFrame(e){if(!e)return;this[W]=e;!this.getCanvas().parent().is(this.getSurface())&&this.getCanvas().css(this.getXREmulatorCSS()),this[H].length=0;for(const{active:e,gamepad:t}of this[k])e&&(t.axes.length<4||this[H].push(t));this.getViewer().gamepads(this[H]),this.addBrowserEvent()},getPose(){return this[N]},updatePose(){const e=this[W].getViewerPose(this[I]),t=this[N];t.cameraSpaceMatrix.assign(e.transform.matrix),t.viewMatrix.assign(e.transform.inverse.matrix);let i=0;for(const s of e.views){const{x:e,y:r,width:n,height:a}=this[T].getViewport(s);if(!n)continue;this.reshapeFramebuffer(i,0|e,0|r,0|n,0|a);const o=t.views[i]??={projectionMatrix:new(p()),cameraSpaceMatrix:new(p()),viewMatrix:new(p()),matrix:new(p()),inverse:new(p())};o.projectionMatrix.assign(s.projectionMatrix),o.cameraSpaceMatrix.assign(s.transform.matrix),o.viewMatrix.assign(s.transform.inverse.matrix),o.matrix.assign(t.cameraSpaceMatrix).multRight(o.viewMatrix),o.inverse.assign(o.cameraSpaceMatrix).multRight(t.viewMatrix),++i}t.views.length=i,this.getFramebuffers().length=i},updatePointers:function(){const e=new(R())(.5,.75,1),t=new(p()),i=new(C())(0,0,-.5),s=new(C()),r=new(C()),n=new(C()),a=new(A());return function(){const o=this.getViewport().getValue(),c=this[N];for(const e of this[k]){const{targetRaySpace:t,matrix:i,inverse:s}=e,r=this[W].getPose(t,this[I]);e.active=!!r,r&&(i.assign(r.transform.matrix),s.assign(r.transform.inverse.matrix))}for(const e of this[k]){const{active:i,gamepad:s,matrix:r,hit:n}=e;if(!i)continue;if(this.touch(o[2]/2,o[3]/2,n,e),this.sensorHitPulse(n,s),!n.id)continue;const a=c.views[0].projectionMatrix;n.pressed||n.poseViewMatrix.assign(c.viewMatrix),t.assign(r).multRight(n.poseViewMatrix);for(const e of n.sensors.values())e.projectionMatrix.assign(a),e.modelViewMatrix.multRight(t);M().projectPoint(n.point,t,a,o,n.pointer),n.originalPoint.assign(n.point),n.originalNormal.assign(n.normal),n.ray.multLineMatrix(t),t.multVecMatrix(n.point),t.submatrix.inverse().multMatrixVec(n.normal)}for(const{active:e,gamepad:t,hit:i}of this[k]){if(!e)continue;const s=t?.buttons[0];s?.pressed?i.button||(i.button=!0,i.pressed||=this.buttonPressEvent(0,0,i)):(i.button=!1,i.pressed&&(i.pressed=!1,this.buttonReleaseEvent(i))),this.motionNotifyEvent(0,0,i)}for(const[h,{viewMatrix:d,projectionMatrix:u}]of c.views.entries()){const c=this.getFramebuffers()[h];for(const{active:h,gamepad:l,matrix:m,hit:f}of this[k]){if(!h)continue;const p=l?.buttons.some((e=>e.pressed)),g=p?e:R().White;if(t.assign(m).multRight(d),t.multVecMatrix(s.assign(C().Zero)),t.multVecMatrix(r.assign(i)),t.multVecMatrix(n.assign(f.originalPoint)),f.id&&n.distance(s)<r.distance(s)&&r.assign(n),s.z>0||r.z>0)continue;if(M().projectPointMatrix(s,u,o,s),M().projectPointMatrix(r,u,o,r),s.z=0,r.z=0,this[z].setColor(g).display(s,r,c),!f.id)continue;const x=p?.005:.007;t.assign(m).multRight(d).translate(f.originalPoint).rotate(a.setFromToVec(C().zAxis,f.originalNormal)),this[G].display(x,g,.3,.8,t,u,c)}}}}(),endFrame(){this.getContext().bindVertexArray(null)},sensorHitPulse(e,t){e.sensors.size?e.pulse&&(t?.hapticActuators?.[0]?.pulse(.25,10),e.pulse=!1):e.pulse=!0}});const q=U,Y=x().add("X3DWebXRContext",q);s().add({name:"WebXR",concreteNodes:[],abstractNodes:[],browserContext:Y});x().add("WebXRComponent",undefined)})();
|
|
1
|
+
/* X_ITE v11.2.3 */
|
|
2
|
+
const t=window[Symbol.for("X_ITE.X3D-11.2.3")];(()=>{var e={254:e=>{e.exports=t.jquery}},i={};function s(t){var r=i[t];if(void 0!==r)return r.exports;var n=i[t]={exports:{}};return e[t](n,n.exports,s),n.exports}s.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return s.d(e,{a:e}),e},s.d=(t,e)=>{for(var i in e)s.o(e,i)&&!s.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);const r=t.Components;var n=s.n(r);const a=t.ScreenLine;var o=s.n(a);const c=t.GeometryContext;var h=s.n(c);const d=t.AlphaMode;var l=s.n(d);const u=t.VertexArray;var p=s.n(u);const x=t.Layer;var m=s.n(x);const f=t.Matrix4;var g=s.n(f);const w=t.Namespace;var b=s.n(w);function v(t){const e=t.getContext();this.browser=t,this.vertexArrayObject=new(p())(e),this.circleVertexBuffer=e.createBuffer(),this.circleGeometryContext=new(h())({renderObject:new(m())(t.getPrivateScene()),alphaMode:l().BLEND,geometryType:1}),this.circleGeometryContext.renderObject.setup();const i=t.getCircle2DOptions().getGeometry().getVertices();this.circleNumVertices=i.length/4,e.bindBuffer(e.ARRAY_BUFFER,this.circleVertexBuffer),e.bufferData(e.ARRAY_BUFFER,i.getValue(),e.STATIC_DRAW),this.diskVertexBuffer=e.createBuffer(),this.diskGeometryContext=new(h())({renderObject:this.circleGeometryContext.renderObject,alphaMode:l().BLEND,geometryType:3});const s=t.getDisk2DOptions().getDiskVertices();this.diskNumVertices=s.length/4,e.bindBuffer(e.ARRAY_BUFFER,this.diskVertexBuffer),e.bufferData(e.ARRAY_BUFFER,s.getValue(),e.STATIC_DRAW)}Object.assign(v.prototype,{display:(()=>{const t=new Float32Array(g().Identity),e=new Float32Array(g().Identity),i=new Float32Array(g().Identity),s=new(g()),r=[];return function(n,a,o,c,h,d,l){const u=this.browser,p=u.getContext(),x=u.getViewport();l.bind(),p.viewport(...x),p.scissor(...x);const m=n*Math.abs(h.origin.z),f=h.xAxis.normalize().multiply(m),g=h.yAxis.normalize().multiply(m),w=h.zAxis.normalize().multiply(m);s.set(...f,0,...g,0,...w,0,...h.origin,1),t.set(d),e.set(s),p.depthMask(!1),p.disable(p.DEPTH_TEST),p.enable(p.BLEND),p.disable(p.CULL_FACE);{const s=u.getDefaultMaterial().getShader(this.circleGeometryContext);s.enable(p),s.setClipPlanes(p,r),p.uniformMatrix4fv(s.x3d_ProjectionMatrix,!1,t),p.uniformMatrix4fv(s.x3d_ModelViewMatrix,!1,e),p.uniformMatrix4fv(s.x3d_EyeMatrix,!1,i),p.uniform3f(s.x3d_EmissiveColor,0,0,0),p.uniform1f(s.x3d_Transparency,c),this.vertexArrayObject.enable(s.getProgram())&&s.enableVertexAttribute(p,this.circleVertexBuffer,0,0),p.drawArrays(p.LINES,0,this.circleNumVertices)}{const s=u.getDefaultMaterial().getShader(this.diskGeometryContext);s.enable(p),s.setClipPlanes(p,r),p.uniformMatrix4fv(s.x3d_ProjectionMatrix,!1,t),p.uniformMatrix4fv(s.x3d_ModelViewMatrix,!1,e),p.uniformMatrix4fv(s.x3d_EyeMatrix,!1,i),p.uniform3f(s.x3d_EmissiveColor,...a),p.uniform1f(s.x3d_Transparency,o),this.vertexArrayObject.enable(s.getProgram())&&s.enableVertexAttribute(p,this.diskVertexBuffer,0,0),p.drawArrays(p.TRIANGLES,0,this.diskNumVertices)}p.depthMask(!0),p.enable(p.DEPTH_TEST),p.disable(p.BLEND)}})(),dispose(){const t=this.browser.getContext();t.deleteBuffer(this.diskVertexBuffer),this.diskVertexArrayObject.dispose(t)}});const y=v,S=b().add("ScreenPoint",y),M=t.ViewVolume;var V=s.n(M);const R=t.Color3;var P=s.n(R);const A=t.Vector3;var C=s.n(A);const j=t.Rotation4;var E=s.n(j);const B=t.Lock;var F=s.n(B);const _=t.ExamineViewer;var D=s.n(_);Object.assign(D().prototype,{gamepads(t){const e=t.find((({axes:t})=>t[2]||t[3]));if(!e)return void(t.action&&(t.action=!1,this.disconnect()));const i=e.buttons[0].pressed,s=e.buttons[1].pressed;t.button0===i&&t.button1===s||(t.button0=i,t.button1=s,this.disconnect());const r=60/this.getBrowser().currentFrameRate;t.action=!0,i?this.zoom(.005*e.axes[3]*r,Math.sign(-e.axes[3])):s?(this.startPan(0,0),this.pan(5*-e.axes[2]*r,5*e.axes[3]*r)):(this.startRotate(0,0,1),this.rotate(10*-e.axes[2]*r,10*e.axes[3]*r))}});const O=t.X3DFlyViewer;var N=s.n(O);const L=new(C())(300,300,400);Object.assign(N().prototype,{gamepads:function(){const t=new(C());return function(e){const i=e.find((({axes:t})=>t[2]||t[3]));if(!i)return void(this.startTime=Date.now());const s=i.buttons[0].pressed;i.buttons[1].pressed?(t.set(i.axes[2],-i.axes[3],0).multVec(L),this.direction.add(t).divide(2),this.pan()):(t.set(i.axes[2],0,i.axes[3]).multVec(L).multiply(s?2:1),this.direction.add(t).divide(2),this.fly())}}()});const U=t.X3DViewer;var T=s.n(U);Object.assign(T().prototype,{gamepads(){}});var k=s(254);const I=Symbol(),X=Symbol(),z=Symbol(),G=Symbol(),H=Symbol(),W=Symbol(),q=Symbol(),Y=Symbol(),Z=Symbol(),J=Symbol();function K(){this[Z]=[]}Object.assign(K.prototype,{getPose(){return this[G]},xrAddButton(){this.getBrowserOption("XRButton")&&k("<div></div>").attr("part","xr-button").attr("title","Start WebXR session.").addClass("x_ite-private-xr-button").on("mousedown touchstart",!1).on("mouseup touchend",(t=>{t.preventDefault(),t.stopImmediatePropagation(),t.stopPropagation(),this.startAudioElements(),this.getSession()===window?this.xrStartSession():this.xrStopSession()})).appendTo(this.getSurface())},async xrStartSession(){return F().acquire(I,(async()=>{if(this.getSession()!==window)return;const t=this.getContext(),e=this.getBrowserOption("XRSessionMode").toLowerCase().replaceAll("_","-"),i=await navigator.xr.requestSession(e),s=await i.requestReferenceSpace("local");await t.makeXRCompatible();this.finishedEvents().addInterest("xrUpdatePointers",this),i.addEventListener("visibilitychange",(()=>this.xrUpdateVisibility())),i.addEventListener("inputsourceschange",(t=>this.xrUpdateInputSources(t))),i.addEventListener("end",(()=>this.xrStopSession())),this[X]=s,this[H]=!0,this[W]=new Set,this[q]=new(o())(this,4,2,.9),this[Y]=new S(this),Object.assign(this[Z],{action:!0}),this[G]={cameraSpaceMatrix:new(g()),viewMatrix:new(g()),views:[]},this.xrUpdateBaseLayer({},i),this.setSession(i),this.removeHit(this.getHit()),this.getRenderingProperties()._ContentScale.addInterest("xrContentScale",this),this.getRenderingProperties()._XRSession=!0}))},xrStopSession(){return F().acquire(I,(async()=>{if(this.getSession()!==window){await this.getSession().end().catch(Function.prototype),this.finishedEvents().removeInterest("xrUpdatePointers",this),this.setSession(window),this.setDefaultFramebuffer(null);for(const{hit:t}of this[W])this.removeHit(t);this[X]=null,this[z]=null,this[G]=null,this[H]=!1,this[W]=null,this[q]=null,this[Y]=null,this[J]=null,this.getRenderingProperties()._ContentScale.removeInterest("xrContentScale",this),this.getRenderingProperties()._XRSession=!1}}))},xrContentScale(){this.xrUpdateBaseLayer()},xrUpdateBaseLayer(t={},e=this.getSession()){if(e===window)return;const i=new XRWebGLLayer(e,this.getContext(),Object.assign({antialias:!1,alpha:!0,depth:!1,ignoreDepthValues:!0,framebufferScaleFactor:this.getRenderingProperty("ContentScale")},t));this[z]=i,e.updateRenderState({baseLayer:i}),this.setDefaultFramebuffer(i.framebuffer)},xrUpdateNearFarPlanes:function(){const t={};return function(){const e=this.getActiveNavigationInfo(),i=this.getActiveViewpoint();i?(t.depthNear=i.getNearDistance(e),t.depthFar=i.getFarDistance(e)):(t.depthNear=.1,t.depthFar=1e4),this.getSession().updateRenderState(t)}}(),xrUpdateVisibility(t){switch(this.getSession().visibilityState){case"visible-blurred":case"hidden":this[H]=!1;break;default:this[H]=!0}},xrUpdateInputSources(t){for(const e of t.added)this[W].add(Object.assign(e,{active:!1,matrix:new(g()),inverse:new(g()),hit:Object.assign(this.getHit().copy(),{button:!1,pressed:!1,pulse:!0,poseViewMatrix:new(g()),originalPoint:new(C()),originalNormal:new(C())})})),e.gamepad&&(e.gamepad.hit=e.hit);for(const e of t.removed)this.removeHit(e.hit),this[W].delete(e);this.xrUpdateGamepads()},xrUpdateGamepads(){this[Z].length=0;for(const{gamepad:t}of this[W])t&&(t.axes.length<4||this[Z].push(t))},xrFrame(t){t&&(this[J]=t,this.xrUpdateNearFarPlanes(),this.getViewer().gamepads(this[Z]),this.xrUpdatePose(),this.addBrowserEvent())},xrUpdatePose(){const t=this[J].getViewerPose(this[X]),e=this[G];e.cameraSpaceMatrix.assign(t.transform.matrix),e.viewMatrix.assign(t.transform.inverse.matrix);let i=0;for(const s of t.views){const{x:t,y:r,width:n,height:a}=this[z].getViewport(s);if(!n)continue;this.reshapeFramebuffer(i,t,r,n,a);const o=e.views[i]??={projectionMatrix:new(g()),cameraSpaceMatrix:new(g()),viewMatrix:new(g()),matrix:new(g()),inverse:new(g())};o.projectionMatrix.assign(s.projectionMatrix),o.cameraSpaceMatrix.assign(s.transform.matrix),o.viewMatrix.assign(s.transform.inverse.matrix),o.matrix.assign(e.cameraSpaceMatrix).multRight(o.viewMatrix),o.inverse.assign(o.cameraSpaceMatrix).multRight(e.viewMatrix),++i}this.getFramebuffers().length=i,e.views.length=i},xrUpdatePointers:function(){const t=new(P())(.5,.75,1),e=new(g()),i=new(C())(0,0,-.5),s=new(C()),r=new(C()),n=new(C()),a=new(E());return function(){const o=this.getViewport().getValue(),c=this[G];for(const t of this[W]){const{targetRaySpace:e,matrix:i,inverse:s}=t,r=this[J].getPose(e,this[X]);t.active=!!r,r&&(i.assign(r.transform.matrix),s.assign(r.transform.inverse.matrix))}for(const t of this[W]){const{active:i,gamepad:s,matrix:r,hit:n}=t;if(!i)continue;if(this.touch(o[2]/2,o[3]/2,n,t),this.xrSensorHitPulse(n,s),!n.id)continue;const a=c.views[0].projectionMatrix;n.pressed||n.poseViewMatrix.assign(c.viewMatrix),e.assign(r).multRight(n.poseViewMatrix);for(const t of n.sensors.values())t.projectionMatrix.assign(a),t.modelViewMatrix.multRight(e);V().projectPoint(n.point,e,a,o,n.pointer),n.originalPoint.assign(n.point),n.originalNormal.assign(n.normal),n.ray.multLineMatrix(e),e.multVecMatrix(n.point),e.submatrix.inverse().multMatrixVec(n.normal)}for(const{active:t,gamepad:e,hit:i}of this[W]){if(!t)continue;const s=e?.buttons[0];s?.pressed?i.button||(i.button=!0,i.pressed||=this.buttonPressEvent(0,0,i)):(i.button=!1,i.pressed&&(i.pressed=!1,this.buttonReleaseEvent(i))),this.motionNotifyEvent(0,0,i)}if(this[H])for(const[h,{viewMatrix:d,projectionMatrix:l}]of c.views.entries()){const c=this.getFramebuffers()[h];for(const{active:h,gamepad:u,matrix:p,hit:x}of this[W]){if(!h)continue;const m=u?.buttons.some((t=>t.pressed)),f=m?t:P().White;if(e.assign(p).multRight(d),e.multVecMatrix(s.assign(C().Zero)),e.multVecMatrix(r.assign(i)),e.multVecMatrix(n.assign(x.originalPoint)),x.id&&n.distance(s)<r.distance(s)&&r.assign(n),s.z>0||r.z>0)continue;if(V().projectPointMatrix(s,l,o,s),V().projectPointMatrix(r,l,o,r),s.z=0,r.z=0,this[q].setColor(f).display(s,r,c),!x.id)continue;const g=m?.005:.007;e.assign(p).multRight(d).translate(x.originalPoint).rotate(a.setFromToVec(C().zAxis,x.originalNormal)),this[Y].display(g,f,.3,.8,e,l,c)}}}}(),xrSensorHitPulse(t,e){t.sensors.size?t.pulse&&(e?.hapticActuators?.[0]?.pulse(.25,10),t.pulse=!1):t.pulse=!0}});const Q=K,$=b().add("X3DWebXRContext",Q);n().add({name:"WebXR",concreteNodes:[],abstractNodes:[],browserContext:$});b().add("WebXRComponent",undefined)})();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/* X_ITE v11.2.
|
|
2
|
-
const __X_ITE_X3D__ = window [Symbol .for ("X_ITE.X3D-11.2.
|
|
1
|
+
/* X_ITE v11.2.3 */
|
|
2
|
+
const __X_ITE_X3D__ = window [Symbol .for ("X_ITE.X3D-11.2.3")];
|
|
3
3
|
/******/ (() => { // webpackBootstrap
|
|
4
4
|
/******/ "use strict";
|
|
5
5
|
/******/ // The require scope
|
|
@@ -1444,7 +1444,7 @@ Object .assign (Object .setPrototypeOf (InstancedShape .prototype, (external_X_I
|
|
|
1444
1444
|
|
|
1445
1445
|
return function ()
|
|
1446
1446
|
{
|
|
1447
|
-
if (this .
|
|
1447
|
+
if (this .isDefaultBBoxSize ())
|
|
1448
1448
|
{
|
|
1449
1449
|
if (this .getGeometry ())
|
|
1450
1450
|
{
|